Civilization1 clone project

hannurabi

Warlord
Joined
Aug 29, 2005
Messages
173
As some members have been dreaming here, I too think it is time to give CivDOS new life. So I did write a civ1 clone with python.I'm totally amateur coder, so it is just a prototype of Civ-like game engine and it sure needs 'some' optimization. There's no AI but you can try it on hotseat. I hope here are other civ1fanatics who have interest to improve this game.Aren't here??A network game and AI would be nice.:)

I have made some small changes to game and added new things.Such as borders and hitpoints. Its nowhere near finished and propably has many bugs.

Unfortunately i didn't put any comments on code but python has quite a clear syntax and I tried to use variable and function names that makes sense. Just ask me anything you don't understand.Any help to this project is :goodjob:.
 
This is actually quite nice! Unfortunately it is not CivDOS, but more a CivWIN clone... but then again, it is because I use the Windows Python environment. ;-)
I took the liberty to take a small stroll through your code. Since you said you are an amateur and since I love Civ1, I'm more than willing to check if this is at least structured code. I only have few comments:
Please shrink the main routine! It is really attractive to put everything there, but even if you would be programming a simple game as Boulderdash putting everything in the main will be too complex. If you make more files (as libraries) and more procedures, which are stand-alone (like unit movement), the game can be more easily debugged and modded. I think a lot of people even want to think with you about how to program the AI (at least I'm interested). If this is a loose module, people could build on it at the same time.
Maybe it is better to seperate game rules and GUI code fully. I always do this, so that you can plug in new rules to the GUI, or the other way round.
It could be me, but are you using enough options of object-oriented programming? I'm pretty addicted to the concept. Did you make a global design in for instance UML? In the end, this will help you with debugging and modding/coding from other users.
Sorry for my ranting -- It is just that I get enthousiastic about this kind of project. If you want me to help/check with the code; just ask. I'm not that experienced in game-programming, but I'm a professional software-engineer (at least that is what I'm educated to do :-) ).

PS: is there a distibution option in the Python environment? I can imagine that people have a hard time installing/running the game. I'm more a C++ programmer so I don't know much about Python.
 
Thanks for checking it!
Well, I called it CivDOS clone because it has CivDOS graphics.:)

Yes you are absolutely right about what you say. I was already planning to start seperating the code in modules in logical way. Maybe I should also check out the possibilities of object orienting programming. I'm just doing this for my own amusement every now and then.So it's progressing slowly, but let's see what I'm
capable of do.
 
You're welcome. :)

If you want help or anything just ask me (not only coding but also information about splitting code or object oriented programming).
I'm very enthousiastic about the project, because I was thinking about programming a civ-like strategy-game myself. Since I think certain aspects of certain games would make a nice combination. Civ is of course the core structure of the game, but I would like a better economical system and making armies harder to maintain for instance.
I hope you will have time to work on it once in a while.
Good luck!:goodjob:
 
It's a challenge to get a DOS version of Civ to run on an NT based OS (Windows NT, 2000, XP, and Vista) where as it is easy to do in a DOS based windows such as the Windows 9x series (Windows 95, 98 (incl. 98SE), and Me).

Seeing that this is on a python code, this program would be more appropriate for the recent Windows.
 
No, it has nothing to do with DOS actually. It should run on any platform that has Python and Pygame package anyway. I was only meaning that it has terrain graphics of original DOS version of Civilization (which are far superior to CivWin).
I have added trade routes and terrainbonuses and fixed few things. Next I'll start organize code's structure more clever way and rewrite some (or many) parts of the code. I'll post new version when there's something more ready.
 
Hi, great work hannurabi shame I cant get it to work heheheh anyways I'm running Vista Ultimate x64 and Python installed fine both packaged.
I must be doing something wrong could someone tell me how you start/launch the game? :confused:
 
The installation:
After you installed Python 2.4.4 (2.5.1. is out, but pygame doesn't support it!), you should install pygame. You should also unpack the game somewhere. ;-)

To run:
Run IDLE (Python GUI) and choose "File...-> Open..." and select the file "grafjumi.py". This opens a new window with the code. Now press "F5" and the game starts running. Note that in the console a question is being asked, after this it will start the actual game. Have fun!

To Hannurabi:
Cool! You really expanded it a lot! Every time you got new major changes, would you mind posting something here? I was already wondering if you ever updated it and I'm glad you did!
Is there already an AI implemented? (I don't have time now to look through the code or play the game thoroughly.)
 
A ok thanx for the info I ran with the latest version of course "2.5.1" , will give it a try when I get home :D

Edit:

Looks promissing how ever seams to need some more work :( shame I dont know any programing or I would glady help out :( o well great work anyways cant wait to see the final resault
 
I uploaded the current version now.The code is being improved and organised, the game isn't.
@ Comrade Aart:
If you have any ideas/experience/knowledge about programming AI feel free to email me or post here.
I'm also very interested to hear what kind of gameplay ideas you (or anyone) have.
 
@ Comrade Aart:
If you have any ideas/experience/knowledge about programming AI feel free to email me or post here.
I'm also very interested to hear what kind of gameplay ideas you (or anyone) have.

I'm flattered you're asking me about it. :)

I do have more or less experience in programming AI. It is mostly theoretical knowledge, but I also an ant simulation once (just like the game SimAnt) with the anthills competing over food and trying to kill one another.

First, you have to determine what your AI needs to do; what goal it has. Some examples:
- Winning by conquest;
- Winning the space race;
- Develop itself and when encountering civs attack them;
- Destroy the human player;
- etc,etc.
You can assign different kinds of AIs to your enemies. You can also make them dynamic. For example:
The Indians are peacefully initially. Suddenly the Mongols and Greeks come bashing Gandhi. Gandhi changes his mind and when he defends himself successfully he lays behind in tech and tries to take over the world.

To make AIs behave differently not only the goal should be set, but also some attributes (which can also change over time of course). You could take the original attributes, list here:
http://www.civfanatics.com/civ1/cia/allcivs.htm

How the AI moves its units is something you don't have to think of yet. How it thinks, is more important now. Movement and such are made by simple algorithms (like Dijkstra's shortest path algorithm, which is easy to implement).

Also think of how intelligent your AI should be. Most "agents" should not be clairvoyant. If you want your AI to act like a human player, it should know equally as much (maybe more at higher difficulty levels). You can for instance force the AI to explore the map as well. Also make measurable points that can test how efficient your AI is, like "explored tiles" or "#units".

I haven't looked at your code yet and I don't know when I have time to do so. At the moment I'm graduating and I have spent a lot of production time on my girlfriend instead of on my masters project. ;)
If you have direct questions though, you know where to find me. :)

Good luck!
 
Back
Top Bottom