Ludum Dare 36
The Theme is:
Ancient Technology

LD36 has ended!
Well done to everyone who took part.
1912 Amazing Games!

I can’t enter LD26 but, rather than complaining and doing nothing about this travesty of priority, I’ve done my own little LD in my evenings.  An hour here and an hour there and, after about 2 days worth, this is how far I got with my city-building game (video):


Now I must press on and make a proper full game of this!  Its a big project, of course…

I ask for your help!  How would you simulate a city, at a very deep technical algorithmic level?

I’ve played around with a “priority flood fill” so that, from each zone of a type, it fills outwards over neighbouring tiles using its score as the priority.  There’s a cost lookup by tile type so residential influence travels further along roads, for example.

This is very pretty and its neat but is it useful?  Will a large building with a high score ‘drown out’ nearby low-scoring buildings?  Will the influence of a high score building cause it to reach lots of target zones – e.g. residential finding industrial – quickly, meaning it sates the needs of far-off target zones at the cost of nearer but not-yet-high-score zones?   Will it mean a concentration of score?  Will it be intuitive?

What ways can you think of of actually computing, each sim step, if a zone should increase or decrease score?

3 Responses to “Asking for help: how would you simulate a city?”

  1. sorceress says:

    I’m guessing your flood fill idea is of this form: Influence(x+1,y) = Influence(x,y) * Fraction

    where Fraction is the proportion of influence carried to the neighbouring tile, possibly a function of TileType(x,y).

    One thing you could do is control how influence generating tiles (buildings) combine their effects, by moving to an energy-diffusion system.


    float Decay_Constant = 0.9f; // somewhere between 0 and 1

    iterate a few times {

    for each (x,y) {
    Influence(x,y) *= Decay_Constant; //remove energy from the system
    Influence(x,y) += InfluenceGeneratedBy(x,y)*(1.0f – Decay_Constant); // buildings add energy to the system

    for each (x,y) {
    InfluenceCopy(x,y) = (Influence(x,y) + Influence(x-1,y) + Influence(x+1,y) + Influence(x,y-1) + Influence(x,y+1)) * 0.2f * Fraction; // adiabatic diffusion to neighbouring tiles

    Influence = InfluenceCopy;


  2. Topaz says:

    Not sure if this will help, but I played a game a while back called xlincity, and it was a Debian package which you could download through aptitude. It had a pretty good city simulator and it might give you some ideas.

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]