Devtober Day 5: Now we fantasy
Happy Monday, everyone! Today was day five of #Devtober, and as you can see from the above video, I’ve made some good progress over the weekend – I did post on my twitter account when I wasn’t posting here!
Saturday
On Saturday, I was focused on trying to make tilemap layout easy. I had tried a few editors in the past, and I honestly didn’t really enjoy working in any of them. That is not to say they aren’t great tools, just that I didn’t enjoy certain aspects of each of the ones I’ve tried. I also have grandiose visions of having a built-in editor, which certainly fuels my ability to be unhappy with other software – the builder’s perpetual dilemma!
I decided upon approaching tile layout using a “four corners” approach. This means that I define for each tile what each of the four corners contains. This may sound tedious, and it is a little tedious, but the payoff I think is worth it. Eventually, if I want to replace artwork, everything is strongly typed and as long as I get my initial sprite-sheet definitions correct, the compiler will check that I’ve updated all of the other references properly.
After identifying what the contents of all of the sprites are, it becomes a fairly simple task to take a “room” definition where each tile is a specific content type and generate a tilemap. That’s where I was at the end of the day Saturday:
Sunday
My goal for Sunday was to get my tile map generator hooked up to my client-server code. My stretch goal was to replace my super-realistic spaceship model (aka, the triangle) with animated sprites from the TimeFantasy Characters pack.
It was a bit of a rollercoaster of a day, but I succeeded with some caveats. If you pay close attention, you’ll notice that the grass patterns don’t match on both clients, and there’s some “tearing” between tiles. The first is a result of me just being too tired to notice before posting, and the second is more of an issue of how I’m currently approaching drawing those tiles… let’s just say I wasn’t surprised that I’m facing those issues.
Today
Today I started by sorting out my seeded randomness not working properly. The result ended up being that I was inadvertently removing the order of a collection by stuffing it into a HashMap. I am thankful that the std::collections::HashMap
implementation was not deterministic in how it allocated its internal storage, as it could have taken me much longer to identify that subtle bug.
After that, I allowed myself to be distracted by two problems: continuing to dream up the concept of the game, and trying to solve the tiling issues I mentioned above. I’m not quite ready to talk about the concept of the game quite yet, so let me instead focus on my other endeavors.
Before I even started working on this problem, I knew that ultimately the best option for reliably drawing seamless tiles is to allow drawing my TileMap code in the legion-based Canvas. There are a few issues with doing that, but all of them are solvable. However, because it wasn’t going to be an easy battle, I allowed myself to be distracted with the question, “but why is it so bad?”
See, I would expect some rounding errors with the approach I was using. By recomputing the x and y coordinates using floating point math for each tile independently, I’m reintroducing different rounding errors than if I had carried the existing result forward. The issue is that no matter what I did, there was also potentially two extra scaling functions that were going to be applied to the tile location. So, I expected some issues because floating-point math is kind of like running a copy of a document through a copier. It still is mostly good, but it starts to get a little more inaccurate each operation you perform.
But, to me what I was seeing was more than what I felt like those inaccuracies should add up to. I did legitimately identify two locations where I was improperly treating conversions from integer types to floating-point types before was absolutely necessary, and those did indeed tighten up the issues.
Unfortunately, I then continued to spin my wheels trying to continue to cover up the floating-point inaccuracies. Some attempts were close enough that they kept my hopes up, but ultimately, I’ve reached the point where I know tomorrow’s project: Add TileMap rendering support to the legion Canvas.
I finished off the night by launching 8 clients and recording the video at the top of the screen. I’m really happy with how things are shaping up. I’m still hoping to have some sort of multiplayer experience by the end of the month – just don’t expect anything too deep! My goal will be for something reliable and at least mildly entertaining, as #Devtober really is just a milestone along a much longer journey for me.
I hope everyone has a wonderful week!
The Honor Sagas
A 2d story-driven MMORPG with a resetting, player-driven story arc a-la Wheel of Time
More posts
- The Honor Sagas Devtober PostmortemNov 01, 2020
- Devtober Day 18: Almost to deploymentOct 19, 2020
- Devtober Day 12: Map Syncing + EditingOct 13, 2020
- Devtober Day 9: Introducing The Honor SagasOct 10, 2020
- Devtober Day 2: Starting procedural tilemap generationOct 03, 2020
- Devtober Day 1 - What is Untitled all about?Oct 02, 2020
Leave a comment
Log in with itch.io to leave a comment.