I'm running a OpenTTD-server permanently on a co-located server. I think it would be fun if all that work that goes into the game, every 100 years over and over again, would actually lead to something more permanently. I vision some web based statistics with possibly two goals:
- Show history and statistics for finished games.
- Possibly enable intra-game competition between players.
This patch might contribute to the above ideas. It makes a minimap
(see attachment). All tiles are 1:1 mapped on pixels. Like the smallmap that can be viewed ingame, but only more compact and without isometric projection. A 1024x1024 map would lead to a 1024x1024 minimap. It is currently implemented using MakePNGImage. It now only encodes the "owners" of each tile. I tried to copy the colors that are used in the smallmap but did not succeed in that. It has nothing to do with the GUI, so can be run on a dedicated server. The function is triggered by a console command (minimap).
- Fix colours.
- Check for png.h.
- Duplicate interesting smallmap functionalities.
- Compile to run on server and periodically save image to create animation, disclosure on web, etc.
- Map is 180° rotated or mirrored. Either way, it doesn't follow the intuition that ingame west or north is the left-upper corner of the minimap.
I must say I'm kinda proud that I managed to do this. Hardly any experience with C++, so trial and error is my friend. Still not understand why I can't get the colors like in the smallmap. Finding out how to get pixeldata into the buf from the callback was very problematic too. For example, why can't I just cast the void pointer to a uint32 pointer, set it to the right 'location' and assign 0x00RRGGBB?