minor refacotring: silence some warnings
(sic)
Does what it says.
Ramblings about hobbyist game development
minor refacotring: silence some warnings
(sic)
Does what it says.
wait for the path to clear for 200 ticks before giving up navigation
Since we are only looking for static objects when plotting a path, dynamic objects may end up blocking the way. Those dynamic (as in “moving”) objects might also move away again, to account for this, wait 200 ticks and try again before giving up.
In the above video you can see how the first chair first blocks the way, so the second one waits before it tries again after 200 ticks.
navigate around static objects
Instead of just walls, we now also navigate around objects, for the time being only the ones which are marked as static, this also takes into consideration the object’s dimensions and rotation.
add a pause functionality
That’s what it does. In addition to the three speed settings it is now possible to fully pause the logical ticks.
If you check out the above video and watch the console output, you will see this feature in action.
base gamestate ticks on a user adjustable setting, not just “as fast as possible”
Before this, the logic thread was a little out of control. This binds the logical ticks to time elapsed instead. To make things a little more interesting, this also introduces three speed settings (1x, 2x and 10x).
finish the offset logic for objects other than 1×1 and rename the enum values to something more accurate
As it said on the lid, finishes the work started in the previous commit.
– do not always recalculate positions and rotations even if nothing changes
– introduce the concept of object dimensions, orientation (WiP) and isStatic
This introduces the concept of logical object dimensions. This had to be done as objects that do not happen to be chairs may have dimensions other than 1 by 1 tiles.
This also means that depending on that size they have to have some sort of offset calculated when positioning them on a field of tiles.
It also adds the notion of “static” objects which do, well, nothing except just existing and minding their own business. In other words, that means they will quit the tick function right after entering it.
– small refactoring: move the rotation calculation to its own function
– make the movement less jerky by making the “snap in place” distance a lot shorter
It’s almost nice to watch it now. Why don’t you check it out:
do not immediately rotate when reaching a waypoint
Instead of just switching to the next target node rotate towards it before start to move in its direction.
– fix visual offset when moving objects
– do not take “shortcuts” when navigatin
Apparently we no longer take shortcuts when we are navigatin‘ (sic). What that means is that we are no longer move through objects that may be in the way.