CivOne - An Open Source remake of Civilization 1

Regarding the issue #448 with the shifting tiles, I'm attaching a SAV and MAP file where this happens.

Immediately after you build a road or irrigation with the settler and then SAVE --> LOAD the game, you'll notice this bug.
If you don't do anything with the settler and SAVE-->LOAD, this won't happen.

Hope this helps in finding the bug.

PS I've been doing some testing regarding barbarian spawning and have some interesting results. I'll post when I have more.
 

Attachments

Today I've (re)implemented sound support into CivOne.
Since reverse engineering the Civilization for DOS sound files is difficult, I've just enabled the ability to play the WAV files that belong to Civilization for Windows. I'm not entirely certain if I play the correct sounds at the right moment. If anyone is missing a sound, or hears the wrong sound, please let me know

@hospital
Thanks for your hard work, it's much appreciated. If you need any help, just let me know.

@axx
I'm looking forward to what you can report on the Barbarians.

Edit: I've been working all day to get some more API calls ready. With the current code, it's possible to make plugins that modify existing units:
  • Name
  • Shield price
  • Gold price
  • Attack/Defense strength
  • Number of moves
  • Required and obsolete tech
I still want to add an easy way to change unit graphics, and to change the Civilopedia text.

Before I post the new preview, I'm going to update the CivOne-Plugins repository with samples in C#, VB.NET and F#.

Edit 2: I've done some work on the Setup screen. It's now possible to override the default game options. So if you want to turn End of Game on for all games, just enable it in the Setup screen and it will be enabled for all games, regardless of the settings in the save game file.

I've also implemented the Plugins menu. In the future, I want to allow plugins to have their own settings. For now, in the Plugin settings menu, you can see the plugin version and author name, and Enable/Disable the plugin.

This week, I'll try adding some more API functions. write the API documentation and provide some samples.

In other news, there's currently only 8 more issues open for Alpha.1. Of those issues, 4 are bugs, 2 are unfinished features and 2 have something to do with the final Alpha.1 release. My hope is to create a solid, semi-stable first Alpha version for CivOne around May. Somehow, I feel that 12 May is appropriate because the first GitHub commit was on 12 May 2015.
Testing will be really important. Please, report any bugs and graphical issues that you run into, either on the forums or on the GitHub issues list. With a bit of luck, creating an official Alpha version is going to attract some attention (and possibly additional developers) to the project. :goodjob:
 
Last edited:
Yes I do agree that the project needs more publicity. Once you get first alpha going I'll spread the word on some forums I visit frequently (it's the least I can do).
Regarding barbarian spawning, hopefully this Friday I'll do more testing, my job has been mentally draining me this week :hammer2: At least barbarian ships are much easier to figure out than land units.
 
What do you think of using DebuggerDisplay? It can make debugging a little eaiser. For instance I would like to add this to the City class:

Code:
[DebuggerDisplay("{Player.TribeName} - {Name}")]
 
I notied that Game._players is a readonly array. To respawn civs I am going to need to add to it. Can I change it to a List<Player> or do I replace the destroyed player with the new one?
 
Last edited:
I am having some issues with respawning civ after one is destroyed. I think I have it working here https://github.com/cdonges/CivOne/tree/respawn except load and save.

I made this change to SaveDataAdapter.Set.cs but I am not sure if it's correct:

Code:
        private void SetUnitsActive(UnitData[][] unitData)
        {
            ushort[] data = new ushort[unitData.Length * 28];
            for (int p = 0; p < unitData.Length; p++)
            for (int i = 0; i < 28; i++)
            {
                data[(p * 28) + i] = (ushort)unitData[p].Count(u => u.TypeId == i);
            }
            SetArray(nameof(SaveData.UnitsActive), data);
        }

I am also having issues with SaveDataAdapter.cs. I changed the 8s to 16s. but not sure if that's correct?

Code:
        public byte[] CivilizationIdentity
        {
            get
            {
                byte[] output = new byte[16];
                for (int i = 0; i < 16; i++)
                    output[i] = (byte)(((_saveData.CivilizationIdentityFlag & (1 << i)) > 0) ? 1 : 0);
                return output;
            }
            set
            {
                ushort setValue = 0;
                for (int i = 0; i < value.Length; i++)
                    setValue |= (ushort)(value[i] % 2);
                _saveData.CivilizationIdentityFlag = setValue;
            }
        }

I then get an error on this line of Game.LoadSave.cs:

Code:
ICivilization civ = civs[gameData.CivilizationIdentity[i] % civs.Length];

When I get here civs is empty because there are none with prefered player number of 8 and I am not sure how to find it?

Sorry but I think I am stuck on this task now.
 
