|

Lessons from the Map Script – Always Comment Code!

I had some time this week to look into the comments I got regarding the map script.  Thankfully, I commented a lot of my code when I started this back in October so it wasn’t that hard to track down the problems and provide some fixes.  I’m still leaving it in the script in a beta state to see if anyone finds other problems.

Here is a quick list of changes made and uploaded today:

  • Fixed an issue where some city names were showing “?” instead of “i” in the names.
  • Fixed the issue where files were being corrupted on creation.  This was a result of two separate issues.
    1. Disabled the create button to prevent running two iterations at once.  This was an issue if you clicked the button twice while generating a large map and would corrupt the file.
    2. Forced a reset of the supply and city arrays.  This prevented issues where cities were doubling up on tiles, which causes the game to break on load.
  • I attempted to make the directions for creating the map files a bit clearer.
  • You can now select the map code automatically by clicking the code box.  This should help in cases where extra characters were being copied by accident.

The main comment I got which I am not fixing was that the script should automatically generate the file.  However, I don’t want my script being blamed for accidentally creating “malware,” and since this is just a hobby for me, I’m not wanting to cause this kind of chaos.

Lastly, I want to point out how the parameters work.  If you are familiar with coding, you can simply check the source to see the impact.  Otherwise, tweaking anything other than the continents section will adjust the types of terrain.  Continents will determine if this is a land map, sea map, or half and half.  The default is half and half.  Here is a quick list of parameters I often tinker with when I make new maps:

  • Continent Lakes – This will determine how “round” your continents are.  Larger values will allow for more creative continents, but it means more jagged coastlines which are sometimes difficult to play.
  • Temperature Cold – This will make for larger ice-swept plains in the latitudes allowing for snow.  Reducing this number will mean more clear terrain.
  • Temperature Heat – This will make for larger desserts in the latitudes focusing on dry/hilly terrain.  Reducing the number will mean more forest terrain.
  • Supply Near Dessert/Snow – Increasing this value means you will see heavier supply focus on snow and dessert.  If adjusted higher along with the temperature, you will get more Middle East and Alaska type maps from a oil availability perspective.
  • Cities Threshold – Cities will clump together on favorable terrain.  If you like fewer cities on your map, reduce this value and increase the other terrain specific adjustments.  If you want less clumpiness, do the opposite.
  • Name of Engine – Easily overlooked since it is at the top.  Don’t forget to change this to your map’s name.

Hopefully that covers it.  Continue letting me know if you encounter more issues with the map script.

 

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *