RPTools.net

Discussion and Support

Skip to content

It is currently Fri Oct 20, 2017 11:43 pm 






Reply to topic  [ 4 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Wed Jun 12, 2013 1:04 pm
Posts: 4
 Post subject: Decoding the Map UI
PostPosted: Wed Jun 12, 2013 9:05 pm 
I am a Java/Android programmer looking into designing a RPG Mapping system for mobile devices. I've been looking through the MapTool SourceForge for a few days to see if there is an easier/better way of designing the actual map grid. I've looked into a small list of ideas, but I still find that your program has the best implementation. If I could be pointed out to a few key classes, that'd be great.

I'm mostly looking at duplicating tiles along the grid, storing grid data in the form of an array to be altered as needed, for the floor tiles at least. What I'm trying to do is, basically, figure out how the background is generated and attempt to scale it down for devices that may only have a gig of RAM at best. Then, once I've generated a background (say, a grass field), I'll have to figure out how to manage stationary objects, walls, and the like, and finally token movement. After that, it's all UI and networking.

I realize Java uses Swing/AWT, but it'd be a good start.


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12101
Location: Tampa, FL
 Post subject: Re: Decoding the Map UI
PostPosted: Thu Jun 13, 2013 1:28 am 
Si-Malik wrote:
I've been looking through the MapTool SourceForge for a few days to see if there is an easier/better way of designing the actual map grid.

I'm not exactly sure what you're looking for, but I'll answer if I can.

Quote:
I'm mostly looking at duplicating tiles along the grid, storing grid data in the form of an array to be altered as needed, for the floor tiles at least.

MapTool doesn't do that. MapTool stores everything as explicit (x,y) coordinates in virtual space, then scales and translates the virtual locations into locations within the mapping space.

For example, when an image is placed at coordinate (0,0) and then moved to (1,1) it has moved one pixel along each of the x and y axes. Of course, if you zoom in far enough (ie. change the scale from virtual -> map coordinates) then the virtual 1-pixel distance could appear to be many pixels when its rendered.

And MapTool doesn't keep a single component with all images composited on it. Instead, it keeps a list of the virtual coords for all images, then composes the map on the fly each time it needs to be rendered (clipping to the viewable area of the map, of course).

Quote:
What I'm trying to do is, basically, figure out how the background is generated

The background is a repeating texture that is blitted to the component that represents the map before anything else is done. Then all other images are layered on top, with the fog of war being done last (so that it hides things that haven't been seen).

Using this technique there are no limits to the virtual size of the map nor to the size of the map space. And a map that is 500 cells by 500 cells with no images takes the same amount of memory as a map that is 10000 cells by 10000 cells that also has no images.

Pretty cool, eh? ;)

Quote:
After that, it's all UI and networking.

LOL! So it is, grasshopper. So it is.

What language do you plan to use -- Java? Just curious... :)


Top
 Profile  
 
 Offline
Kobold
 
Joined: Wed Jun 12, 2013 1:04 pm
Posts: 4
 Post subject: Re: Decoding the Map UI
PostPosted: Thu Jun 13, 2013 10:32 am 
Ah, I see. Now the ZoneRenderer classes make more sense. This is how I imagined MapTool did it, and it's just as complex as I expected. Android has its own 2D graphics renderer, but I've never worked with it. I'm not sure if its as robust as Swing/AWT.

I actually plan on coding this project in Unity, so that it can be ported to several platforms. Of course, that kinda depends on whether my current project is fruitful, that being loading Unity onto Android through a Linux VM. Otherwise, I'll have to wait until I can afford a new PSU for my PC. I'll know whether that's possible by next month.


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12101
Location: Tampa, FL
 Post subject: Re: Decoding the Map UI
PostPosted: Thu Jun 13, 2013 3:27 pm 
Si-Malik wrote:
Ah, I see. Now the ZoneRenderer classes make more sense. This is how I imagined MapTool did it, and it's just as complex as I expected. Android has its own 2D graphics renderer, but I've never worked with it. I'm not sure if its as robust as Swing/AWT.

Glad that helped. :)

For what MapTool does, nothing fancy is happening in Swing.

MapTool uses the Shape/Area objects to represent drawn images and Image objects for everything else (JPEGs, PNGs). Swing merely provides the canvas on which to paint() the picture, but any graphical destination would work as well (assuming they had clipping, scaling, rotation, and transparency support, since MapTool uses them). Your own application may not need those features.

Quote:
I actually plan on coding this project in Unity, so that it can be ported to several platforms.

Ah, yes. I looked at Unity but found it to be too closed for things I might want to write. Their licensing model was rather restrictive, IIRC...

Quote:
Of course, that kinda depends on whether my current project is fruitful, that being loading Unity onto Android through a Linux VM. Otherwise, I'll have to wait until I can afford a new PSU for my PC. I'll know whether that's possible by next month.

Um, PSU = Power Supply Unit? That's necessary because your current computer is in the shop or something? They're about $50 at NewEgg.com; I think I got my ThermalTake for about $60 and it was beefy enough to run 4 hard drives and 95W AMD cpu without breaking a sweat. But no fancy GPU cuz it's not a desktop machine...

Good luck with your project, and I'd like to hear how it goes if you get a chance to update us. Cheers!


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 4 posts ] 

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:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman