CivOne - An Open Source remake of Civilization 1

Hi SittinDown. I'm glad you like the code. Please, feel free to contribute your code to GitHub.

I'd like to apologize to everyone waiting for a new version... I hope I'm going to get another development frenzy again soon. It comes in bursts and I'm just stuck at the moment.

Thanks for all the support!
 
cool - pr submitted. (Sorry for the extra commits, had to merge over from my commit prior to syncing with github, and I made a few mistakes until I got my env setup again).
 
Your code has been merged. I made one small correction: In the City.cs file, I've changed a var to the strong type. I prefer to keep the code free of the var keyword. :)
Otherwise, good code, thank you for the contribution. Please, feel free to continue tinkering and building. It feels good to get some help on the coding side.

As a celebration of the first code contribution from another developer, I have implemented the Colossus drawing code in the city view. (pyramids and great wall were already implemented) I plan on adding the drawing code for all fixed buildings soon. (Hoover Dam, Aquaducts, City Walls, Mass Transit, etc)

Now, as for a release plan. There's currently 22 open issues for version 0.1.0. I need to fix all of them before release, but my main focus for now is implementing unit combat and the end game by conquest.
I really also want to implement saving games, but that's a bit more difficult.

I have planned some time to work on the code this week.
Later this week, let's say friday, I will post a new version for Windows, Linux and macOS.
 
I'm back with some news and a new version.
Please read this first, because it is important:

I've been working on getting CivOne to work on .NET Core. The reason for that is simple: Multi platform, so eventually it would be easier to port the game to Android, iOS and Windows Mobile.
The other reason is less simple: The (drawing) performance of the game has been bugging me and I couldn't get it to work any faster. I decided that I needed either SDL or OpenGL to get it to run better. Fortunately, OpenTK (an OpenGL wrapper for .NET) is now working on .NET Core. Besides speed, OpenTK offers another big advantage, and I probably should've used it from the start: It works on Windows, Mac and Linux.
Another nice coincidence is that OpenGL works with Steam, so the game should work with Steam Link.

Now, I've branched the current version on GitHub to [mono] and I will probably not be updating that version in the future. That means from now on, there's no more support for Windows XP and Windows Vista.
I'm currently working in the [netcore] branch. Once it works as well as (better than) the mono version, I will merge the branch back into [master] and continue from there.

Here's a list of known issues (I will add these to GitHub later and solve them one by one):
  • The file browse dialog has not been implemented, you need to manually copy the data files to the ~/data folder
  • The game window is stuck at Scale x2
  • The Windows mouse cursor is visible over the game mouse
  • Full screen has not been implemented
  • Some Keyboard keys don't work (keypad enter, plus minus, shift, ctrl, alt)
  • Plugins don't work anymore
  • Saving screenshots doesn't work
For a list of other known issues and unimplemented features, please have a look at the issue list here: https://github.com/SWY1985/CivOne/issues

Here's a changelog since the last version:
  • Game no longer crashes when loading games
  • Random predictability is now more random
  • Load game features implemented: Visible tiles, civilization advances, player governments, city resource tiles, city improvements, city food/shield storage, unit home city, unit status, tax/science/luxury rate
  • Fixed palace maintenance costs
  • Implemented software cursors
  • Draw Great Wall, Pyramids, Colossus wonders in city view
  • Use correct Communist portraits
  • Colossus effects implemented (implemented by SittinDown)
  • The game now uses OpenGL for rendering, which should fix a lot of speed issues
Now, to business. Here are the downloads for Windows. Mac and Linux versions will follow when they're ready:
  • Download links removed, new version below...
Ninja edit:
Please, let me know how the game runs for you. Does it work, are you having problems? Is it fast(er) or slow?
 
Last edited:
Glad you're back! :cool: Runs smooth so far. Got my first freeze. I'll just post issues on Github.

UPDATE: Played through to modern times. No lags, runs super smooth!
 
Last edited:
Thanks for testing, I've already made a ton of improvements, including scaling the window. I will try to post another build later this week.

Edit: I have merged the [netcore] branch back into the [master] branch and I have locked the [mono] branch. The [mono] branch will no longer be maintained.
 
