You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there can be one BACKGROUND element in a given map screen, defined as a rectangle which is completely with one given tile of type DECORATION. These background tiles are currently statically generated by DATAGEN.
It would be nice to add a PROBABILITY setting, which applies the same filling algorithm to the given rectangle, but which finally puts the BG tile or not depending on its PROBABILITY. This can make for nice screens with randomly placed background elements (e.g. stars on the sky, grass on the floor, trees, etc.)
PROBABILITY can be a 0-255 setting specified in the BACKGROUND directive in GDATA file for the given map screen. When placing a background element, a random number 0-255 can be generated. If it is less or equal than PROBABILITY, then the tile is drawn. If it is greater, it is not. This way, 0-255 maps exactly to the regular probability interval (0,1), with 0 = never show and 1 = always show.
Finally, this code should be added to the engine and removed from DATAGEN. Memory wise, it's much cheaper to include a definition of a rectangle, btile and probability than several dozens of automatically generated static background tiles. For this, a "background" section should be added to the map_screen_s structure, and the relevant code to use it for drawing the map screen.
Also for this to work we need a pseudo random number generator.
The text was updated successfully, but these errors were encountered:
Currently there can be one BACKGROUND element in a given map screen, defined as a rectangle which is completely with one given tile of type DECORATION. These background tiles are currently statically generated by DATAGEN.
It would be nice to add a PROBABILITY setting, which applies the same filling algorithm to the given rectangle, but which finally puts the BG tile or not depending on its PROBABILITY. This can make for nice screens with randomly placed background elements (e.g. stars on the sky, grass on the floor, trees, etc.)
PROBABILITY can be a 0-255 setting specified in the BACKGROUND directive in GDATA file for the given map screen. When placing a background element, a random number 0-255 can be generated. If it is less or equal than PROBABILITY, then the tile is drawn. If it is greater, it is not. This way, 0-255 maps exactly to the regular probability interval (0,1), with 0 = never show and 1 = always show.
Finally, this code should be added to the engine and removed from DATAGEN. Memory wise, it's much cheaper to include a definition of a rectangle, btile and probability than several dozens of automatically generated static background tiles. For this, a "background" section should be added to the map_screen_s structure, and the relevant code to use it for drawing the map screen.
Also for this to work we need a pseudo random number generator.
The text was updated successfully, but these errors were encountered: