OpenCiv1 Project - Open source rewrite of the original Civilization 1 Game designed by Sid Meier and Bruce Shelley in year 1991

I also did a couple of reddit posts just let folks know. Frankly at this point with all the assembly work it will be hard to get anyone to help you, but you know your stuff and I see you're slowly getting there... I find it fascinating you're actually emulating a 16 bit processor and VGA card and actually running the game just fine. It's like one of those factorio projects where people make an orchestra out of conveyor belts.
 
this is really impressive...
Please remember to put some option or tool for easy translation into other languages.
 
Ahh wonderful! If it's at a playable stage and there's pictures etc then that should give us what we need to do some posts and share around ( @The_J this is getting pretty far now). Any plans for a compiled WIP version for us 'common folk' to check out? That would make it even more shareable to the masses.
I was thinking... after I work a few bugs out maybe I should make a prelease version (in a week or so) for you guys to start to drool a little 😉 🤤

Cheers
 
I was thinking... after I work a few bugs out maybe I should make a prelease version (in a week or so) for you guys to start to drool a little 😉 🤤

Cheers
That would be awesome mate, as a 'pre-release/WIP/alpha/demo/whatever you wanna call it' for regular people to look at makes your project muuuuuuch more shareable. Which then increases the chances of more programmers out there seeing it too and possible recruitment opportunities if you're looking for helpers. If you put in some disclaimers on the release page or maybe even in the game itself when it starts up about this being an early alpha buggy unfinished proof of concept release that should take care of an misunderstanding with over excited players testing it out. :)
 
this is really impressive...
Please remember to put some option or tool for easy translation into other languages.
I guess you asked for an option to translate game into other languages beside basic English.
Yes, that is a "MUST" and is a planned feature.
 
Last edited:
Hello. I registered just because of this thread. :-)

As it's proven to be difficult to re-create source code from the original DOS game,
what about (instead) mapping out the game logic functions and how they flow? Do such "functional blueprints" exist?

Rephrased: A visual blueprint of game functions, arguments and types.. which functions call what, and which data, would be a great resource for anyone looking to learn how the game worked under the hood... OR for anyone looking to re-impliment it all in a fresh codebase.


Backstory: I remember figuring out that saving your game was not always a great way to cheat, or steer the game. Unit battles were not simply decided like ((player1 vs player2) * chance)), there was like this overlay of "good luck or bad luck" that seemed to ebb and flow over turns. That felt like a leap when compared to older implementations of Risk, or DOS Empire.
 
Hi linux_monkey,

Hello. I registered just because of this thread. :)

As it's proven to be difficult to re-create source code from the original DOS game,
what about (instead) mapping out the game logic functions and how they flow? Do such "functional blueprints" exist?
Well, not exactly, I have game working just fine in C# VM I created. The problem (code) is more complex than I first imagined.
The Decompiler I created for the game contains some high level translations I never finished because of:
* Code is constantly augmented by direct assembly that was inserted at places the original programmers felt appropriate to speed up the game. Even whole functions were written in direct assembly!
* You have Segment:Offset problem in translating 'virtual' addresses to absolute ones (that's why there are virtually no decompilers for 16-bit code).
* The compiler did optimizations which are difficult to directly translate to code.

The part of the code logic has been mapped, especially regarding save game data .sve and .map files. That's where JCivEd shines. But going throughout the code I found some mistakes that will be documented when I finish replacing save game data memory references to direct object references. Also, I mapped the format and logic behind the .cvl overlay (driver) files and documented them.

Rephrased: A visual blueprint of game functions, arguments and types.. which functions call what, and which data, would be a great resource for anyone looking to learn how the game worked under the hood... OR for anyone looking to re-impliment it all in a fresh codebase.
Yes, that is what I'm doing (you can play with the code History on the GitHub page and see what I'm doing). I'm slowly mapping the code, variables, arrays, structures etc. So I end up with clean codebase. If you look at the GitHub page, I set that as First milestone.
It's apparent to me, as I slowly replace save data variables, there is a lot of places to improve upon the code, to lift up city number restrictions, map size, current bugs, etc. and that is the Second milestone.

Backstory: I remember figuring out that saving your game was not always a great way to cheat, or steer the game. Unit battles were not simply decided like ((player1 vs player2) * chance)), there was like this overlay of "good luck or bad luck" that seemed to ebb and flow over turns. That felt like a leap when compared to older implementations of Risk, or DOS Empire.
Regarding this, there is number of ways that you can make progress or regress in a game. The random number generator seed at offset 6 (ushort) in .sve file (see https://forums.civfanatics.com/threads/sve-file-format.493581/), the AI players defense/attack policy regarding certain continent, also technology discovery, city development etc. all come together in a game to dictate your progress.

That's why Civilization is one of the most popular games of all times, at first glance everything seems simple, yet there is much more under the hood that meets the eye ;)
 
Remember it's a lot of extra work to cleanly document assembly even after disassembling it, we can't put too much on poor old @rahorvat 's shoulders!
He, he ;)
I don't feel a day older than 30 😎

I don't mind the work. It's not that much difficult when you get a sense of it all 😀

By the way, I never received any feedback from any of you on an Alpha prerelease version, what's with that? :crazyeye:
 
Last edited:
Thanks! Very helpful and insightful.

So I had seen the name JCivEd before, but I had not looked into it much (thinking it was an editor, which I didn't need, but it's actually so much more I see)).
JCivEd has a lot more, including hosting a reference tome of how the logic works,
and indexes to other investigations (for example: Bribery rules, linked to their documentation in this forum). Very nice.

I think the wiki links to everything I wanted, cheers. :-D
I only asked about a visual map of functions, because I had not known a higher-level writeup of features (bribery, etc) existed.

I'm not a fast (practiced) enough coder to re-impliment anything more than a simple text game.
(I'm basically learning some GoLang and Rust, starting with EbitEngine, etc.)

But I can pursue making standalone functions out of the Bribery thread, for example. Thanks everyone for documenting stuff!
 
Last edited:
@rahorvat indeed I need to give it a proper run. It did seem a bit sluggish when I last gave it a quick try but that might have been before the latest version so I'll try again.
 
@rahorvat indeed I need to give it a proper run. It did seem a bit sluggish when I last gave it a quick try but that might have been before the latest version so I'll try again.
It is more sluggish than in DosBox, but it will certainly get faster and faster as I do my magic 😉 and translate more assembly to code.
 
Yeah I get that it's an early alpha and performance comes later. The fade in / fade out effect is very juddery as well, and for some odd reason, I've got ? characters showing up in the middle of the menu names.

When the units move diagonally, they appear to move a little bit in the wrong direction first before moving where you'd expect. The city name seems to randomly disappear, I haven't pinned down exactly when that happens.

I realise a lot of this stuff is obvious but I'm just pointing out what I see. All the screens appear to be present and look as they should, it's great to see them running as a true windows program.

I'll keep posting updates as I play, I have a single city and am exploring with my militia at the moment (the english have already been defeated as a defenceless London was right on my doorstep)

1695741332067.png
 
It might be worth having a look at how the city layouts are randomised, I don't remember seeing all the huts in a straight line like that in the DOS version. Would need to check though!
1695742585422.png


EDIT - Yep, no matter how many improvements you add, every building is in that first row instead of (presumably randomly) being built in a different row.
 
Last edited:
Current progress is that I've got Rome with barracks/granary and churning out chariots. Interestingly so far I haven't encountered a single AI Civ that has built a second city, but that could just be how comically easy things are at chieftan difficulty!

EDIT - ok saving at 1900BC having defeated the pinks, greens and yellows with my chariots. Can confirm autosave happened when it should and I was able to save manually. I'll resume on another day!
 
Last edited:
Yeah I get that it's an early alpha and performance comes later. The fade in / fade out effect is very juddery as well, and for some odd reason, I've got ? characters showing up in the middle of the menu names.

When the units move diagonally, they appear to move a little bit in the wrong direction first before moving where you'd expect. The city name seems to randomly disappear, I haven't pinned down exactly when that happens.

I realise a lot of this stuff is obvious but I'm just pointing out what I see. All the screens appear to be present and look as they should, it's great to see them running as a true windows program.

I'll keep posting updates as I play, I have a single city and am exploring with my militia at the moment (the english have already been defeated as a defenceless London was right on my doorstep)

Palace improvement screen looks a bit funky!

It might be worth having a look at how the city layouts are randomised, I don't remember seeing all the huts in a straight line like that in the DOS version. Would need to check though!


EDIT - Yep, no matter how many improvements you add, every building is in that first row instead of (presumably randomly) being built in a different row.

The question mark is a mark for bold font, which I didn't implement.
Yes, there are a few animation and graphic things, also, I think that city layout needs some attention, but this will be resolved as I progress with the code.
The gameplay is important, the subtle things like that unit did something wrong, or city logic doesn't work well, or tech is not giving me units it should like that, that is what interests me.

Thanks for your info!
 
It might be worth having a look at how the city layouts are randomised, I don't remember seeing all the huts in a straight line like that in the DOS version. Would need to check though!


EDIT - Yep, no matter how many improvements you add, every building is in that first row instead of (presumably randomly) being built in a different row.
You can load game and view city layout in DosBox also 😀
 
Understood. I'll focus more on logic and less on graphics. Seems all good so far. Got chariots after the wheel, and they moved 2 tiles on good land and 1 tile on bad land as they should.
 
Back
Top Bottom