Map Editor Question

Hey all,

I’m pretty new to Java gaming in general, and I was starting to make a 2D tile-based map editor. I was going to use a JPanel with GridLayout to contain all of the cells of the map. I was hoping for some feedback from the community to see whether this is the best method of doing this or not. If it is, would the performance bog down a lot for larger maps (such as 1000x1000)?

Ultimately, JPanel with GridLayout might not do all you’d like. From personal experience, it probably won’t. Every time I’ve tried that approach, I’ve discarded it.

That said, it’s a fine way to start out. Extend JComponent (or even JPanel) for the cell elements. It’ll probably melt down at 1000x1000 cells, but I’d give it a try.

Stop! before doing anymore think about what you want. Do you need your own Map-Editor or is it okay if you use e.g. Tiled. Trust me, as a Newbie you want to use that. Making your own Map-Editor is fine and all but I bet you want to use that for a game right? Your saving time if you use Tiled instead :slight_smile:
I had to make one for school and it is not as easy as you might think :wink:

Yes, I’d like to use these maps for a game I will be making. I have Tiled but I thought that it’d be a good project to start off with making a map editor for myself though so I can get more used to Swing and other graphical components. Also I’d have the freedom to make it whichever way I want.

I don’t know what map you are trying to create, but I suggest to override JPanel (or whatever you are painting it) paint method for custom painting.

As R.D. noted, if you decide to write your own editor, be prepared to spend a lot of time on it.

Like Cas mentioned in another recent thread, doing something like this (making your own tools) is lots of fun for some of us, and appeals to the “engineer” in us. Just keep in mind that map editors already exist (such as Tiled), almost surely have more features than the editor you’ll write, and definitely will have fewer bugs (since they have so many users that can stumble on things, most problems have already been worked out). Writing one yourself will be fun, but it’ll take time away that could be spent writing your actual game.

coincidentally I have a recent post of mine with screenshots
http://alchemic-tempest.com/?site=news&id=2937

I just render a 2D array of Images just like in-game

As mentioned - its a hell of a job
Programming an editor is much work and not fun at all - debugging and all… and if someone else has to make maps with it, its even worse
however its often necessary if you have your special needs

but you know - doable with dedication…

As others have stated, it’s all about your motivations. To learn Java/Swing/GUI coding, a map editor makes for a good project, because you can start very simple (colored squares) and keep adding features, all while learning about Swing painting and GUI interaction, etc. I’d say go for it. Make a little grid editor and post a JNLP link here for others to try it. Making anything that others can try is a huge step in the right direction (and is very motivating).