Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2] 3
  ignore  |  Print  
  2D Map editor  (Read 37789 times)
0 Members and 1 Guest are viewing this topic.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #30 - Posted 2008-05-18 21:49:15 »

This is super pretty, and looks like it works great. It's too bad I already have my own level editors created for my games... maybe I can actually add onto your project. I've got other features like as many layers as you want, being able to add custom Java code to each level (so like pushing a block into a wall can make something happen, etc.), and a few other things.

Let me know if you're perhaps interested in those additions.

See my work:
OTC Software
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #31 - Posted 2008-05-19 11:46:36 »

well this one has no sort of scripting or interaction at all, so if you want to add something like that, it would be great, or even just post some code if you dont have time to do it yourself.

me: Nice screenshot. Its great to see someone making use of it. It looks completely different with those tiles.
I wonder why you set the tilebuttons so wide like that...
Offline me

Senior Devvie


Projects: 4


Java games rock!


« Reply #32 - Posted 2008-05-19 12:37:22 »

The reason for changing the tilesize in TileChooser is because the
tiles that I use are overlapping eachother half.
The actual tile is Height:100xWidth:50.
There was only one dimension that I could change in the
TileChooser.java and that was the width. Granted, I could modify
the whole chooser code but I wanted to have a quick go at it.
So I changed the tile to 100 and thus resulting in the extreme width
of the tile.

Maybe I did go about it incorrectly and you can point me to the
best way of changing the tile dimension in the tilechooser......


Best regards from

M.E.

M.E.
--------
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #33 - Posted 2008-05-19 13:46:25 »

change
   int tileWidth = 32;
to
   int tileWidth = 50;

and lines 54 & 55 to:
1  
2  
         Image i2 = new BufferedImage(50,100, BufferedImage.TYPE_INT_ARGB);
         i2.getGraphics().drawImage(i, 0, 0, 50,100, null);


Or if your base tiles, ie. the ground ones are 50x50, then use 50, 50.


i have to redo the tileset stuff properly one day. i have been playing around with drag n drop, i wanted to make it so you could create your tileset by just draging images onto the tilechooser panel and then it would ask you for a bit of info about it and add it for you. but first need to add a save function to the GraphicsBank class, which holds a tileset. Actually, it might not be all that much work.
Offline me

Senior Devvie


Projects: 4


Java games rock!


« Reply #34 - Posted 2008-05-19 15:28:08 »

Great!

Changing lines 54 and 55 did the trick! The tileWidth was
changed already but the tile was scaled to the 32x32 image
which made a distortion.

Thanks a bunch!

Draging images onto the chooser would be nice,
but I didn't mind investigating what you had.


Kind regards from

M.E.

M.E.
--------
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #35 - Posted 2008-05-19 18:32:24 »

well this one has no sort of scripting or interaction at all, so if you want to add something like that, it would be great, or even just post some code if you dont have time to do it yourself.

me: Nice screenshot. Its great to see someone making use of it. It looks completely different with those tiles.
I wonder why you set the tilebuttons so wide like that...
Okeydoke, I'll put some code up somewhere, perhaps.

See my work:
OTC Software
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #36 - Posted 2008-06-07 14:52:55 »

Dropping an image onto the tile chooser now adds it as a usable tile, but there's one problem still.

Drag and drop gives me the files i drop as File objects with absolute paths like so:

"C:\Documents and Settings\Judd\Desktop\Judd's Junk\Java\mapedit\gfx\tiles\fence.gif"

But to add them to the tileset, I just want the path relative to wherever you're running the editor from, or wherever the tileset file is located. such as:
"gfx\tiles\fence.gif"



I can think of one quick and dirty way to get this... make a new file at the location of the tileset file, then call getAbsolutePath() on it, make it a string, and clip the beginning of that from the beginning of the other string.

This seems a bit messy to me. Is there another way to do this more reliably?
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #37 - Posted 2008-06-07 16:21:17 »

when u drag and drop, cant you just have a InputDialog and ask the user for new images description name, then save it to the tilemaps working directory, aswell as apending a line to the current tile script file.

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline CommanderKeith
« Reply #38 - Posted 2008-06-08 00:40:23 »


I can think of one quick and dirty way to get this... make a new file at the location of the tileset file, then call getAbsolutePath() on it, make it a string, and clip the beginning of that from the beginning of the other string.


This sounds fine to me.

The drag and drop feature sounds fantastic.

Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #39 - Posted 2008-06-08 03:33:12 »