Last edited:
It was really nice to get an github issue closed email! I came straight over to see what was cooking! I'm really glad youve managed to find some time for CivOne swy and I'll be glad to carry on helping any way I can!

I've been teaching myself c# lately and have written a windows app trading game a la dope wars, but don't think I yet have the skill to help with coding for CivOne, much as I would love to. Plus I need the syntax tips from the full ide at the moment =p

Bug testing and moral support though, I'm here!!
 
@DracoNoir
Bug testing and moral support is perfect, thank you. :goodjob:

I've made a lot of changes since yesterday, so I made a new version.
Here's what's been fixed since yesterday:
  • Fixed most (I think all) keyboard keys
  • Hide the OS cursor when it's inside the game window
  • Fixed spelling error of the word Aqueduct
  • Further optimized drawing speed
  • Enabled window resizing/scaling
  • Enabled full screen (alt+enter to toggle)
  • Fixed the road/forest bug
  • Fixed the archaeology screen when you lose (disband) all units and cities
Known issues:
  • The file browse dialog has not been implemented, you need to manually copy the data files to the ~/data folder
  • Plugins don't work anymore
  • Saving screenshots doesn't work
  • Not all settings are loaded

Download here, and please report any bugs you might find:
  • Download links removed, new version below...
 
Last edited:
I have added an Aspect Ratio setting which allows you to scale the contents according to your wishes: http://imgur.com/a/lugJW
There will be four options available in the next version. The fifth options (expand) will be made available at a later time, if I don't run into too many problems:
I intend to make certain screens in the game expand to the full window, allowing the screens to be used in resolutions higher than 320x200 pixels. More on the later.

Edit:
I've got the expand option working, but for now only on the setup screen: http://imgur.com/a/bnpdH

Edit 2:
I've implemented the expand option for the gameplay screen: http://imgur.com/a/JVp7G
It's still buggy, but I'm really happy with the results so far. I will try to post a new version today so you can try it for yourself.

Edit3:
Here's the list of changes since the last update (yesterday):
  • Fixed crash when window is minimized
  • Fixed bug where the game hides the mouse cursor even when the games doesn't have focus
  • The game now uses the settings for Full Screen and Window Scale
  • Select Quit actually quits the game
  • Added Aspect Ratio settings
  • Added experimental Expand support for setup and gameplay screens
Download here, and please report any bugs you might find:
  • Download links removed, new version below...
 
Last edited:
Nice! Downloading now and I'll be on it tomorrow evening =]

EDIT: Couldn't resist firing it up now =]

Running fast, but nice. Although very dependent on what else I'm doing on my system. Seems to run extra fast for a little while after an improvement is built.

Also, tax/science is set to 50/50, but I have a skew towards tax in the window of my (only) city. I have marketplace and library, but selling either does not affect. Normal or bug??

Advance bulb disappears after last tech discovered but i suppose thats to stop the future tech crashes atm?
 
Last edited:
@DracoNoir
Thanks for testing.

Running fast, but nice. Although very dependent on what else I'm doing on my system. Seems to run extra fast for a little while after an improvement is built.

That could be an minor issue in the gameplay screen. Can you try whether it also runs faster if you just open a city and close it again?

Also, tax/science is set to 50/50, but I have a skew towards tax in the window of my (only) city. I have marketplace and library, but selling either does not affect. Normal or bug??
Not sure about that one... I thought I had it working correctly but I need to review the tax/science mechanism. I know that if there's 3 resources to divide, the game chooses to prioritize tax, resulting in 2 tax resources and 1 science resource.

Advance bulb disappears after last tech discovered but i suppose thats to stop the future tech crashes atm?

Future techs have not yet been implemented, but that's not too difficult. I will create an item on Github for that to make sure I won't forget it.

---

Can I ask what the specs of your computer are? And are you running the 64-bit or the 32-bit version?

Edit:
There won't be a new version today, but I have made progress: I have implemented a new LZW encoder (eventually useful for savegames) and as a test I have implemented saving screenshots to GIF files.
.NET Core doesn't have any graphics functions, and while I could have used a standard, I thought it was a good chance to learn how .GIF files work.

