Tuesday, October 04, 2011

World Generation Upgrades and New Screens

So from a technical perspective, I've refactored the world generation loop.  Beforehand I had 2 dictionaries that stored the current world.  One of the dictionaries was displayed in the draw loop while the other was being modified.  When work is done, a switch is flipped and the two reverse roles.  This worked pretty well but I felt it was very over-complicated and it did introduce the opportunity for glitches.  For example, sometimes the two dictionaries didn't have the exact same coordinates and there would be a minor jump in the world while it adjusted.

There is now a singular world dictionary.  It works almost the same way that my generation algorithm in R-01 worked.  The algorithm generates everything around the screen dimensions + a drawDistanceOut (currently set to 2 blocks).  When the map is pushed down, the algorithm only recalculates the new area.  It then detects where the old area is and deletes those blocks.  It's a moving map essentially.

Since I don't use foreach loops on this dictionary anywhere, I am free to add/remove blocks from it without worry of collision from threads.  The draw loop and the generate loop are on two separate threads so this is very important.

The other thing I've been working on is different screens.  Here are some screenshots:

The logo fades in to start the game off.

Generic front screen.  The map behind the options has a slight movement to it.

Seed input.  Not sure how I'm going to approach this on the 360.

Pause screen
There were some other minor bugs that were fixed but the world algorithm was the most important.  The only major screen I have left is the one that allows the player to load previous maps.  You can currently do this by entering the same seed, but I want it to list old maps and let the player just select the map they want to play.  I also need to add a multiplayer option but that's for the future.

I've also started researching musicians to have some background music in my game.  If anyone has any leads please let me know.  I'm thinking of an ambient, Explosions in the Sky type of sound.  My brother said it's called Shoegaze Music.

So I'm hoping I can finish that last screen before I leave for the weekend.  That would mean I have all next week to focus on the next build.  That build will include liquids, more enemies and more biomes/block types.

Until then.. ~