Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Thu May 25, 2017 2:32 pm

All times are UTC




Post new topic  Reply to topic  [ 16 posts ] 
Author Message
 Post subject: Patch: minimap
PostPosted: Sat Apr 11, 2009 11:36 pm 
Offline
Engineer
Engineer

Joined: Sat Apr 11, 2009 10:48 pm
Posts: 5
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).

Todo
  • 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.

Known issues
  • 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?


Attachments:
screenshot#1.png [52.63 KiB]
Downloaded 430 times
minimap_r15912.patch [3.91 KiB]
Downloaded 155 times
Top
   
 Post subject: Re: Patch: minimap
PostPosted: Sun Apr 12, 2009 12:36 am 
Offline
Route Supervisor
Route Supervisor
User avatar

Joined: Wed Dec 10, 2008 4:08 pm
Posts: 484
Location: tile 0x0000
Nice Rolie.
will definitely have a look at it.

Regards HackaLittleBit

P. S. Happy Easter

_________________
Chunnel , Distance between ships , Playing with Heightmaps , Signals tunnel , Waypoint air , Everest , Tunnel end


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Sun Apr 12, 2009 12:40 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jun 06, 2007 9:07 pm
Posts: 1710
Location: Czech Republic
What about making "ordynary screenshot" of entire minimap? Like giant screenshot, just not of game, but of minimap.

_________________
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Sun Apr 12, 2009 8:01 am 
Offline
Engineer
Engineer

Joined: Sat Apr 11, 2009 10:48 pm
Posts: 5
Bilbo, For 1024x1024 games, those would be too large to comfortably make animations, which is one of my goals :). But it shouldn't be too hard to do.

PS: Maybe I should call this patch "micromap" :)
PPS: Happy Easter!


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Sun Apr 12, 2009 9:45 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed Jul 30, 2008 12:42 pm
Posts: 277
Location: Trondheim, Norway
I'd really like to be able to zoom out on the smallmap. Then it could be used as bilbo suggested.

_________________
Try my modular airports minigame!

Image


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Sat Aug 08, 2009 8:04 pm 
Offline
Engineer
Engineer

Joined: Sun Jul 31, 2005 4:08 pm
Posts: 31
Location: United Kingdom
Sorry for bumping an old thread, but I have made some fixes to this patch and updated to a newer trunk version (17108).

Fixed:
Colours now match the Maps owner view (including company colours)
Output map is now flipped so that the left point of the map in game becomes the top left corner in the output map

It now uses the OpenTTD palette system to get the colours, so _owner_colours is now a byte (as the minimap only needs 1 colour for each pixel, where as the smallmap seems to need 4) instead of a unit32.

Attachment:
File comment: New map output
minimap.png
minimap.png [ 3.42 KiB | Viewed 4075 times ]


Attachments:
File comment: Patch against r17108
minimap_r17108.patch [3.95 KiB]
Downloaded 92 times
Top
   
 Post subject: Re: Patch: minimap
PostPosted: Sat Aug 08, 2009 10:13 pm 
Offline
Engineer
Engineer

Joined: Sat Apr 11, 2009 10:48 pm
Posts: 5
No need to be sorry for bumping an old thread if you ask me! Good work, will take a further look at it when I have my next OpenTTD period :)


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Sun Aug 09, 2009 6:52 am 
Offline
Tycoon
Tycoon

Joined: Sat Mar 15, 2008 7:02 am
Posts: 1498
I'm not entirely sure what this is. So is it just a map of the network that's shown once every 100 years?


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Sun Aug 09, 2009 9:21 am 
Offline
Engineer
Engineer

Joined: Sun Jul 31, 2005 4:08 pm
Posts: 31
Location: United Kingdom
It adds a console command that outputs a picture of the game map, there is a similar patch here viewtopic.php?f=33&t=44596 this one is different as it can be used by a dedicated server. I'm in the process of setting up a dedicated server as a sort of AI aquarium where I've used this patch with a quick bodge to get it to save a screenshot of the map every time the game autosaves (every month), which should give me a series of pngs which show the AIs progression.

Update:

AI Aquarium is up


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Wed Sep 09, 2009 10:12 am 
Offline
Chief Executive
Chief Executive

Joined: Sun Nov 11, 2007 12:06 pm
Posts: 658
what size is the out put picture?

Is it the same for all sized maps or dose it get biger/smaller

_________________
For Community Integrated Version http://code.google.com/p/civopenttd/


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Wed Sep 09, 2009 10:14 am 
Offline
Engineer
Engineer

Joined: Sat Apr 11, 2009 10:48 pm
Posts: 5
It maps 1 square on the map with 1 pixel of the minimap. A game with 1024x1024 squares would yield a minimap of 1024x1024. Simple, isn't it? :)


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Wed Sep 09, 2009 11:23 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
Congratulations on your patch, I can see why it's more useful than mine.
However, I wonder why you created an entirely new way to draw the map.. sure, it's more compact than the existing map, but we're used the smallmap that's in the game. Maybe you could optionally allow to draw the map in the diamond shaped form? :) Just a suggestion.

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Wed Sep 09, 2009 12:06 pm 
Offline
Engineer
Engineer

Joined: Sat Apr 11, 2009 10:48 pm
Posts: 5
I just wanted a better information density or, as you already mentioned, compactness. I now also realize that the normal smallmap screenshots (your patch, right?) are still (a lot) larger than 1449x1449 for a 1024x1024 map, so rotating the minimap 45° would actually not be such a bad idea :) Would require anti-aliasing I believe though...

PS: Splatman: nice! Now you only need to make the images preload and browsable by a slider control or something :wink:


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Tue Jan 12, 2010 9:35 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Dec 21, 2004 5:35 am
Posts: 185
Skype: andrey-zaharov
Location: St. Petersburg, Russia
any progress?

_________________
OpenTTD Hard Game Pack


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Wed Jan 13, 2010 3:27 am 
Offline
Tycoon
Tycoon

Joined: Thu Apr 02, 2009 10:43 pm
Posts: 3008
Location: Massachusetts, USA
Vaulter wrote:
any progress?

From what I can see, no.


Top
   
 Post subject: Re: Patch: minimap
PostPosted: Thu Jan 14, 2010 8:04 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Dec 21, 2004 5:35 am
Posts: 185
Skype: andrey-zaharov
Location: St. Petersburg, Russia
here updated patch for trunk and 0.7.5


Attachments:
File comment: trunk
minimap_screenshot_r18799.patch [3.98 KiB]
Downloaded 91 times
File comment: 0.7.5
minimap_screenshot_0.7.5.patch [4 KiB]
Downloaded 74 times
File comment: sample from real server :)
screenshot.png
screenshot.png [ 12.5 KiB | Viewed 3126 times ]

_________________
OpenTTD Hard Game Pack
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 16 posts ] 

All times are UTC


Who is online

Users browsing this forum: Cadde and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.