Saturday 28 March 2015

Game Update : The terror of testing.

Today was a great day for my video game project.

After numerous and exhausting weeks of testing, debugging, more testing and even more debugging, the three of us in the dev team launched a three-player game session.  It's a pretty big deal because we normally test multi-player in a two-player environment and, most of the time, we just run the game in single-player just to test out basic functions.  The last time we had three players, it was back in January when we were testing out latency and the chat...  that's all we could do because that's all there was.

This time, it was different.  Since my last blog entry, I've been working on implementing the dungeon generator into my multi-player build (which, before then, those two aspects have been isolated from one another).  So the game was able to construct a simple world, send it to other clients and now I was putting it to the task of generating elaborate dungeon(s) and hope that all clients wouldn't simply blow up from the load.  Sure, the program's been through testing...  but I didn't plan this three-player session and that terrified me.  I wasn't ready emotionally to see my baby potentially fail.


Player characters currently have crude (almost minecraft-looking) placeholder bodies.  Those bodies couldn't have looked more real for that particular moment when I saw two "beings" spawn in front of me, with their sphere-like heads spinning; looking about their new environment.  That moment was promptly followed by us moving around, jumping, chatting...  you know, to make sure that everything checked out okay.  We even went as far as trying to push each other, see if we'd get stuck in geometry, fall through the world, etc.

That is, until we found an entrance to a random cave.  We almost froze at the sight because we knew that, if one of us went through that entrance, it would procedurally generate a completely new and unexplored area... or crash miserably... or nothing at all!  It's one thing to spawn into someone else's procedurally generated environment, but it's an entirely different thing to move and load into a completely different area.  There were hundreds of ways that it could've gone wrong.  You start to doubt yourself and think about things like:
- What happens if the host doesn't go through the entrance but, instead, another player goes in first?  Does it load properly?
- What happens if two players decide to go through the entrance at the same time?  Do we get two radically different copies of the "same" cave?

Well I've been coding in such as way that take these questions into consideration but you don't really know until you try them out and see for yourself.  I mean,
- What happens if all three players go through the entrance, one client is generating the dungeon (while the others are waiting to receive the info) but crashes midway.  Are all players stuck in limbo?
- What happens if one client fails to properly load the dungeon?

That's some scary stuff!
So one guy charges through the entrance, we held our breath and the rest of us followed.  Here we were, three guys finding ourselves inside this cave.

- "This rock!"  I cried while jumping/pointing at the ground "Does everybody see this rock?  Please tell me you see this rock!"

For the next couple of minutes, we were comparing notes to see if we were indeed seeing the same thing.  We were and eventually we ended up wondering around aimlessly in our separate ways.  One guy found another entrance to go deeper into the cave, the other started climbing the walls to see how far up he could go.  It was at around that time that all terror evaporated from me and the funny thing is that I realized that finding each other in these labyrinths would be pretty hard.  We had no map, no way of knowing where each of us were and there's practically no limit to how deep into a dungeon you can go.

Remember my previous blog about generating the world?
That's the overworld, we were inside one of those squares; three or four levels deep inside a cave... and we were lost.

For the sake of testing out physics and combat damage (you know, for what would eventually be bows/arrows and spells), I had implemented a very crude way for each player to shoot projectiles. So, obviously, our next step was to engage each other in some form of first-person-shooter style free-for-all hunt.  It took a while to find each other but the mayhem that followed once we did was hilarious. One funny moment that I can recall was that I pulled a "Fargoth" without really being conscious about it.  Caves were dark and I wanted to know where I was going so I pulled out my torch and it didn't occur to me that I was making myself an easier target.

There were tons of bugs, some projectiles were stuck in midair, other projectiles were cancelling each other and players were re-spawning in really odd places.  Some players found out he lost the ability to climb walls.  Overall, though, the infrastructure of being inside the game world was working beautifully.

We had a blast; it was a magical moment for us and the game and, in the end, a successful test.