What is YTMC?
YTMC stands for Yeti’s Tile Map Creator and it is an editor extension for the game engine Unity that allows the user to visually create 2D tile maps inside Unity without the need of any third party software. It’s quick and efficient and should improve the workflow of 2D game projects a ton. The tool is still in development, hence this devLog.
I have been working on this project for a couple of weeks now; not continuously though. Now that I started this blog, I would like to document the progress in its development.
Since I’ve already been working on YTMC for a while, I dedicate the first devLog entry to catching up on what’s been done so far.
A visual editor for creating, editing, renaming and deleting tilesets in a special format that is used by the map creator.
Key features already included:
- Create, rename and delete tilesets.
- Import tilesets in .png format (not that exciting)
- Automatically extrudes the edges of the individual tiles to avoid visual seams and fragments when rendering the scene. This is a common problem with tile based games in the Unity engine. With this feature you don’t have to worry about that any more. The user can choose the amount of extrusion in pixels or completely disable this feature.
A visual editor for creating 2D tile maps using the tilesets created in the tileset creator. (This is where the fun stuff happens.)
Key features already included:
- Create a new map with given dimensions, tilesize and tileset.
- Create up to 32 layers that can be re-arranged, deleted and renamed.
- Show/hide layers.
- Draw tiles onto the layers with the pencil tool.
- Customize the layout of the Map Creator window.
- Zoom in and out and move the viewport (WOW!!!)
- The canvas’ grid and background can be toggled on and off (AMAZING!!!)
The struggles of developing a Unity Editor extension
Everyone who’s ever developed an extension for Unity will agree and probably burst into laughter followed by bitter tears of agony, when I say:
Unity serialization is a moody b*tch!
The way serialization is handled in Unity is pretty strange and unpredictable at first. I’m not saying it’s bad or anything. But I know for fact that I’m not the only one who had a hard time getting the hang of it. It simply does not behave the way you would expect and can deliver some strange issues that will drive you nuts initially.
However, once you get used to its quirks and bad habits you can use those to your advantage and develop workarounds for things you planned differently.
Due to the problems I had with serialization in Unity I lost some time and had to redesign a few ideas and data structures.
But me and Unity serialization are friends now. Not best friends, but… we’re getting along.
Another thing that gave me a few headaches at first were memory leaks caused by the way assets are treated in Unity. It’s always best to save procedurally generated assets to disk in Unity, that’s for sure. In some cases though, you certainly don’t have to. But you always have to make sure to destroy assets you created on the fly when they are no longer used.
Knowing all this now, I don’t have to worry about memory leaks anymore. The tool is running just fine without any problems!
This isn’t a big deal at all, but I wanted to mention it anyway. I restricted the amount of layers for each map to 32. Technically, that limitation doesn’t necessarily need to exist. However, memory is limited and since the Map Creator creates multiple mesh assets for each layer, mermory could potentially pile up and slow down the user’s PC eventually. To avoid that, I decided to include this restriction. But I guess you should be good with 32 layers, right?
What’s planned and needs to be done
A lot of the key features are already done, but here are the things I will be working on next:
- Eraser tool to delete tiles (already halfway done and just a matter of minutes).
- Fill/bucket tool.
- Selection tool for copy-pasting tiles.
- Collision editor for visually adding colliders to the map directly on the Map Creator’s canvas.
- Settings window
- Help window
- Change the current map’s tileset at any time.
- The ability to actually save the maps! (LOL)
There’s probably more that I can’t remember now. =/
Anywho, that’s what this devLog is for, right? So updates are to come.
I’m trying my best to keep the code as clear and managable as possible (which is generally a good idea, lol) and provide documentation, so that people using this tools can extend it to their needs if they want to.
I plan on offering the tool for only a couple bucks on the Unity Asset Store. Don’t worry, it’s definitely not going to burn a hole in anyone’s wallet. I promise!
Well, the headline pretty much sums it up. Here are a few visuals of YTMC. Remember that everything is still work in progress. Also, I’m not trying to showcase my mapping skills here. 😀
The tileset I used in this demonstration is from a game I created in cooperation with “Inferno Games” last year. It’s called “Runtime Error!” in case you want to look it up. Maybe I will post about it later.
That’s it for now
If your have any questions regarding this project, feel free to ask. I will try to update this devLog as often as possible to a reasonable extent.
Have a great day, everybody!