Sometimes days and days go by where I just try to fix these tiny bugs that have been in the game engine for months and I’ve just always thought “Oh yeah, I understand that bug, I’ll just fix it next time I’m in that part of the engine”. Then you get back to that part of the engine and you realize you have no idea how any of that code works anymore or why it’s bugging out the way it is.
Even with the amount of comments in my code, I sometimes spent a large chunk of time actually re-learning how I managed to make something work the first time so I can actually get down to making it work properly the second time.
For something slightly more entertaining, I went ahead and removed the old “Damage popup numbers” that were floating out of creatures when you damaged them. They were way too big and ugly, especially in hectic situations. I replaced them with blood particle effects with no real damage quantifier to let you know how much exact damage you’re doing. Weapon power is made clear elsewhere in the game when you are equipping abilities, so I think for the in-mission effects the blood is a much better result.
It also looks pretty cool when all hell breaks loose. In these videos, my creatures have a massive amount of health, probably more than you’ll ever actually achieve in the game. It’s just to test it all out.
When the player interacts with the UI, I want it to be really clear what’s going on. When you click on a creature’s portrait it snaps onto your mouse cursor before sliding back to where it started; the player needs to know that they can click-and-drag that portrait. When you hold down the mouse button on the portrait, any “ability” icons next to the portrait curl up and hide behind it to let the player know they’re dragging the creature and all their abilities along too.
If you release the mouse button in a useless place, everything smoothly returns to where it started to let the player know clearly that their action had no effect. If they drag the portrait near an appropriate resting-place, all the other portraits near that place will move aside to make room for it, even if the player hasn’t released the mouse button yet. If the player moves the mouse away from that resting place, the portraits will all move back to where they were, showing that you’re no longer considering dropping your portrait in that place.
Everything on the UI needs to move smoothly, deliberately, and intuitively to make sure the player understands exactly what they’re doing with the elements they’re interacting with. I hope I’m slowly getting close to this goal.
I spent all of New Year’s Day making the drag and drop mechanics feature-complete for one of the in-game menus.
It’s been amazingly more complicated than expected to implement something that I use in my OS and other games every day without even thinking about it. When you pick up a sprite to drag it somewhere, you have to record such a huge amount of information about what you’re doing and what you might possibly plan to do with that sprite.
I use the mouse cursor as an entity which records what it’s carrying, where it started carrying it, where it’s considering throwing it to, what it’s doing with it at the moment, and about fifteen other things. When you release the mouse button, the game has to check so many things regarding “Is this a good place to drop this?” that it’s amazingly easy to leave loop-holes that can be exploited and result in duped items or creatures.
Another important thing is to only check certain “drag and drop” conditions if you actually need to – because you’re looking at doing a huge number of checks on a per-pixel basis, you can’t do that every frame all the time; you need to turn certain features on or off depending on whether they might possibly apply at any given time.
In the end, everything turns out very satisfyingly tactile and you can kinda “throw” objects around between windows in a smoothly rendered way. I like the result so I made a little video about it.