save it to the tilemaps working directory

i hadn't thought of that, and it's a good idea.
I think what i'll do is have the program attempt the path clipping thing on the filename first. If it doesnt match (ie. tile above path of tileset, tile on a different partition... tile on your desktop), then i will copy the image file to the tile directory, otherwise i'll just put the clipped path into the tile list...

EDIT:
I have done a complete rewrite of the GraphicsBank (the class that loads / saves tilesets). It has been simplified. Here's an example of the new tileset format:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
# This file lists all tile resources
# Whitespace at the start of a line, and immediately before and
# after a comma are ignored. Don't use commas in the description.
# Each tile must be on its own line.

ID number,Image file,name,type,Other info...

26, tiles/grass.gif, Green Grass,  No type,   You walk on it...,
1 , tiles/dirt.gif,  Dirt,         No type,   It makes boots muddy,
2 , tiles/tree.gif,  Plain Tree,   no type,   It is a bit wooden,


I think it's both easier to read, and easier to parse, you only need do readLine(), split(",") and trim() to get values.

All paths used to find files are now relative to the file that's referencing them, rather than the location you started the editor from. The editor can no longer read tiles / tilesets inside its own JAR, so will launch with a clean slate instead (but this seems broken right now).

Currently it's not finished so i won't put a new set of files onto the webpage, but if you're curious to take a peek, you can see the SVN here: http://code.google.com/p/simple-map-editor/source/checkout


New properties dialog (left) and some new decoration (right). I decided to stop caring about rendering speed, so any new decorations will be in png with alpha transparency.
<a href="http://juddman.googlepages.com/ver1alpha2.png"><img src="http://juddman.googlepages.com/ver1alpha.png/ver1alpha-medium.png"></a>
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #40 - Posted 2008-06-16 01:12:12 »

very cool, only just noticed the updated version.

nice addition with the tile adding

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #41 - Posted 2008-06-26 14:11:34 »

Version 1.0

- Right click tiles for a properties dialog to edit their info or delete them.
- Add new tiles by dragging and dropping images onto the tile chooser panel.
- Save and load tilesets independently from maps.

If you remove a tile from a tileset then open a map that referenced it, i think it will be erased (set to 0), but i haven't checked.
Screenshots and download: http://juddman.googlepages.com/ (<a href="http://juddman.googlepages.com/Mapedit-1.0.zip">Mapedit-1.0.zip</a>)

To run it, download the zip, extract, run make.bat, then double click mapedit.jar (or run.bat)
Linux users may prefer to type "javac *.java" and then "java MapEdit"

