Coder Social home page Coder Social logo

freeserf.net's Introduction

Freeserf.net

Freeserf.net is an authentic remake of the game The Settlers I by BlueByte.

To avoid copyright issues I won't provide any copyrighted data from the original game like music or graphics. To play the game you will therefore need the original DOS or Amiga data files.

Freeserf.net is a C# port and extension of freeserf.

Build status

Download the game

Windows Linux
v2.1.1 v2.1.1

Builds for other platforms will follow later. Only recent Ubuntu versions are tested for Linux version.

Note: For now you need the DOS data file 'SPAx.PA' to run the game, where x stands for the language shortcut. You can also use the Amiga files (either the disk files "*.adf" or the extracted files like "sounds" and "music" will work). Amiga music and sounds work well but the map tiles are not displayed properly.

You can combine DOS and Amiga data (e.g. music from Amiga and graphics from DOS). See configuration for more information about the Freeserf.net configuration.

For Ubuntu make sure you have installed libgdiplus via command sudo apt-get install libgdiplus.

Audio is provided by BASS. The assemblies are contained in the releases but they are for 64-bit systems only. If you have a 32-bit system you have to download them on your own or from here.

Support development

If you want to support this project or other projects of me you can do so here.

Become a patron Sponsor Donate Flattr
Thank you very much!

You may also be interested in my other projects:

  • Ambermoon.net - a C# rework of the Amiga classic Ambermoon
  • Ambermoon - a research project to track findings of Ambermoon data decryption

Current State

Currently I am working on multiplayer support.

All the code from freeserf was ported or re-implemented. AI logic was added in addition.

The renderer is using Silk.net and netcore 3.1.

Things that are missing are some minor parts of AI logic and tutorial games.

The game is playable for most parts. If you find any bugs please report it in the Issue Tracker. You can also look for open issues there.

Normal Game Mission Ingame Menus Map

Roadmap

Phase 1: Porting (100%) - [Finished]

The first step is to port everything from C++ to C# and ensure that the game runs. There may be some quick&dirty implementations or things that could be done better.

Phase 2: Optimizing (100%) - [Finished]

This includes bug fixing and C#-specific optimizations. Moreover this includes performance and stability optimizations if needed. Also the plan is to make everything cross-plattform as much as possible.

Phase 3: Extending (15%) - [Active]

This includes:

  • New features
  • Better usability
  • Other things like mod support, tools and so on

Future Goal

At the end this should become a stable and performant game that runs on many platforms and can be easily compiled and extended by .NET developers.

I am not sure how far this project will go as my time is very limited. I can not promise anything at this point.

Implementation details

The core is implemented as a .NET Standard 2.1 DLL. The renderer is also a .NET Standard 2.1 DLL and uses Silk.NET for rendering. The sound engine is using BASS and is capable of playing MIDI, MOD and SFX/WAV on Windows and Linux.

The main program is based on netcore 3.1 and should run at least on Windows and Ubuntu.

Contribution

If you need help or want to help developing, just contact me. You can also contact me via Issue Tracker by adding a new issue and tag it as question.

There is a more or less up-to-date list with open issues of several relevances and importances.

Ingame key shortcuts

Key Description
DEL Demolish active building, road or flag
ESC Abort road building, close ingame windows
TAB Open notification
Ctrl+TAB Return to last map position after notification
Shift+M Toggle music
Shift+S Toggle sound effects
0 Reset game speed to normal
9 Maximize game speed
P Pause or resume game
+ Increase game speed
- Decrease game speed
> Zoom in
< Zoom out
F11 Toggle fullscreen mode
Ctrl+F Toggle fullscreen mode
F5 Quick save
F6 Open save dialog
Shift+Q Open quit dialog
Shift+P Open player overview
B Toggle possible builds
H Go to your own castle
J Jump between players (AIvsAI and spectators only)
M Toggle minimap

freeserf.net's People

Contributors

kaphula avatar noxdk avatar pyrdacor avatar robertflavia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freeserf.net's Issues

AI only crafts swords and has no shields

i don't know when that effect starts, but after a very long speedrun (>50 minutes) i checked his castles and discovered that several AIs had over 100 swords stored but 0 shields.
b197-m3-4ai-saves.zip

