PDA

View Full Version : Algorithms for simulations (e.g. Sim City, Civilization, Railroad Tycoon)




Pikemann Urge
Dec 31, 2008, 10:09 PM
One project I have in mind is to write a simulation game. This is long-term. A lot of work will obviously have to go into audio, images etc. But my fundamental interest is in the algorithms to match the variables: how does one select them and how does one know which to choose?

Let's say you want to do a game about a soccer league (such as Premier Manager (http://en.wikipedia.org/wiki/Premier_Manager)). Well the variables are obvious: players, support base, number of matches per year, costs, venues, random events etc. Now how on earth would you find suitable algorithms? And how would you determine how many are appropriate (if you didn't need to use them all)?

If anyone knows of any source code for such a game, let me know, even if it's in BASIC!



liptonlover
Jan 1, 2009, 12:02 AM
I don't have any specific algorithms, but I've made plenty myself, including ones for the game I'm working on right now. Pretty much, I just find what works for my game through trial and error. When it feels right, I use it.

Pikemann Urge
Jan 1, 2009, 12:16 AM
I don't have any specific algorithms, but I've made plenty myself, including ones for the game I'm working on right now. Pretty much, I just find what works for my game through trial and error. When it feels right, I use it.
Well, I'm very impressed. But I am eager to see what process you go through to develop such algorithms. I take it that you are referring to Dystopia?

I don't mean for you to give away any of your trade secrets but anything would help. I do believe that for military simulations there are general algorithms which have been known for quite some time now but that is not the direction I'm going.

liptonlover
Jan 1, 2009, 12:22 AM
Wow someone went to my site? :cool:

I'm bad at explaining things, especially things I do without thinking. (I don't mean to brag, I've just been doing it for awhile)
I pretty much start with a list of variables that will be involved, decide on what math needs to be done, I add catches for bugs, (for instance so that clubmen can't kill tanks like in civ :P) then I tweak the hard numbers that are applied to the variables until they feel right. It means alot of changing one little number a tiny bit, rebuilding and testing, then going back to tweak it again. I usually don't have a goal in mind, I just wait until it seems like it's where it should be. Another trick I've used is to allow the user to change all those numbers themselves which can be considered a feature if done right, and the initial numbers are just rough ideas of where they may want them to be. Good luck!
Nate

hhlee
Jan 1, 2009, 10:23 PM
you could try digging around the codebase for freeciv? other than that, i'd just put together a few basic hacks together (like what liptolover detailed above) and tweak it from there.

Pikemann Urge
Jan 2, 2009, 01:49 AM
you could try digging around the codebase for freeciv? other than that, i'd just put together a few basic hacks together (like what liptolover detailed above) and tweak it from there.
I haven't heard of freeciv but thank you for mentioning it. I'll give it a look. Hopefully the algorithms have been abstracted elsewhere. I'm not proficient in reading other people's code. :o

Well liptonlover has a talent which I am not sure that I have. And I am not sure where to begin. Maybe I should just do something very, very simple and go from there.

The type of simulation game I'm thinking of probably has not been done before (the theme I mean). So that makes it even more frustrating!

hobbbz
Jan 2, 2009, 01:54 AM
In the end it doesn't matter what algorithm you use.

As long as it's working and fun enough for the end use they will never notice.

Of course testing and tweaking always helps after seeing how the user handles it.