Tile Map Editor

J

jojo80011

All,

I want to design an application that I can use to create tile-based
maps for 2D games. My problem is I need to create the scrollable tile
surface on the screen somehow, without wasting too many resources.

Does anyone have any ideas?

Thanks,
Joe
 
J

John B. Matthews

jojo80011 said:
All,

I want to design an application that I can use to create tile-based
maps for 2D games. My problem is I need to create the scrollable tile
surface on the screen somehow, without wasting too many resources.

Does anyone have any ideas?

Joe: Here's a tile-based game that might be instructive:

<http://robotchase.sourceforge.net/>

The individual tiles are of constant size, but the number of tiles
across and down changes as the window is resized. You could perhaps put
the existing tile view into a JScrollPane.
 
J

jojo80011

Joe: Here's a tile-based game that might be instructive:

<http://robotchase.sourceforge.net/>

The individual tiles are of constant size, but the number of tiles
across and down changes as the window is resized. You could perhaps put
the existing tile view into a JScrollPane.

I was experiementing with C# and the objects became too large and it
was slowing down the app. Do you think that java would be a better
choice (speed-wise)?
 
B

Bjørn Lindeijer

All,

I want to design an application that I can use to create tile-based
maps for 2D games. My problem is I need to create the scrollable tile
surface on the screen somehow, without wasting too many resources.

Does anyone have any ideas?

I've written a generic tile map editor in Java called Tiled, together
with Adam Turk. It's free software, licensed under GPL. Available
here: http://mapeditor.org/

The way we create the scrollable tile surface is by putting a JPanel
subclass (MapView) that implements the Scrollable interface into a
JScrollPane. The JPanel implements getPreferredSize and
getPreferredScrollableViewportSize (which just calls getPreferredSize)
and returns false for both getScrollableTracksViewportHeight and
getScrollableTracksViewportHeight.

When the user scrolls, you'll get calls to paintComponent(Graphics) in
which you implement the drawing of the layer. To make sure this works
efficiently, only draw the unclipped area of the map, so the first
thing you do is graphics.getClipBounds(). Drawing outside of the
clipped area unnecessarily slows down the scrolling performance.

Regards,
Bjørn
 
J

jojo80011

I've written a generictilemapeditorin Java called Tiled, together
with Adam Turk. It's free software, licensed under GPL. Available
here:http://mapeditor.org/

The way we create the scrollabletilesurface is by putting a JPanel
subclass (MapView) that implements the Scrollable interface into a
JScrollPane. The JPanel implements getPreferredSize and
getPreferredScrollableViewportSize (which just calls getPreferredSize)
and returns false for both getScrollableTracksViewportHeight and
getScrollableTracksViewportHeight.

When the user scrolls, you'll get calls to paintComponent(Graphics) in
which you implement the drawing of the layer. To make sure this works
efficiently, only draw the unclipped area of themap, so the first
thing you do is graphics.getClipBounds(). Drawing outside of the
clipped area unnecessarily slows down the scrolling performance.

Regards,
Bjørn

Thank you for the suggestions. I will look at your application.

Joe
 
L

lscharen

All,

I want to design an application that I can use to create tile-based
maps for 2D games. My problem is I need to create the scrollable tile
surface on the screen somehow, without wasting too many resources.

Does anyone have any ideas?

I have *very* simple tile editor I wrote in Java that's available at

http://iigs.dreamhost.com/smb/MapEdit.tar.gz

Tiled is a much more mature and sophisticated tool, but mine in only a
few hundred lines of code, so it might be more accessible if you want
to write your own.

-Lucas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top