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

based on the code you already know it will be possible to add a plugin that changes the rules of the science discoveries tree?
Names of discoveries, names of wonders and unit types names?

With changes to icons and images in some graphics program it would be possible to create another game based on CIV1, taking into fact that in JcivEd you can already edit the capabilities of units.
 
Last edited:
based on the code you already know it will be possible to add a plugin that changes the rules of the science discoveries tree?
Names of discoveries, names of wonders and unit types names?

With changes to icons and images in some graphics program it would be possible to create another game based on CIV1, taking into fact that in JcivEd you can already edit the capabilities of units.
It's what I have planned for a project, but it's in long term plans. Current task is to restructure code and produce the optimized and bug free code.

I think that JCivED has the capability to modify CIV.EXE also, Discovery and Wonder names are in CIV.EXE, Unit names are partly in CIV.EXE and partly in .sve files.

Yes, the idea is to have different scenarios based on addon that you select, but it's a long term plan.

Cheers
 
Hi,
I would like to update everyone on my humble ;) progress.

The @Lord_Hill (some time ago) put the bug in my ear :) about different changes within CIV1 versions 1-5 so I was curious and spotted multiple changes.
I was also battling with accuracy of my assembly to C# translation. Especially in a complex statements like:
C#:
if (((this.oGameData.Players[playerID].Continents[i].Attack + local_4e) * 2 > this.oGameData.Map.Groups[i].Size ||
    ((this.oGameData.Players[playerID].Continents[i].CityCount + local_5c) * 6) + 2 > this.oGameData.Map.Groups[i].BuildSiteCount) &&
    this.oParent.Segment_1ade.F0_1ade_22b5_PlayerHasTechnology(playerID, (int)TechnologyEnum.Mapmaking) != 0)
{
    this.oGameData.Players[playerID].Continents[i].Strategy = 5;
}
Hm, did I transcribe that if statement right, did I put all and's, or's and parenthesis right?

Then I decided that perhaps the best way would be to have code for all of the versions, so I went to work some more on my Disassembler project
I have made very good progress but the progress is slow as I have set to implement something that doesn't exist, a working dec...iler for C.
The current status is that the Disassembler correctly reconstructs Control Flow Graph and major parts of code which is a great thing. As any modern IDEs, Compilers, etc. depend on it.
The next crucial step on which I'm currently working is to recognize 'if', 'for', 'while' and 'do while' constructs. And, then to correctly propagate var types.

In the field of decompilation there have been some great advances, but no one attempted 16 bit (yet!)
The Decompilation Wiki and Aloha mai kākou have been of great help on the topic and introduced me to some advanced techniques.
I have also tried Ghidra, but the resulting C code is even more unreadable (to me) than the assembly code :crazyeye:.

In the meantime the OpenCiv1 project is on hold as I would like to be able to compare codes for accuracy, and that depends on Disassembler project.
Also, I would like to implement CIV1 version 1 engine as well as version 3 and 5 game engines eventually.
The difference is introduction of some new concepts between versions 1 and 3 (very unhappy citizens etc.), and between version 3 and 5 the AI engine.

Please bear with me as I make this journey ;)

I reread the old CivOne thread with @SWY. I'm sorry that in the end he decided to abandon the project. He often changed libs and rendering engines which took most of his time and in the end he was spent with constant modifications of the existing code. I would like to avoid that.

That is why I decided to retrace my step to the original before I make next major translations and optimizations in the game engine.

