The Move Tool
by Cory on January 10, 2019 1:03 AM
I just put in a move tool that will let me select existing tiles and then drag them around to reposition them. I had to restructure the tile editor code to allow for swapping out mouse behavior. Check it out yo:
It took waaaaaay longer than I thought it would. My technical debt is quickly becoming a huge burden. Holy fuck. The way I set up the scene graph and system stuff is a pain in the ass. I need to calculate transforms between the map layer (which could be panned and zoomed) and the hud layers which are never zoomed, but need to update in sync with the map. Calculating all the transforms and keeping them updated and making sure nothing breaks if the user just randomly decides to spaz out and click everywhere is fucking annoying. I really hope there's a better way to do this and that I can refactor what I have to do that soon...
I spent many weeks debugging and figuring out how to code the transforms. I even spent literally an entire weekend, that's 12 hours sitting Saturday and Sunday debugging why the selection wasn't correct when I zoomed in and out. It turns out I had a bug in the global transform calculation where I multiplied the transform matrices in the wrong order (matrix multiplication isn't commutative, but I wrote it that way because it was easier and I didn't catch it until now). There were other bugs and incorrect transformations that took up time too. I'm never going to get anything done at this rate jesus. At some point I'm going to need to do a major 2.0 version or something where I take stock of everything that works well and everything that doesn't and do an overhaul.
I should be actually working on game logic but I didn't want to have to make a map without a move function. I also want to add another tool where I can make "stamps" which is basically like a collection of map tiles that I can copy and paste all over the map. I think these 3 tools are good enough to make map creation not a terrible slog. And then after that I need to add in the ability to edit multiple tile maps to simulate layers...
This Thought is part of Game Programming
Game programming general topic. I eventually hope to split this into separate ideas exclusively about specific games that I make.