But the game runs extremely stable now (at least on m3 map, i'll test m9 later), thank you for improving it that far!

crash on deleting flag

Burnt a building connected to a road, error when deleting the attached flag. The given key was not present in the dictionary"

"
capture

Has the concept of „over-fishing“ been implemented?

I recall that in Amiga Settlers it was a real thing.
Had a game recently where the AI built several fisher huts around a small pond and had several stacks of fish lying around. Old Amiga Settlers handbook gave the tip to use max 3-4 fishing huts per screen-sized lake to prevent fish extinction in that lake. (On amiga, screen-resolution was considerably larger than standard dos-vga settlers resolution.)

AI behaves very different on the largest mapsize (9)

It seems to only build a handful buildings in contrast to smaller mapsizes (i tested til size 5, were it expands normally).
And it takes a very long time on 9 to even choose a place for its castles.
B183-M9-4AI-DEMO1-SAVE1.zip
(i'll test on size 7 later)

Edit:
It seems the bigger the map is the more it hampers the progress of the AI; in map7 it expands but still takes very long to choose a starting site. In map9 i continued and finally 1 of the AIs expanded but one of the 4 was still searching for a place to embark and land its castle.

Edit2:
Continued on map7 (now clocked >30minutes according to ingame statistics; at max.speed) and half of the AIs still have not placed their castles.. there must be something fishy going on.
B183-M7-4AI-DEMO1-SAVE1.zip

Edit3:
It seems the AI-problems start in mapsize 6, there i have a non-demo game with 3 AIs where 2 of them "refuse" to place their castles.
B183-M6-GAME1-3AI-SAVE1.zip

some AIs seem to have problems in an early game phase sometimes..

in that same savegame (which can't be loaded), the magenta AI(No.7 = 'Count Aldaba',) stopped to deliver material to its construction sites even with enough resources and priorities correctly set (and enough carriers present); the yellow AI(No.8 = 'King Rolph VI') had problems too: it stopped creating new buildings.
[Edit: This is only a minor issue, in my opinion, because the other AIs worked flawlessly in that game.]

savegame could not be loaded

"Error: [savegame] Failed to load save game: The specified key was not specified in the dictionary."
(second part translated with google)
B17M3DEMO1AI4.zip
saved after running the demo for minutes (max speed)

road-building sometimes hindered by trees

B14B-M3-GAME1.zip
in above savegame it is impossible to build a road northwest of the western flag (very near to the castle), to connect the northern hut, after a double-click it builds a road to the west, totally avoiding the tree (but that alternate road is not very useful)

Crash: [serf]Collection was modified; enumeration operation may not execute.

This one was after several hours of play. It looks like it occurred when a building was captured - that would be the enemy HQ.


[serf]Collection was modified; enumeration operation may not execute.

========== Stack Trace: ==========

at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Enumerator.MoveNext() at Freeserf.Collection1.d__11.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Freeserf.Building.BurnUp()
at Freeserf.Game.DemolishBuilding(UInt32 pos)
at Freeserf.Game.OccupyEnemyBuilding(Building building, UInt32 playerIndex)
at Freeserf.Serf.HandleKnightOccupyEnemyBuilding()
at Freeserf.Serf.Update()

crash-28-03-19-02-39-27.zip

game crashes on startup

I can't get the Build1.0 version to run. This is the first I've tried running your .net version of Freeserf. I don't know anything about C# or .NET development so I'm not sure if there are some dependencies I'm unaware of. I placed SPAE.PA in the same directory as freeserf.net.exe. Visual Studio says the crash is on

System.IO.FileNotFoundException: 'Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.'

I'm running windows7 64bit

Crash("Critical Error") : 'Target array not long enough to copy all elements in the collection'

Tested with: Build 1.9.4

Mapsize: 9
Type: Demo
AI-Players: 4 (at max. level)
Estimated play time: ~10-15 minutes (at top speed)
Reload tested: Yes, several times, works 100%

Log file: "Error: [FrameTimer] The target array is not long enough to copy all elements in the collection. Check array index and length."

Contents of error-handling window:

The target array is not long enough to copy all the items in the collection. Check array index and length.

========== Stack Trace: ==========

at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.CopyTo (KeyValuePair`2 [] array, Int32 index)
at System.Collections.Generic.Dictionary`2.System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <TKey, TValue >>. CopyTo (KeyValuePair`2 [] array, Int32 index)
at System.Collections.Generic.List`1..ctor (IEnumerable`1 collection)
at System.Linq.Enumerable.ToList [TSource] (IEnumerable`1 source)
at Freeserf.Game.UpdateRoads ()
at Freeserf.Game.UpdateVisuals ()
at Freeserf.Game.Update ()
at Freeserf.UI.Interface.Update ()
at Freeserf.LocalSpectatorViewer.Update ()
at Freeserf.Renderer.OpenTK.GameView.Render ()
at Freeserf.FreeserfForm.FrameTimer_Tick (Object sender, EventArgs e)

b194-m9-4ai-demo1.zip

Construction worker ignores border changes

When having a construction worker at a site near the border and it gets pushed back by the neighbour (burning the site), the yellow-hat stays there indefinitely waiting for his (never arriving) material.

Critical Error: "[building]Delivered unexpected resource"

version: build 1.9.5

mapsize: 3
AIs: 4
testing duration: not long, 3-4 minutes at max.speed

The AI villages were still small when it happened.

[building]Delivered unexpected resource. Index 41, Type GoldSmelter, Resource Plank

Stack Trace:

at Freeserf.Building.RequestedResourceDelivered(Type resource)
at Freeserf.Serf.HandleSerfDeliveringState()
at Freeserf.Serf.Update()
at Freeserf.Game.UpdateSerfs()
at Freeserf.Game.UpdateVisuals()
at Freeserf.Game.Update()
at Freeserf.UI.Interface.Update()
at Freeserf.LocalSpectatorViewer.Update()
at Freeserf.Renderer.OpenTK.GameView.Render()
at Freeserf.FreeserfForm.FrameTimer_Tick(Object sender, EventArgs e)

Log file: "Error: [FrameTimer] [building]Delivered unexpected resource. Index 41, Type GoldSmelter, Resource Plank"

b195-m3-4ai-demo1-saves.zip
(crash-save included)

--
Edit: Would it be a good idea to make an alternate .exe with single-threading (while we are still in testing-phase)?

After battle serfs get stuck

After a battle, a number of mines were burnt, and two issues occurred.
These two builders became stuck on screen, not on the map. (they move around as I scroll)
stuck

These miners are stuck in place on the map. (they don't move when I scroll, but they don't go home)
stuck2

Update doesn't work

After starting .exe the patcher launches and it looks as if it does update, but ingame it still shows v1.9.6 and after a second start of the .exe the patcher runs again and the properties of the exe say 1.9.6.0, too.

Edit:
Ok, the workaround is to unpack v1.9[.0] again into another dir and patch directly from 1.9.0 > 1.9.7

a minor issue: sometimes a 'shadow' of an earlier game was shown in a second game

i recalled, that v1.7 sometimes showed some relics of former games when going back to menu and starting a new game, then one could see old settlement borders while scrolling the view. the real borders stuck in the landscape while the former 'shadow' borders moved in it (while moving the view), thus showing two overlapping settlement-borders. But in v1.8 i didnt see that yet, maybe it got fixed as a side-effect of other bugfixes.
In v1.7 the work-around was to restart freeserf.net (sorry that i forgot to report it earlier, i thought it was not important compared to the other issues)

Crash: Index was outside the bounds of the array.

About an hour into a game. Didn't seem to be caused by any user action.


Index was outside the bounds of the array.

========== Stack Trace: ==========

at Freeserf.Serf.HandleSerfStateKnightLeaveForWalkToFight()
at Freeserf.Serf.Update()
at Freeserf.Game.UpdateSerfs()
at Freeserf.Game.UpdateVisuals()
at Freeserf.Game.Update()
at Freeserf.UI.Interface.Update()
at Freeserf.LocalSpectatorViewer.Update()
at Freeserf.Renderer.OpenTK.GameView.Render()
at Freeserf.FreeserfForm.FrameTimer_Tick(Object sender, EventArgs e)

question about serf/resource pathfinding on roads

I was looking for a way to calculate the flag path to the castle/stock. I figure that in order for serfs and resources to find their destination the existing FreeSerf game code must have it. However, I have looked at the code for a while and I don't understand it. It seems serfs and resources have destinations, but I can't find the code that figures out which direction's path gets it closer to the final destination. I see you wrote a pathfinder function for this, but I am wondering how the original code does it? I think the logic is hidden in bit-shifting that I am not understanding. Any ideas?

linux port and AI

Hi,

I like your project. I am thinking about porting it to Linux. But I have a question:

Imagine I wanted to make two different AIs play until one of them wins. Would your architecture support such game? I think: speed up the clock, let them play headless and later just look what they were up to?
Does your architecture support such scenario?

Boatman doesn't stay on his path

When I make a water path, the boatman carries his boat to the path, paddles down the path once, then goes home again, back to the castle or stock.

Crash after loading a 1.8.4 savegame with 1.9

MessageBox said "loaded successfully", but after click on exit it crashed.
Log: "Error: [FrameTimer] The object reference was not set to an object instance."
with savegame:
B184-MAP5-VS-3AI-SAVE3.zip
(in that savegame the AIs have also become seemingly static again, in v1.8.4)

Edit: Thankfully i can load 1.9.1-saves into 1.9.1. So it's only a minor issue.
And the 4 AIs now placed their castles really fast (on a size-9 map)! Thank you again.

Error while under attack: "Failed to decrease serf count"

Version: B1.9.4
Type: 1-player game
Map size: 3
No. of AIs: 3 (maxed)
Log file: "Error: [FrameTimer] [player]Failed to decrease serf count"
Circumstances:
After reducing the number of knights in the bordering huts, the yellow AI attacked the nearest one and managed to kill a knight. Right before he killed the second(and last one) the error popped up.

[player] Failed to decrease serf count

========== Stack Trace: ==========

at Freeserf.Player.DecreaseSerfCount (Type type)
at Freeserf.Serf.SetFightOutcome (Serf attacker, Serf defender)
at Freeserf.Serf.HandleSerfKnightPrepareAttacking ()
at Freeserf.Serf.Update ()
at Freeserf.Game.UpdateSerfs ()
at Freeserf.Game.UpdateVisuals ()
at Freeserf.Game.Update ()
at Freeserf.UI.Interface.Update ()
at Freeserf.LocalSpectatorViewer.Update ()
at Freeserf.Renderer.OpenTK.GameView.Render ()
at Freeserf.FreeserfForm.FrameTimer_Tick (Object sender, EventArgs e)

b194-m3-game1.zip
(crash save file included)

AI builds military buildings too densely

The AI frequently builds military buildings within 2 squares of each other. I can't remember what the limit was in the original, but more like 4 or 5.

Edit - just tested with the original Amiga version and actually the limit is only 2.5 hexagons vertically. 2 hexagons horizontally. The AI just didn't build them so densely.

unable to click on certain areas of map

Sometimes just a few tiles, but I've seen a large chunk of the map where nothing can be selected. I've only played one game so far but I see a few instances of this. Often when trying to connect a newly built building's flag the flag cannot be connected in some directions.

game freeze

i recalled that yesterday i got a game-freeze while watching a (very high) accelerated AI-only game, in the log it said something like "[building] yielded an unexpected resource" or so, sadly i didnt have that log anymore and forgot to save the game before the crash/freeze, sorry :/
Now i try to reproduce that bug with a similar game (both on mapsize 3, with 4 AIs which have all color bars maxed)

Sometimes cannot select position

It's a difficult one to explain, but occasionally it will become difficult or even impossible to select a particular hexagon. Clicking on its central point will just select one of the ones next to it. A similar thing happens with the path direction icons.
On one game this became so bad it was unusable, but I haven't been able to reproduce that. Zooming in and out, scrolling, and switching in and out of fullscreen don't seem to make any difference.

AI behaves differently in a loaded game

Tested on mapsize 6 (and this time i luckily saved early) with 4 AIs (with all 3 parameters maxed).
Before i reloaded the game the AI behaved normally and even expanded (and i got the freeze-bug again!) then i reloaded and watched minutes of speedrun with the AI becoming static and not making more buildings even with dozens of unemployed serfs.
Something changed in the AIs after the load of the savegame (and it also eliminated the freeze-bug in that particular game)
B191-MAP6-4AI-DEMO1.zip

Critical Error: "The index is greater than or equal to the length of the array, or the number of elements in the dictionary is greater than the available space from the index to the end of the target array."

version: build 1.9.5
type: 2-AI demo
map: 3
time elapsed: ~6-8 minutes

Der Index ist größer oder gleich der Länge des Arrays, oder die Anzahl der Elemente im Wörterbuch ist größer als der verfügbare Platz vom Index bis zum Ende des Zielarrays.

========== Stack Trace: ==========

bei System.Collections.Concurrent.ConcurrentDictionary2.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair2[] array, Int32 index)
bei System.Collections.Generic.List1..ctor(IEnumerable1 collection)
bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bei Freeserf.Game.UpdateRoads()
bei Freeserf.Game.UpdateVisuals()
bei Freeserf.Game.Update()
bei Freeserf.UI.Interface.Update()
bei Freeserf.LocalSpectatorViewer.Update()
bei Freeserf.Renderer.OpenTK.GameView.Render()
bei Freeserf.FreeserfForm.FrameTimer_Tick(Object sender, EventArgs e)

Log file: "Error: [FrameTimer] The index is greater than or equal to the length of the array, or the number of elements in the dictionary is greater than the available space from the index to the end of the target array."

b195-m3-2ai-demo1-saves.zip

(this time there was no save option in crash-handling window)

Knights retreat after win

After winning a fight, only the first knight goes into the enemy building. The others go home. They should fill the building and only the remaining knights go home.

Build 1.9.3 crashed: "Freeserf.net Critical Error" [index was out of range]

While doing a long 4-AI speedrun [map 3] it crashed (saving the crash-state was not possible as the button was missing, but luckily i could save it shortly before). ------------------------------------------------------------------------------------------------

The index was outside the array range.

========== Stack Trace: ==========

at Freeserf.Flag.FillPathSerfInfo (Game game, UInt32 pos, Direction dir, SerfPathInfo data)
at Freeserf.Game.BuildFlagSplitPath (UInt32 pos)
at Freeserf.Game.BuildFlag (UInt32 pos, Player player)
at Freeserf.Game.BuildBuilding (UInt32 pos, Type type, Player player)
at Freeserf.AIStates.AIStateBuildBuilding.Update (AI ai, Game player, Player player, PlayerInfo playerInfo, Int32 tick)
at Freeserf.AI.Update (Game game)
at Freeserf.Game.Update ()
at Freeserf.UI.Interface.Update ()
at Freeserf.LocalSpectatorViewer.Update ()
at Freeserf.Renderer.OpenTK.GameView.Render ()
at Freeserf.FreeserfForm.FrameTimer_Tick (Object sender, EventArgs e)

log file contents: "Error: [FrameTimer] The index was outside the array area."
b193-m3-4ai-demo1.zip
(Unfortunately, it will not be reproducible because of the reload bug, but maybe the save-data will help anyway.)

New freeze(crash?) problem with B1.9.9 ..

..after watching a long game between 3 AIs on mapsize 4 (in 1player-mode) it just froze without any prior warning. The logfile contains over 10k lines saying "Error: [data] Failed to get animation #128 phase #48 (got only 48 phases)"
It happened ~5-15 minutes after the last save.
(This time it didn't unmaximize the game-screen, therefore i couldn't copy the stack trace. I don't even know if there was such a window present, because all i could do was to reset back to taskman.)
Build199-Map4-3AIs-game1-saves.zip

freeze(crash) right after starting

log: "Error: [render] The object reference was not set to an object instance."
maybe a fluke
(i had to close it with taskmanager)
there was no error-window this time

savegames

'Since version 1.3 savegames should work correctly' - How?
i can't get it to load any savegame - clicking on them renders no reaction and clicking on start (in the load menu) does nothing. (the exit button closes the game altogether)
The log says 'Error: [savegame] Failed to load save game: A closed file can not be accessed.'

But thanks for continuing this great project! :-)
(my "programming knowledge" is very limited else i would help)

where do the savegames get stored?

Serfs enter stock when they shouldn't

Serfs enter a stock, even when the stop-all option is selected.
I haven't seen items enter the stock yet, but that doesn't mean they won't.

Edit - they also enter when the option is set to leave.

Error: [FrameTimer] [building]Failed to cancel unrequested resource delivery.

[building]Failed to cancel unrequested resource delivery.

========== Stack Trace: ==========

at Freeserf.Building.CancelTransportedResource(Type res)
at Freeserf.Game.CancelTransportedResource(Type type, UInt32 dest)
at Freeserf.Flag.ScheduleSlotToKnownDest(Int32 slot, Int32[] resWaiting)
at Freeserf.Flag.Update()
at Freeserf.Game.UpdateFlags()
at Freeserf.Game.UpdateVisuals()
at Freeserf.Game.Update()
at Freeserf.UI.Interface.Update()
at Freeserf.LocalSpectatorViewer.Update()
at Freeserf.Renderer.OpenTK.GameView.Render()
at Freeserf.FreeserfForm.FrameTimer_Tick(Object sender, EventArgs e)

b197-m9-4ai-saves.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.