A day or two into the week I completely ditched that goal. I quickly realized that "working on the website" wasn't a definitive clear task.
I had no real end goal or target to aim towards and that's always a recipe for disaster.
It was a poor goal for the week and I'm glad that I was lucky enough to sense this before burning much time.
Instead, I switched to a goal of implementing movement. And we got that working!
Click to move to another tile.
I first started by working on the backend. In the client request handler I added a new handler for movement.
When a player says that they want to move to a certain location we'll process that and if it's a valid location we'll set the player on a path in that direction.
Handling clients requesting to move to a location.
This is generally how much of our future functionality will be handled. A player says that they want to do something and then we handle that request and change server state accordingly.
After getting the backend in place I started to work on the client side of things. A player needs to be able to
click on a tile and then click
"Move Here" in order to tell the server that they want to move.
Move here interaction.
This led to me refactoring and enhancing my terrain implementation to more easily retrieve information about our terrain tiles so that we could do collision detection.
I added a few new utility functions including an implementation of watertight ray triangle intersection, a function to determine the ray that the player's mouse is casting into the scene and various other bits to help us know which tile is being moused over.
Utility function to give us all of the tiles between two points to reducer the number of tiles that we need to do mouse ray collision detection against.
Throughout the client side implementation I ran into several bugs where my tests were passing but the moused over tile detection wasn't working properly when I tried it in game.
I eventually started rendering some runtime debug information and was then able to quickly see that my unit tests were flawed and I was expecting off by one information in some places.
Rendering information about the hovered over tile helped me to eventually figure out why things weren't working and fix it.
My big takeaway from the weekend was that I need to do a much better job of having runtime diagnostic information in place so that I can pick up on things that my unit and integration tests might not be showing me.
I'll be speaking at a Rust conference this weekend to speak about Percy so I'm not expecting to get much work done on the game.
By next week I'll implement client side interpolation of our entities' positions and plan out our monthly membership subscription implementation so that people can pay for the game after we release it.
See ya next time!