I hope that you are not disappointed with the speed at which this is progressing, since, at first everything seemed to be really fast pacing... :(

Cheers
 
Last edited:
This is amazing! The only reason I came to the Civ 1 part of the forum was to find out how to update the interface to Civ 2 quality (File Menu & Saving) so that it runs in Windows smoothly.

I'll try this out.
 
This is amazing! The only reason I came to the Civ 1 part of the forum was to find out how to update the interface to Civ 2 quality (File Menu & Saving) so that it runs in Windows smoothly.

I'll try this out.
Al trough the game is fully functional, it still has many inherited and introduced bugs. I'm currently working on a new version but it still has a way to go... ;)
 
hello there. thanks @rahorvat for your job.
is it supposed to be like that?
btw game feels slow, is it my PC or something else?

1757013875158.png
 
received error under democracy after discovering invention.

Does log files supposed to be 100-200MEGABYTES?!
log files attached archived.
save files attached(i do not which one exactly, 1330AD should be closest one since i did not save frequently.



1757017470839.png


1757017382263.png
 

Attachments

Last edited:
hello there. thanks @rahorvat for your job.
is it supposed to be like that?
btw game feels slow, is it my PC or something else?
I have tested on multiple newer platforms on 2015 or newer CPUs. Older game releases write extensively to the log.
Better performance would be if you build the game from the actual Master repository, as opposed to a latest release.
The Current Master version is much faster.

I'm currently doing some other things, and can't find enough time for OpenCiv1. But I haven't forgotten it. The development will continue as soon as I'm able.
 
Last edited:
received error under democracy after discovering invention.

Does log files supposed to be 100-200MEGABYTES?!
log files attached archived.
save files attached(i do not which one exactly, 1330AD should be closest one since i did not save frequently.

In the latest release version, Yes. The better place for this bug report would be on the GitHub https://github.com/rajko-horvat/OpenCiv1
since I'm currently not working actively on the project. I will create a issue on GitHub for you and attach log and save game files there for later analysis.

Thanks for trying it. The project has a lot of potential and I will continue it as soon as I'm able.
 
I'm currently doing some other things, and can't find enough time for OpenCiv1. But I haven't forgotten it. The development will continue as soon as I'm able.
I sincerely hope for it to be the case, because I really-really want a C# version of Civ1 that can run without DOSBox, but I'm pretty wary considering the amount of promising projects I've seen die with such words.
 
If you stop working on the project for long time, you will never go back on it. So much exemples like this !

😭
 
If you stop working on the project for long time, you will never go back on it. So much exemples like this !

😭
Not by my experience. Often you get a fresh perspective on things when you rest a little from a project.

I was going to say that nobody contributed to this project, so nobody get's to criticize project progress (or a lack of it), but a few weeks back some russian guy contributed some small code upgrades. We'll see.

Almost a year back I started working on Disassembler again in hope to produce more meaningful code to ease translating job, but it took me so much time and concentration. Decompilation is not an easy thing ;)
And although Disassembler now gives much better code I defaulted back to translating certain parts of code by hand to compare them to different Civ versions because I wanted to see and compare the changes and algorithms between v.1, v.3, v.4 and v.5

The main thing that bothers me is, if I translate complex If statements wrong the game section will be affected by it. It would be so much easier to be able to upgrade Disassembler to do this automatically for me. But due to complexities of decompilation for now I put this on stop and decided to invest my time in translating things by hand. And fixing them later after/if we encounter a problem.

Also the problem was that I saw a bunch of opportunities to upgrade the code. So I took some of them and diverted significantly from original code base. Now I decided to stay in the lines of old code until I finish main code base and hold all improvements for a new version.

Cheers
 
I was going to say that nobody contributed to this project, so nobody get's to criticize project progress (or a lack of it), but a few weeks back some russian guy contributed some small code upgrades. We'll see.
Being worried that the project might end up being abandonned is not really about criticizing and more about showing interest. People wouldn't be worried if they didn't care !

I'd happily contribute, but I'm a regular C# dev, anything having to do with Assembler is well beyond my abilities.
Also the problem was that I saw a bunch of opportunities to upgrade the code. So I took some of them and diverted significantly from original code base. Now I decided to stay in the lines of old code until I finish main code base and hold all improvements for a new version.
Ending up in a loop of ever-improvement of the existing code at the expense of overall progress is a very common situation ^^
 
Being worried that the project might end up being abandonned is not really about criticizing and more about showing interest. People wouldn't be worried if they didn't care !
Yes, I get that. That's why I said 'I was going...' :)
There has been a bunch of things happening. So my focus had to shift. Along what I already mentioned. That I tried to do all in one code translation (decompiling) with dissassembler. And that took a loooot of time ending in overall saturation.

I'd happily contribute, but I'm a regular C# dev, anything having to do with Assembler is well beyond my abilities.

Ending up in a loop of ever-improvement of the existing code at the expense of overall progress is a very common situation ^^
Yes, I guess it is. But when you have the complete code that's not such a problem (as long as it all continues to work).
But I have not yet translated all the way problem :( And that can complicate things fast.

I will try to give some time to a project during a weekend, and the next week. But since All Saints day is approaching, I have other duties that I have to attend to ;)
 
Last edited:
For what it’s worth, I had too started to write my own decompiler although it was aimed at Java, which cannot emulate « goto » statements. And disassembly of CIV.EXE seems to reveal many occurrences of C-type « goto » statements (also, never reached the end of recognizing complex « if-then-else » graphs present in the CFG)
Java has a bunch of it's own decompilers. But I guess that you aim to translate 16-bit assembly to Java, and that is another kind of a problem.
I can recommend the following links that study decompilation techniques for a bunch of systems: https://mahaloz.re/ and https://decompilation.wiki/ also the discord decompilation channel that's available on decompilation.wiki

They even mention the generation of goto-less code, and that could work in your situation.

The Civ.exe has some goto specific code. But bunch of statements are linked to a 'do-while' and 'for' loops with some 'break' and 'continue' statements. So there are only a few of true goto statements.

Yes, I stuck at the same 'never reached the end of recognizing complex « if-then-else » graphs present in the CFG' problem. It's not easy, gets complicated fast, and requires a lot of concentration :)
 
Last edited:
Back
Top Bottom