11 March 2016 - Forum Rules

Main Menu

Learning how to make a map editor

Started by vince94, January 17, 2020, 10:05:00 AM

Previous topic - Next topic


I've been using CoilSnake to do EarthBound hacking-related things for a few years now, and the included map editor was written a decade or so ago (when the community's main programmer was in high school iirc), and they're kinda ashamed of the code and would rather it remained private/off GitHub. There was an attempt to make a better one, but it hasn't been worked on in a few years due to lack of interest.
So, how does one start learning how to make a map editor/tile editor? I've done some pointer table-related things in the past, but never anything that involves drawing graphics in a window.


Are you asking about GUI coding (we are in the programming section after all) or about the sorts of ROM hacking you tend to have to do to figure out level formats?

For the former then GUIs are a fun one in coding. Though these days the higher level languages (python, lua and such) often have very nice GUI libraries that won't be as arduous as some of the old school C and C++ offerings (there is a reason many such editors are awful visual basic programs or worse Java ones). That said do you need a GUI at first? Old school ASCII art can get you pretty far. On the flip side the other day I did find myself playing with a web based editor of some potency ( ), and they also gave some nice talks on things involved.

Levels themselves. In this case if you have code and have a working editor you can work with that; change one block to another, reset and change the block next to it, now you have what something is and where something is/what coordinates it uses. You will have to expand from there and see the other types of things, and in the case of platformers I often see background, platforms and enemies/hazards in three different layers/sections but it is all much the same.
If you have to go from scratch then it is much the same process, give or take those times you have a level editor within the game to play with. Find the location of the levels; I tend to do it by either searching the game for the level in memory if it is that sort of system, eliminating everything else until I find the level (if it is graphics and text then it is not a section of level data) or corruption, assembly hacking skills can help a lot here but plenty manage very nice things without them. Then figure out the format.
I have a more worked example of a platformer in,14708.0.html but yeah.