Open a tileset by clicking the little open button at the bottom of the tile chooser (it's a bad location, i know), and enjoy painting Smiley
or open MyScene.dat for a look at a small map i already made.

If you prefer, drag your own images onto the tile chooser to make new tiles. They can be added to existing tilesets or new ones.

It's been tested but not extensively. tilesets are not compatible with previous versions, though you could create a new one with the same ID numbers for the same tiles, and it should work with existing maps. not sure.

TODO: Allow user to adjust grid width and height.

Edit: oops, forgot to remove that "tileset" button on the toolbar. it's a placeholder and does nothing.
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #42 - Posted 2008-08-09 10:25:25 »

Juddman any news on the undo fuction, i was thinking, you could always save the scene in a temp file, on mouse release. or something like that, then reload it, when undo is called.

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline Wildern

Junior Devvie





« Reply #43 - Posted 2008-08-11 18:21:54 »

Looking at the site, undo/redo was done in the version prior to 1.0

New in 0.11
Undo and Redo.
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #44 - Posted 2008-08-11 21:34:06 »

Sweeet, very cool

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #45 - Posted 2008-08-14 13:00:04 »

By the way, resizing the map and shifting the tiles using the arrow buttons on the toolbars can't be undone. Just thought i'd give you the heads up.

I have recently pushed a very small change to the SVN version, it just fixes a little UI annoyance related to clicking the tile chooser buttons sometimes not registering properly, and an issue where the tiles 'type' would be set to its 'user text', and the user text would be null, losing the type string completely.

the svn is here:
svn checkout http://simple-map-editor.googlecode.com/svn/trunk/ simple-map-editor-read-only

The project page is here:
http://code.google.com/p/simple-map-editor/source/browse/

The files that have changed are:
TileChooser.java
GraphicsBank.java
MapEdit.java
Tile.java
gfx/outdoors.sat


And since it's not on this page of the thread, i might as well chuck the home page URL:
http://juddman.googlepages.com/

I am quite happy with it for the moment and don't have anything on the todo list. Suggestions always welcome, but modified code is even better. If anyone would like to contribute something, i can add you as a project member to the google code project.

Edit: Something i have noticed is with the latest JVM, OpenGL accelleration is enabled by default, and it makes the editor really smooth, even when maximised on a large map and using a lot of alpha blended decorations like that huge shadow image. Well worth the update.
Offline mcco0055

Innocent Bystander





« Reply #46 - Posted 2009-01-12 19:37:44 »

JuddMan,

I created an Eclipse project, and an ANT build file to allow us folks not running windows (Mac and/or Linux) to get into the action without too much grief. I altered the MapEdit and Tile classes to overcome the class resource mess so you can package the class files into a jar and have your resource files outside of the jar.

Drop me a line if you wish to have this nice little extras.
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #47 - Posted 2009-01-18 07:47:28 »

mcco0055: OK, i sent you an email.

I've made a couple of small fixes and uploaded a new version, It's a JAR file, so should be easier to get going than before. the tile images are in the jar file and will have to be extracted if you want to use them.

<a href="http://juddman.googlepages.com/Mapedit-1.01.jar">Mapedit-1.01.jar</a>
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #48 - Posted 2009-01-18 07:50:40 »

juddman if your interested, I uploaded a copy of your map editor modified for my game. http://users.on.net/~bobjob/RTS_RELEASE.zip

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #49 - Posted 2009-01-18 07:53:51 »

cool, downloading now...

Interesting. very different. It looks like you based it off version 0.8.
Different grid sizes per layer, a height map, and sprites

I had a go at the game too but my guy died on the first enemy i attacked. Smiley
You could probably save some space by not including all the tiles you dont use
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #50 - Posted 2009-01-18 08:41:31 »

Interesting. very different. It looks like you based it off version 0.8.
Different grid sizes per layer, a height map, and sprites
There is still a little bit more Iv added, like added a forth layer for air units (but it isnt implemeneted in game yet).

Quote
I had a go at the game too but my guy died on the first enemy i attacked. Smiley
Tongue The game is still extremely un playable.

Quote
You could probably save some space by not including all the tiles you dont use
yeah forgot about that, cool I deleted them. Smiley

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #51 - Posted 2009-02-07 15:08:09 »

I've been looking into PNG and metadata recently.

What i'd like to do is make the GraphicsBank sets saveable as a single PNG image of all the tiles, with metadata describing the position and size of each tile in the set. I think i can do this by creating a tEXTEntry node with the info needed.

As well as this, maps could be saved as a thumbnail image with the metadata containing the map itself (which should be easy, since it's already just text).

I'd actually like to be able to optionally store the tiles themselves in the map image somehow, but haven't figured out how i'd go about writing a binary chunk into the PNG metadata (ie the way Fireworks stores layers). custom chunks don't seem supported by Java.

Does anyone know if what i am thinking of can be done with the standard API?

There are two advantages of this approach:

1. Maps get a thumbnail in almost all file explorers
2. Tilesets are just one self-contained file, rather than a text and a bunch of image files.

and if i could store binary as metadata then
3. Map and tileset could be combined for easy transfer when convenience is more important than size.
Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #52 - Posted 2009-02-07 20:32:13 »

hey juddman, here is my source code. for my version of your map editor.

There is a bit of code you might find interesting.

In class Scene there is some code to generate a "jpg" MiniMap
Map Editor Source (700k)
it may be useful if you ever want to make an RPG, and want a world map image.

somthing else to note is everything saves into a zip file (but with the extension ".cmp")

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline DMastaGX

Senior Newbie





« Reply #53 - Posted 2009-08-17 02:15:11 »

How do I run this ? Thanks.
Offline SwampChicken
« Reply #54 - Posted 2009-08-20 00:02:17 »

The above source link no longer works?
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #55 - Posted 2009-08-26 08:36:39 »

How do I run this ? Thanks.

you download the JAR file from http://juddman.googlepages.com/ and then double click it.

If some program stole your .jar file extension (older versions of WinRAR do this) then you can right click the downloaded file, choose open with, and pick Java (you can also pick 'choose program' to permanently change which one opens those kind of files)

If you want some tiles, the source, or some sample maps, then all you need to do is unzip the JAR file using WinRAR or Winzip. it's all in there. to run it once unzipped, there's a file named 'run.bat' that you can double click

If you want to edit the code, you can compile it just by using javac, or by double-clicking make.bat. This will also make a new JAR file with everything packed up for you.
Offline nexeh

Junior Newbie





« Reply #56 - Posted 2009-11-28 17:20:04 »

Hey Juddman,

First off thank you for the tool. I ended up using it as a starting point for a small RPG im working on and it gave me the motivation to actually start something and stick with it Smiley

I have a change to the application that I need make for my own purposes but I didn't know if you wanted to be involved in it as an additional feature to your application? I have a tile set that I'm using that has some tiles that are larger that the tile width and height( but still even multiples such as 64x64, 96x96), a tree for an example. Currently if I place that tree on layer two it will anchor to whatever tile i select and render accordingly. The problem come when you want the char to walk behind it. Obviously if hes below the the trunk of the tree you want him to rend on top of the tree but if he's above the the truck he needs to be behind the foliage. Obviously the truck should be the only tile that performs any collision detection as well. This problem worsen if your truck is bigger than that tile you selected then make collision detection even worse.

I don't have the code design yet but here's my solution (That may have some kinks that still need to be worked out). I was thinking of making some type of advanced tile pallet for your editor. Basically I could define a reusable "stamp" that would place the trunk on a defined layer in the selected tile have a defined type that tells the game it's not a traversable terrain (for collision detection) and then place the foliage on level 2 in their own tiles with their own defined types. So as a result when using these tiles from the "advanced Pallet" the tool would place multiple tiles that all have their own attributes.

The tree is the simple example. I have some elaborate cliffs that may be 3x3 in tiles and only one tile is a traversable terrain type but i would go nuts if i have to break out the cliff into 9 tiles! Smiley Buildings are another good example too

I would love to hear from you and your thoughts.  My email is Jeremy.R.Corson@gamil.com.
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #57 - Posted 2009-11-29 08:35:59 »

It's a good idea and I've thought of having a mass tile stamp a few times before.

An alternative that would probably work is to use the top layer to paint walkable / unwalkable tiles - you could use semitransparent green and red boxes, and just not render that layer in your game, but use it for collision detection. This would save you splitting up tiles (which is kind of pointless if you'll never use them individually - we're not in the hardware-restricted NES days anymore), but it would use up a layer (feel free to edit the code to allow more layers - shouldn't be too hard).
Offline nexeh

Junior Newbie





« Reply #58 - Posted 2009-12-03 15:26:41 »

Sorry didn't see your response till now and I also noticed i typo'd my e-mail.. it's gmail Smiley

The 4th layer for collision isn't a bad idea actually. But i would still need a way to do the "walk behinds" for larger tiles such as trees. This would work well for my large cliff tiles tho!
Offline JuddMan

Senior Devvie


Medals: 1


Your Ad Here


« Reply #59 - Posted 2010-02-10 11:15:12 »

for trees, a small block for collision at the base of the tree with the rest of it being walkable should work.

To make a sprite render correctly and go behind stuff, I would render all of the bottom layer first, then the middle layer, row by row, but at the end of each row on the middle layer, also render all the sprites that are standing on that row. This way, when you render the next few rows down, all tall things that stick up will be drawn over the top of that sprite. Finally, render the top layer which has things that are floating and should always go above the sprite.

The trick i used was to place the origin somewhere on the bottom edge of the tile instead of the top, so that tall tiles stick up, and therefore go in front of tiles on the row above them, rather than sticking down and going behind the tiles on the next row.

It's not perfect. if you have a tree with overhanging low branches, you might want to break those branches into separate tiles and put them on the top layer so that you never appear to walk in front of them.

Don't be afraid to use nice big transparent images. you don't have to have a picture in every tile on the grid.
Pages: 1 [2] 3
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (35 views)
2014-12-15 09:26:44

Mr.CodeIt (26 views)
2014-12-14 19:50:38

BurntPizza (58 views)
2014-12-09 22:41:13

BurntPizza (93 views)
2014-12-08 04:46:31

JscottyBieshaar (53 views)
2014-12-05 12:39:02

SHC (69 views)
2014-12-03 16:27:13

CopyableCougar4 (71 views)
2014-11-29 21:32:03

toopeicgaming1999 (131 views)
2014-11-26 15:22:04

toopeicgaming1999 (122 views)
2014-11-26 15:20:36

toopeicgaming1999 (34 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!