1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Rep Power

    What software for a simulation game?


    I'm new to programming as I have 1 year of "experience" and python is just a hobby for me. So far the only significant thing I've programmed is a tkinter chess game with a rather simple AI.

    I'm looking to develop a simulation game and I've been wondering which piece of software would be best suited for this. It would be a 2D game that simulates a simple ecosystem. So there would be different kinds of animals, some herbivores and some carnivores, interacting with each other and controlled by independent AIs. Because the predators would kill some of the herbivores there would also have to be reproduction. If I managed to do this I could add for example a day and night cycle and the possibility to click on an animal to see how it's doing (if it's healthy etc..).
    In fact it's not much of a game but mostly pure simulation.

    I've been researching the subject for some time now and I'm considering to do this with either Pygame, Pyglet or python-ogre but I'm mostly leaning towards pygame as it appears to be the most simple.
    But I know there is a lot of different software out there so perhaps I'm completely wrong in assuming this.
    I wouldn't like to find out mid-development that the software I chose isn't really adapted for this kind of program so I'm hoping that some of you have more experience with game development and could give me some advice.

    Thanks in advance
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Rep Power
    The enthought python distribution includes numpy which has methods for solving differential equations. There are some books about numpy and scipy, Packt Publishing published a few. The online documentation for numpy/scipy has good quality and there's a lot of it with examples. scipy has extensive graphics with which I'm not so familiar because i've typically written data files then graphed as a separate step with gnuplot.

    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Usually Japan when not on contract
    Rep Power
    You don't need any special software for the animal interactions part. You just need to decide in detail the rules of their interactions and behaviors, and write those rules into the data structure that defines each type of creature. Those rules will need to include things about mobility and location update so that the world engine can place them correctly.

    The project I worked on where I most enjoyed doing something similar to this was working on mob AIs for a CircleMUD derived codebase. We wrote it all in straight C, no frameworks or anything -- not because we were being Real Programmers but because the task itself is not that complex once you pin down exactly what the rules of interaction are.

    In Python the task would perhaps be easier because you could define each mob/animal type as a class that inherits common behaviors and common data structure, differentiating special behaviors and init routines. Anything about the world that exists outside the actual simulation of animals and is somewhat magical (the time of day, the weather, the granularity of the global "tic", etc.) can probably be most easily handled either as global update functions to some digest of world status or come as message clues from an omnipresent object if the scenario isn't too complex.

    If you need different local behaviors based on terrain and proximity, on the other hand, then you need to define each area as its own terrain type and this adds another layer of complexity -- interactions with animals * interactions with terrain * interactions with the world.

    The part where you will want to use an external library will really just be the graphics. Don't think about the graphics too hard just yet. The first thing you need to do is understand how you want the animals to interact, and then write a text version of them interacting so you get the hang of updating locations, dealing with the global update tic, plotting, etc. without getting your head under water too early worrying with doing actual graphics.

    I suggest letting the global tic force a respawn on mobs that have disappeared instead of implementing an actual mating behavior for the animals. It is extremely difficult to balance mating and predatory behaviors in the same simulation without also implementing a global calorie economy as a constraint on action -- and that gets complex fast (unless simulating caloric constraints in a survival economy is your goal, of course).

    The moral of the story in simulation (and most software) is that instead of letting the hoped-for-design run wild in your head, settle for the simplest thing that can possibly work early on, and then embellish later once you get something simple working. So I'd start with a "world" of 4 locations/cells/rooms in a grid: (0,0)-(1,1) and two mobs: A deer and a wolf. If the wolf wanders into the deer's grid, he eats the deer. Each update the location of both mobs is printed to the screen, and any special action taken (eating the deer, for example) also is printed.

    From there you can worry about how fast another deer shows up, etc. but once you can create a functioning scenario that is this simple expanding it to cover the things you want will be relatively painless. Adding graphics as just letters on the screen (like the ubiquitos robots game) is an easy place to start with graphics. Once you understand how to do that yourself, a 2D graphics library will be really easy to deal with.

    Comments on this post

    • Ruffle83 agrees

IMN logo majestic logo threadwatch logo seochat tools logo