My implementation is still a bit buggy with more complex images, here's a sample: http://imgur.com/a/lylah

Once the LZW encoder works and the GIF files look good, I will start working on getting Save games working.

Edit 2:
The LZW encoder now works flawlessly. I'm going to try and get save games working. :D

Edit 3:
A lot of commits today, but no visible progress. Still working on LZW/RLE stuff. I'm going to have save games working by the end of the weekend and I will have some other issues solved as well. I hope to post a new version on Sunday.
In the mean time, please keep trying the latest build. :)

Edit 4:
All building blocks needed for implementing save games are ready, I'm currently writing the code that actually saves the game. Good stuff.

Edit 5:
CivOne can now generate save game files, but I may have made several mistakes. There won't be a new build today, I've been at my computer for too long and I'm going to turn it off for the rest of the day. New build soon though... with working save games, once I've got the bugs fixed.
 
Last edited:
New post, the previous one is getting a bit long.

CivOne can now generate valid save files. I even tried loading them into the original game and it kind of works. A lot of things are still missing or not working properly (especially with the original game) but CivOne is able to load its own save games with most of the game details slightly intact.
There's a lot of work to be done to get the save files compatible with the original game (the ultimate goal, obviously).

I will attempt to close several other issues before posting a new version, hopefully later today. :D

Edit:
Here's the list of changes since the last version (787):
  • Complete rewritten RLE and LZW encoders and decoders
  • (Re-)Implemented saving screenshots, changed screenshot format from PNG to GIF
  • Added a small delay at the end of each turn
  • Changed maximum Expand virtual resolution to 512x384
  • Initial implementation of Save Game functionality
  • (Re-)implemented mouse drag code
  • Implemented colour cycling in City View
  • Implemented drawing Aqueduct in City View
  • Implemented drawing citizens in City View
  • Fixed: End turn when Sentrying a unit
  • Fixed: Quit game on Game Over or menu select
  • Fixed: Player received build notifications for enemy cities
  • Fixed: Right mouse click on menu items
Download here, please report any bugs you might find. Please ignore any issues related to save games, I am aware of them:
  • Download links removed, new version below..
 
Last edited:
So, implementing savegame is a huge step forward, it will also enable better bug search so :hatsoff: if you can do it. I fire up old CIV1 every now and then to compare stuff and the bugs are certainly getting harder to find.
Also played a bit with the setup menu, works ok, I like the 16-bit option retro look, the amount of options you worked on is quite something.
I imagine drawing buildings, roads and such in the cityview will be quite a task. If there is a need for some manual labor other than bug searching let me know, my skills with c# are limited but anything else I could help. I'll try to study some of the mechanics of the original if nothing else.
Also :thanx: for all the hard work.
 
Thanks for testing. It helps a lot. :goodjob:
Save games are actually pretty much working, there's just some bugs in it... and some parts are missing. :think:
I plan to expand the Setup screen with all kinds of patches, cheats and modding support. I might eventually make it available in game too.

There's not a lot I can think of that's not coding related, except for analysing the original game and figuring out how things appear to work.
Here's a couple of things that need some research, and it would be a great help if you (or anyone) can figure it out:
  • With which Civ advances do the regular buildings change in the city view (from tents and clay houses to wooden houses, to stone houses, to skyscrapers)
  • How is the price for incite revolt decided?
  • With which advance does the discovery text change from "wise men" to "scientists"?
  • What are the conditions for the treasury is running empty message to appear?
  • ...anything you can think of that has not been implemented or that is implemented incorrectly at the moment
I will post a new version later this week right now. Here's the list of changes since the last build:
  • Implemented expanded view for the game intro
  • Improved delay at the end of the turn
  • Initial implementation of Barbarian AI attack code (buggy)
  • Initial Auto Save functionality (buggy)
  • City view: Initial show regular buildings (emulated behaviour, not the same as the original game)
  • Added new hardcoded bitmap font as fallback, in case FONTS.CV is not found (start of a greater task to eventually make the game playable without the original data files)
  • Make the game start without data files
  • Added warning/instructions when the data files are missing
  • Fixed: Barbarian land units no longer spawn on ocean tiles
  • Fixed: Finish unit task before activating a new unit (this fixes several things, including the Tribal Hut message bug)