There's a bit more complexity behind respawning a civilization. A player cannot respawn more than once (this is checked against the ReplayData list), a player cannot be respawne after 1750 AD, and you need to set starting advances for a respawned player. Then, the save data format should not be altered, or it won't be compatible with the original game. There's only room for 8 players, so a player slot needs to be replaced with another. For a respawned player, that means removing the old player (only when it respawned, not upon destruction) and inserting a new player at the right index.

So, it won't be an easy task to implement. Perhaps you'll feel up to it later, or indeed, just continue with some other tasks first. Task #337 is not claimed by anyone. These tasks are also nice to have included in the first Alpha version:
In the mean time, I've been working on the API. Currently, it's possible to modify existing Civilizations and leaders, including the leader graphics. As a sample, I've created a plugin that replaces the Zulus/Shaka with the Japanese/Tokugawa. A bit out of my comfort zone (I'm not very good with graphics) but I've managed to modify the SNES leader graphics to sort of fit with CivDOS:

KgEKkAv.gif


Edit: I have updated the CivOne-Plugins repository on GitHub (https://github.com/SWY1985/CivOne-Plugins) to include the following sample plugins:
  • Cleopatra leader (replaces Ramesses) (C#)
  • Japanese Civilization/Leader (replaces Zulus/Shaka) (C#)
  • Warrior unit (replaces Militia unit) (C#)
  • Swap Civilizations (swaps Chinese and Roman civilizations) (F#)
The NuGet package has been updated as well:
I still need to update the API documentation, and I want to provide one more F# and two VB.NET sample plugins.
I'll try posting a new CivOne build on the website later today, but I need to have dinner first. :)
 
Last edited:
CivOne pre-alpha.1-r1417 is now available on the website. Here's the list of changes since the previous version (r1365):
  • Implemented SDL audio support
  • Implemented API functions:
    • Unit modification (unit name, attack/defense/movement points, unit graphics, required/obsolete techs)
    • Leader modification (leader name and graphics)
    • Civilization modification (civilization name, starting position, leader, city names)
  • Implemented General Principals messages
  • Implemented leader personality traits
  • Enabled CivWin audio files support in the SDL runtime
  • Added Setup screen menus:
    • Game Options (allows players to override default game options)
    • Plugins (allows players to enable/disable plugins)
  • Fixed: Distance to tile calculation (thanks @PeppiKokkiSC2)
  • Fixed: City resources resetting (thanks @hospital)
  • Fixed: Loading plugins written in F#
This may seem like a short list, but a lot of work has gone into these changes. The API has been updated, and I have made the following plugins available for download on the website:
  • Better Menus (improves ingame menu items)
  • Japanese Civilization (replaces the Zulu civilization, just like in the SNES version of Civilization)
  • Swap Civilizations (swaps the Chinese and Roman civilizations)
Plugins can be downloaded here: https://www.civone.org/Plugins
To install the plugins, extract the .zip files and copy the .dll files to the CivOne plugins folder.
 
Ok about the respawn. I will leave it for now.

I have a PR for taking an advance when capturing a city.

I will have a go at future techs next.
 
Thanks @hospital, I've merged your PR. Great job! :goodjob:

I've created a new preview version (r1436), here's the changelog since version r1417:
  • Implemented Advance selection dialog when capturing a city (thanks @hospital)
  • Improved startup screen queueing
  • Improved 16 colour palette for custom leader graphics
  • Removed screen delay due to fade in/fade out in 16 colour mode
  • Copying Civilization data files no longer requires the game to restart
  • Moved data folders (capture, data, plugins, saves and sounds) to AppData*
  • Settings are now stored in .profile files
  • Added support for multiple settings profiles
    • Each profile can enable/disable plugins seperately
    • To create a new profile, start CivOne with: CivOne.SDL --setup --profile <profilename>
    • To run CivOne with the new profile, run: CivOne.SDL --profile <profilename>
  • Added options to add and delete plugins from the Setup screen
  • Fixed: The game no longer crashes when running in 16 colour mode

*If you want to access your CivOne files, under Windows, type "%LocalAppData%\CivOne", without the quotes, in your explorer address field or in the Run dialog (Windows+R)

Edit: Minor update to preview version (r1440):
  • Added setting to change the Window title
  • Added option to enter the Setup screen while the game credits are shown, using SHIFT+F1
Edit 2: New build to fix some annoying bugs (r1449):
  • Fixed: The game no longer crashes when trying to change the Window title
  • Fixed: The game no longer crashes when switching from 16 colour mode to 256 colour mode
 
Last edited:
@Mallagan
Thank you. I don't think Mono/C# has been ported to Amiga, so that would make it really hard to create a port.

---

I have created a new preview version (r1452) because there were two breaking issues in the previous preview version. Here's the changelog:
  • Fixed: Game was unresponsive after loading a game
  • Fixed: In-game input fields were empty
 
@SWY
I'm really not good with how C/C++/C# works, but could source codes from one language be translated to another?
 
Back
Top Bottom