MichaelSinsbeck / platformer

A ninja platformer written in LÖVE
7 stars 0 forks source link

[LE] Variations change on every save/load #123

Closed Germanunkol closed 10 years ago

Germanunkol commented 10 years ago

Since variations are random, they change whenever the map is loaded... This is not a grave problem, but we might want to consider to use some sort of seed value. However, from the top of my head, I can't think of a simple way to correct this, unless we save the variation type along with the map. That's ugly, though :(

michalove commented 10 years ago

The smallest memory usage would be to save only one random seed (or to fix it for all levels). Then we need a deterministic method that, given a seed and a map, gives us a list of tiles, that should be replaced by their alternative. This method could simply traverse all tiles from left to right and from top to bottom and for each one decide, whether it should be replaced. However, that makes each alternative placement dependent on all tiles in the map: Changing one wall tile in the upper left corner might change all alternatives in the whole map. The other method would be the one you suggested: Saving specific tile information.

How about we don't display any alternatives in the editor, but only in the game. There we could use the method I explained above. Always use the same random seed (e.g. 1) and distribute the alternative tiles.