Known issues:
  • Save games are buggy
  • Autosave crashes the game sometimes
  • The game can crash when Barbarian units attack
  • If this version is too unstable, please use the older build in the post above
Download here, please report any bugs you might find:
  • Download links removed, new version below...
 
Last edited:
Good to know that such progress is being made, even in bursts! Congrats for your effort!

I think the wise man -> scientist change happens after Navigation. Navigation unlocks a lot of things.
But more certain, Invention makes the advisors change to modern ones, so that might be the point.

Houses:

might be:
- Pottery (clay houses)
- Masonry (stone houses)
or Construction unlocks the stone houses

Automobile changes the roads and some buildings. I think Electricity brings modern buildings such as skyscrapers.
 
@Laterego Thank you! That's very useful. I will test the Wise Men thing and I will implement stone houses and modern buildings soon. :)

Today I have added a debug menu, which makes testing a lot easier. You can enable it in Setup -> Patches -> Show Debug Menu.
Here's the list of changes since yesterday:
  • City view: Draw Barracks, Granary, Temple and MarketPlace
  • Enabled patches menu, added Show Debug Menu setting and moved some items
  • Added debug menu items:
    - Set Game Year
    - Set Player Gold
    - Set Player Science
    - Set Player Advances
    - Set City Size
    - Change Human Player
    - Spawn Unit
    - Meet With King
  • Added initial King screen
  • Fixed: Allow 'minus' character in input boxes
Download here, and thank you for testing:
  • Download links removed, new version below...
Edit:
How does this look?
capture00038.png


It's not perfect, but does it give the Civilization feeling?

Edit 2:
Here's an overview of things that are/aren't rendered in the city view: https://github.com/SWY1985/CivOne/wiki/Status:-City-view-rendering
That's the status of the current source code, not the latest build.
 
Last edited:
Next version will probably be tomorrow, not today. Please test the previous version if you have the chance. I'm going to run through all issues and features and either implement them or move them to the next version. I'm now going to attempt to fix combat.
Also, side news, I've got the game running on my Windows Mobile device, and an Android version is not far off. Not ready for release yet, because touch screens are still awkward, but coming soon. I want to get the Linux and macOS versions fixed first.
New post for the next update.

Changes since last version (growing list):
  • City view: Reviewed city drawing algorithm
  • City view: Implemented car/asphalt roads when player has Automobile
  • City view: Implemented the following buildings: Library, Courthouse, Bank, Cathedral, University and Colosseum
  • Implemented Find City screen
  • Fix: Removed lightbulb debug message in Set City Size screen
 
Wow! this is amazing!

Seeing that screenshot brings back so many memories!! It is CIV, for sure!

Your idea to implement a debug menu is awesome!

My suggestion is to take this debug feature further, to extend it to a sandbox type approach, like a scenario/map editor. This way we could test all kinds of situations.
Things that you could add to the debug feature:
- add/remove tile improvement (road, railroad, mine, etc, according to the tile properties)
- add/remove pollution
- change tile (for global warming scenario)
- change unit movement points
- set/clear unit veteran status / orders
- give advances or gold to an AI player
- change ownership of an unit (give/take to/from AI)
- change govt (for player or AI)
- hurry/clear production for player or AI
- edit the buildings from any city

I know this is not part of the original game, but maybe for a mod or extra feature after the game is cloned, it would be great to manually edit the city layout. Like add roads, move buildings, etc
 
For a future version I am planning to add a map/scenario editor that should also be compatible with the original game, but don't get mad if I steal some of your ideas and add them to the debug menu. I just added things that makes testing the current state of the game a lot easier for everyone.

As for the city view layout: It's randomly generated using a random seed derived from the city name, see here: https://forums.civfanatics.com/threads/civ1-exploit-design-flaw-in-randomness.509679/
The current save format doesn't allow anything else for the city overview, but when mods become available and larger map sizes have been implemented we will need to reinvent the save file format. I think a mod that allows you to remodel the city might become possible then.
 
Back
Top Bottom