Algorithms for simulations (e.g. Sim City, Civilization, Railroad Tycoon)

Discussion in 'iOS Programming' started by Pikemann Urge, Dec 31, 2008.

  1. Pikemann Urge macrumors 6502

    Jan 3, 2007
    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). 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!
  2. liptonlover macrumors 6502a

    Mar 13, 2008
    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.
  3. Pikemann Urge thread starter macrumors 6502

    Jan 3, 2007
    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.
  4. liptonlover macrumors 6502a

    Mar 13, 2008
    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!
  5. hhlee macrumors 6502

    May 19, 2005
    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.
  6. Pikemann Urge thread starter macrumors 6502

    Jan 3, 2007
    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. :eek:

    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!
  7. hobbbz macrumors 6502a


    Mar 8, 2005
    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.

Share This Page