Yeah, I had GUI coding in mind. I love the look of this web-based editor! Yup, EbProjEd is one of the awful Java ones, heh.
There's a tileset + eight-tile chunk editor (also collision), and a map editor where you can place those chunks, add doors, enemy groups, NPCs, and event hotspots. Everything's extracted from the ROM and stored as special text files, which the map editor reads. (For example, here's a tileset)
The person who made the original is still active in the chat, so I can ask him how the data is stored. I'm just not sure how I'd would go about making a new interface for editing them.


Maybe start with a map viewer, possibly even an abstract coloured tile based affair, and then branch out. Branching out need not be full aware "this level can't be done, this enemy will walk off a cliff" type affair but even just a basic change one background tile for another and save back, and then expand that out.

Any language you care to use these days will have pretty decent GUI building libraries. Some will tie you to, or attempt to tie you to, a library or an OS but until you get really into it then you should be able to switch out easily enough.


Which language/GUI library would you recommend for this kind of project? The previous attempt I linked to in the OP was written in C++, but the closest experience I've had to that is C#.


There are limited assembly GUI libraries these days but just about everything else from plain old C on up will have fairly extensive libraries, frameworks and whatever else for all the big operating systems (or indeed theoretically OS independent in the case of some things). Whether I would use some of them to design a fully realised 3d editor or something is a different matter but should all be absolutely fine for a 2d level editor. Some are a bit inward looking for my taste (java being one such example -- there is a reason you can usually tell what is a java program by sight, and lua presents a whole other thing) but still get things done. You can also go the other way and find a scripting language to handle the GUI stuff but have the big boy stuff done elsewhere as a DLL/externally called program or something -- at one point autoit was set to be that but that faded away a bit.

To that end whatever language you know, or if this is the sort of project that will keep your interest then whatever one you want to learn.

For my own selfish reasons I would say not java as I am quite liking not having it installed on things any more, and I would bet I am not alone in that one (I think we are also mostly past the "only have it because minecraft" days as well).

I don't know other than silly examples if one is going to be inherently superior to another -- most times a level editor wants to crash and corrupt everything it is unexpected behaviour that is causing it, or interactions between hacks (say a level editor expects levels at predefined locations but some other hack changes things up here). The unexpected behaviour could probably be handled by coding for it where most editors I have ever looked at have been coded to do a task like a human or spreadsheet might and not do any bounds/sanity checking.


I developed the rom hacking tool cited by FAST6191 above, klo-gba.js, that is a level editor for Klonoa's GBA game.
I described in details on blog posts the process to develop the interface, but I could speak briefly here:
- You don't need to think about the language now! Firstly you should to learn how to create a custom map manually. Only after that you could think about "how to automatize the boring process to customize a map"
- So you could write a very simple proof of concept, with a ugly code and fast to write to understand better the problem, such as the steps necessary to extract the map from ROM, display it to user and save the new version on ROM
- And only after a workable proof of concept you'll understand better the problem and you could start to write the "real" project

So you don't need to think now if you need to use JS, C# or whatever. It's useless. Firstly you need to understand the problem, and to understand it you need to write a proof of concept.
You could write it using any language and you'll could check if it's good enough to write the final project.

A good language to that need to have good GUI libraries, good event handles, good libraries to use the file system and buffer of binary data. And how to check it? Writing a proof of concept.

I used JS to klo-gba.js because I love web app. The user doesn't need to download anything to use klo-gba.js, and it's awesome. But JS sucks, because it has a bad design. Currently there are better languages to replace JS, such as TS, and I should have used it instead of JS.


If you're into UI coding, and love web-based editors, I would highly suggest building your front-end using a web-app framework. JS isn't as performant as, say, C or C++, but computers are ridiculously fast these days, and mobile devices can handle web apps with little difficulty these days.

ReactJS and VueJS are good, well-documented frameworks. Also, LitElement is a fantastic web app library that's conceptually just like React, but its templating is far more intuitive as it uses regular JS tagged-template-literals instead of custom JSX. The company I work for also uses LitElement for our web-app. It's still very new and I think still considered "bleeding-edge", so it doesn't have all of the support that React, Vue, or even Angular does, but the docs are great, and it's pretty easy to figure out. This is a bit of a shameless plug, but I also built an entire ecosystem around LitElement to help fill in the support gap that it has between it and React. Just look for the @zensen framework at npmjs.

Now, if you want the near-native performance that C/C++ gives, yet you want a web-app dev experience, I recommend picking up the Rust programming language, and compiling it as a web assembly project. There's this reactive front-end crate (library) for Rust called Yew allows you to build web components that work just like React.


I think you can go for creating real town map. You must able to navigate in the city needed, also you can go for hidden spy apps for android to watch for partners route if you are working with somebody for drawing/documenting the area.
I have tried the same way for making a real town map (it was a poor design and gameplay game) but people from our city were playing it because of atmosphere. Especially thats actual for the lockdown!  :laugh:
Hope it can be helpful for you!
Riccky, 20y.All I love in my life is a hockey,basketball and music creating. Learning in Linguistic School. Recently I have finished 3rd academic year, I like this one by the way, I didn`t thought that learning will give me pleasure.


Quote from: RickkyJaden on October 16, 2020, 02:26:37 AMalso you can go for hidden spy apps for android to watch for partners route
Are you a spambot? Because you sound like a spambot.  (Especially as it is difficult to see how your comment remotely relates to the discussion.)
This signature is an illusion and is a trap devisut by Satan. Go ahead dauntlessly! Make rapid progres!


Quote from: Jorpho on October 16, 2020, 12:11:59 PM
Are you a spambot? Because you sound like a spambot.  (Especially as it is difficult to see how your comment remotely relates to the discussion.)
Why do you think so? I am just sharing my life experience, that is.
Riccky, 20y.All I love in my life is a hockey,basketball and music creating. Learning in Linguistic School. Recently I have finished 3rd academic year, I like this one by the way, I didn`t thought that learning will give me pleasure.


Quote from: RickkyJaden on October 16, 2020, 02:43:22 PM
I am just sharing my life experience, that is.

That's exactly what a spambot would say, get him!  >:D