Category Archives: Development

Converting Chronoclysm to Online Multiplayer. It’s About Messages.

Games are information, a very specific type of information.

In traditional gameplay we don’t often think about how the information is relayed to the player. Players often don’t even realize that the information of the game is a meta idea that could be extracted from the activity they are doing.

For an example of this lets think about playing a game of chess. If you and your friend sat down to play a game across from each other you would only need one board and one set of chess pieces. You also wouldn’t need a method of communicating what state the board is in. With your friend right there they can simply look at the same information you are looking at and boom, both of you are looking at the same game state.

Now if you wanted to play chess with this same friend over a great distance we can appreciate the reality of the existence of the games meta information. Now there is still the challenge of playing a game of chess, but there is also the challenge of maintaining the game state for two separate boards and separate sets of pieces.

Moving a game from being local multiplayer to being online multiplayer is all about making that separation between the game state and game view.

The amount of information you send is very important. You could send for instance the position of every single chess piece each round. But that’s an exhausting amount of information and in a video game you are sending this information several dozen times a second. You need to only send important information. So don’t send the entire game state, just the changes.

The major difficulty with online multiplayer isn’t the actual networking of the computers together. Which is a tricky bit in its own right. It’s the abstract need to have the game rigidly defined enough to be encapsulated into messages. It’s hard to keep all of it organized.

Chronoclysm is a game about time paradoxes. Everything players do is recorded and played back. At first I thought this would be a really big boost to online networking, since I’m already logging every single action it couldn’t be that complicated right? Well it wasn’t as simple as I first thought.

A turn based game like chess obviously has several advantages when working with a messaging system. The biggest being the speed of the messages doesn’t completely determine the playability of the game. If it took 2 days to get you my move by mail we could still enjoy a long term chess game. Since the game is actually played in discreet steps.

The messaging complication in video games is better explained if we look at it like trying to turn soccer/football into a game played over distances. Where each player is miles away from each other, the information needs to be practically instantly sent to every player. Not just what each player is doing but done in such a way that the game actually stays in sync and all the information is updated enough to play smoothly.

That’s far more of a technical frustration. You need to structure the game so that it can be kept up to date. I’m a very large believer in code following the rules of physiology and biology. That is form follows function, your heart and lungs don’t conspire to push blood through your body. Due to their structure they can’t do anything else. The structure of the code should exist in such a way as to make message sending and receiving impossible to become unsynchronized.

Early on in Chronoclysm I ran into a bug because I didn’t do this when logging the actions. Since everything you do happens again I need to record all of the actions. When I first did it I made the process as follows: A character would go through the game and everything they did would be logged. So each time they hit a button or got hit by an object I played the action out and then recorded it.

That turned out to be a critical flaw in keeping the game synchronized in future rounds. It would never play out exact enough. There was constantly little things happening that were missed or the timing was poor. For a game that is about replaying the past over and over… it was a pretty big flaw.

The main problem was that the code itself wasn’t structured to ensure that things played out the same. There was a difference between recorded actions and live actions. The fix for this was simple. Instead of playing out the actions and then recording them to be played back later. I eliminated the first playing out of the actions. Instead all actions are logged as they happen and then played back instantly if they are new actions. This meant there was no longer two different ways for actions to happen, they happened the same if they were recorded or played back. You could spend your life trying to figure out why the actions didn’t play out the same, they should have as far as I could tell.

A rule of thumb is that the greater the number of parts, the more there is to go wrong. I eliminated the problem by reducing complexity, limiting the number of ways things played out.

Approaching online multiplayer is something very similar. You want to add structure to your game so that things communicate and stay in sync, because they can’t not.

We can start by figuring out what this sort of new structure looks like. First lets make the separation between game view and game state. Game view is what any one player see’s. Game state is what the actual game is. So one player could be playing chess with marble pieces and the other with wooden pieces. The pieces don’t need to look the same or be made of the same material, even though those are chess elements they aren’t important to the game state. The game state is purely the information that is critical to the game playing out the same way.

So the position on the board is important, but not the rotation of the piece on the board for instance. This is important to understand because we need to eliminate as much information as possible from the game state. The slimmer the messages the faster everything will go for the players.

Next we need to make it so that there is only 1 game state for all players. It’s a massive headache to try and synchronize game states across a network. It’s even harder if you are trying to agree on what actually happened. Think about a first person shooter where every single player is controlling the geometry locally. There is always lag across networks even if it’s small. One player might pull the trigger on their screen and register a hit. But due to lag the trigger pulling doesn’t register on the hit player until they have moved out of the way. There is now a discrepancy, did the hit happen? It technically did and didn’t, based on who’s game state you believe. A design that basically would guarantee desynchronization.

If we make it so that there is only 1 game state then it’s much simpler. This is often referred to as a client/server model. Where one central server provides information to the many clients.

It’s important to make a separation still between the game state on the server and the game view on the server. The server should not serve itself directly, it should have its own client. This again is for synchronization. If you have the server serving itself differently than the the clients there is more room for error. You are splitting something into more parts and that increases the entropy which increases the error rate. Of course a messaging system is more complex and also more prone to errors, but it’s absolutely necessary to online play so increase entropy as little as possible by making it as simple as possible.

This is where real world comparisons kind of start to fall by the wayside. Our game state should really only exist as an abstract concept. No physical form at all. It would be like having a game of chess where both boards and pieces existed. But the idea of the game being played was in a different dimension, the pieces layout has no form just information. You should have as many clients as there are players and the number of servers as there are games (one).

What needs to go into the game state and the game view is absolutely dependent on what the game is. If chess utilized the rotation of the pieces for instance it would be important to send that information, but it doesn’t so it isn’t. There is no rule for what is important, it’s contextual to the game state you are following.

Before even being able to send messages across a network you need to be able to break your game down into messages. I’m taking the approach of decoupling of the game state and game view. This means that things like collisions and the reaction to collisions don’t happen in line.

This would be pseudo example of tight coupling of the game state and view:

public void ExplodeBomb()
{
     Animation.SetBoolean(“Exploded”,true);
     Collisions[] effectedbyexplosion = PhysicsEngine.GetCollisionsInCircle(Position,Radius);
     for(int i = 0; i < effectedbyexplosion.Length;++i)
     {
         effectedbyexplosion[i].TakeDamage();
         if(effectedbyexplosion[i].Health <= 0f)
         {
             Destroy(effectedbyexplosion[i]);
         }
     }
}

At the same time we find the entities effected by the explosion we also tell them to take damage. Afterwards we check to see if their health is below 0 and destroy them.

So we have taken the concept of a bomb explosion and tied it directly with damage and character death. What happens if we have another type of explosion? Or how do we handle other types of damage? Maybe we just write the same code in those functions too, it would work. It’s just tightly coupled.

In the above code if we made that run on a network we would have to make sure each computer co-ordinated their explosion the same and hit the same objects. Also all at the same time. It’s an exercise in madness.

Instead we can decouple things. Do something like this pseudo code:

public void ExplodeBomb()
{
     Animation.SetBoolean(“Exploded”,true);
}

public void HandleBombCollision()
{
     Collisions[] effectedbyexplosion = PhysicsEngine.GetCollisionsInCircle(Position,Radius);
     for(int i = 0; i < effectedbyexplosion.Length;++i)
     {
         GameMessengerService.HandleCollision(effectedbyexplosion[i].id,this.id);
     }
}

//In the game object class
public void HandleCollision(int collidingid,CollsionTypes col)
{
    if(col == CollsionTypes.Explosion)
    {
        TakeDamage(6);
    }
}

public void TakeDamage(int amnt)
{
    Health -= amnt;
    if(Health <= 0)
    {
        GameMessengerService.HandleDestruction(id);
    }
}

public void HandleDestruction()
{
    Destroy(this);
}

While making it a lot more complicated we have also gone ahead and allowed there to be messengers in the process. So instead of having all the clients handle whether the bomb collided or not. Only the server decides if the collision actually happened. While we also make it so the animation is separate so that all of the clients can call it without affecting the game state. If one of the explosions on one of the clients lags they will just have a small visual issue. The game itself will retain its integrity.

Also inserted a message between damage and death. They are very similar but because a character might not die when they get damaged and there might be other reasons to deactivate a character. We will make them separate messages. So if the character dies we send out a message to destroy them. This was the clients all know when they died at the exact same time. Keeping congruence.

That’s the idea behind tight and loose coupling. Do you have two lego’s that come together to make one bigger structure? Or are your lego’s glued together so they are now one inseparable piece. Both have advantages. The glued one breaks less when you drop it, but good luck changing it in any way. To make a game work over a network you’ll need to break it up a lot more so everyone knows how to build the legos the same.

Of course it’s a fine line, if you break your legos down into atoms so you can mold them into any shape… well that’s certainly more decoupled. But you also are going to be spending an eternity just making 1 brick. It’s balancing the two that’s important.

The rest of converting Chronoclysm is going to involve going through the entire game and decoupling the game state and view. Which is the first step and it’s going fairly well thus far. I’m writing this because I think I finally have it mostly figured out. Once I have it decoupled I need to do the actual networking with sockets and stuff. Which is going to be a different bag of fun but shouldn’t be too hard since steam offers a lot of help.

Then there will be integration of a lobby system so that you can find people to play with. Which is similar to the other networking things but it’s a separate design challenge in its own right. I’m going to start dev logging more of this stuff, mostly because I find it absolutely fascinating and want to share.

I’m also available if you want to talk about converting your own project. I’m happy to offer any guidance or assistance. Happy gaming!
-Shane

8Bit Boating For Conversation Trading

Ok so this is going to be more related to You’re Invited than it might seem.

However I have run into a bit of a snag with conceptualizing the game. See in the game you watch people talk. During the conversations you can click on different bits of it to record it to use for later. This means that in order to complete the game the player will need to pay close attention to the things people say. Along with what people say there is what is ACTUALLY going on. This is what you want to know. You have to figure out what is going on by watching what others say and using that to get at the real bit of information.

I can imagine it like a map, each character having dominion over a certain bit of area. You want to get at their area but they may not want you to go near certain things. They want to control the access you get. So in order to get information you have to use information. This is essentially trading, trading is just path navigation.

So I understand conceptually what all of these things are but I’ve never built anything around trade. Let alone trading esoteric concepts. I can’t seem to envision how the player will use the information step by step to win the game. I have a lot of ideas but I think developing an isolated trading game may give me something to study and understand.

When I was younger I used to go to as summer camp. One of the leaders invented a game he called “pirates”. Around the camp leaders set up trading posts. Your cabin was to go between various trading posts trading goods. Finding which goods sold for what where. Along the way other cabins were pirates. they got money by robbing others and dealing in black market goods. However they were in turn hassled by a third type of cabin/ship the navy. The navy confiscated goods and gold from pirates. As well though they could confiscate black market goods from merchants. The point of the game was to find which cabin at the end of the game time had the most money.

This is a fine little example of trade. All sorts of multi layered concepts. A few different types of exchange and a nice understandable theme. I’m hoping by making a little game around this concept I can make a sort of ant farm type thing to view trade.

First off I needed a map. I get caught up on things like this and a static map wasn’t going to do. I wanted something that would create interesting trade routes that were constantly different each time. In order to do this I started with a concept based on the game of life

Here is a gif of the process in action
Island

Each bit of water and land are switching between water and land based on a set of rules. The water has simple rules. Only if it has 0 neighbors does it switch to land.

Water

On the other hand the land is a bit more complex. It will dissolve if it has less than 3 neighbors. More than 3 it stays. However at 3 there is a 1:300 chance that the tile will flip to water. This little difference makes a massive difference when it comes to the variety of islands. Once I added in the little bit of code on #3 the maps become very interesting.

Land

Once that is done there is a process of placing merchants. This has a more complex series of rules that require a number of merchants be also on the same body of water. No merchant can be a minimum distance. In order for an island to have more than one merchant it must meet a number of resources.

The resources are basic staple resources. Here they are ripped from the sprite sheet
resources

In order as they appear. Ore, Wood, Food, Wool, Stone, Spice, Wine.

The rarity order however is Food 13/146, Wood 8/146, Stone 5/146, Wool 3/146, Ore 2/146, Spice 1/146, Wine 1/146.

Using Fibonacci’s sequence in order to get a good covering of the rating. There are also Villages, Blacksmiths and Castles. Villages consume things in order with rarity. Castles consume more luxury goods and blacksmiths consume more wood, and ore. Each settlement gives money back as well to the port. The total collection of resources and settlements defines what goods a port has. If a port runs negative it simply indicates high demand. If they run positive it means a surplus. In this way there will be some ports with no settlements that will have a lot of goods for sale, and in the opposite way some will need to accept a lot more goods because they have settlements.

From this start I hope to build up a version of the camp version of pirates. Replacing some of the game functions that exist for a group of campers. Combat will be simple. Pirate and navy ships will have canons but they will only disrupt movement. When 2 ships catch each other combat is done based on rock paper scissors. Giving caught ships a chance to get away again to represent a victory. As well the ports goods are going to be based off of created demand. A bit of tweaking should allow a functioning economy to develop. I’m hoping to give the ships some learning / ant AI so that they can show how they go about establishing trade routes.

The end intention being to create a bit simpler but more abstract version of trade to represent secrets and conversation analysis. Allowing people to feel like they are navigating unseen trade routes through conversation.

The next step is pathing, like conversation is a path through ideas a trade route has a more literal path to navigate. The boat has a pretty nifty movement. Indeed I have actually spent a lot of time just enjoying navigating the little boat. I make it so that it constantly diverts any momentum into forward momentum. If the boat tries to move against its axis then it will resist more than if it moves forward. This gives the boat a pretty unique water feel, although it moves like a motor boat but meh.

Here is where I would put a HTML5 unity build but I’m broke as shit and can’t afford the licence. Instead here is a video of me being bad at boating. (yes that is the slightest plea for attention to my lonely donate button, I DON’T KNOW HOW TO ASK FOR MONEY!).

I will likely post the full code at some point for others education and enjoyment.

A Dev Blog… Of Course!

My mind fascinates me at times. So incredibly capable at problem solving and calculation. Intuition, pattern recognition. It’s an astounding instrument. Yet over and over I will be left speechless at my minds inability to put together simple concepts. Overlooking small details until I’m essentially hit in the face by something I’m sure most people would have noticed. This results in me leaving most cupboard doors open until I realize that almost all of the cupboard doors have been opened throughout the day. Unable to catch simple spelling mistakes and occasionally maddening program issues caused by a very small detail Lik dis

That was a pretty nutty error until I realized the semi colon at the end of the if statement :/ it was only giving a warning which I was flat out ignoring like a dingus. Anyways that’s what I mean. My mind is very very smart and very stupid sometimes. I’ve been racking my brain trying to figure out how to interact with an audience more. A member of reddit inquired if I had a dev blog. And I suddenly had to ask myself why in the fucking hell I didn’t. I’ve been trying to think of something to maintain updates and interact with an audience. I have an entire website with a blog engine. What the hell is wrong with me? Well besides the mental illness?

Anyways because I can I think I will go an back date some shit because I have a lot of half saved stuff and enough content to flesh out a dev blog retroactively.

You’re Invited

I invited myself to a game jam a few weeks ago. I had heard through a friend through a friend about a game jam as part of research study. The study centers around the dynamics of developing a auto-pathological game (aka a game about your experiences with an illness). The specific illness variety it deals with is mental.

YoureInvited

As I started Triggered as a way to gameatize my mental illness I emailed the creator and asked if I could participate. She was enthusiastic about having me and “You’re Invited” was born. Triggered focuses on the entire story of my mental illness. It is a massive undertaking of the entire emotional history that I’ve gone through. On the other hand a game jam is quite a bit shorter than something like that and I needed a concept I could hope to even come close to finishing. There was no competition so how hard you pushed yourself was up to you. Being me I pushed myself so hard I made a lot of stupid mistakes and kinda had a shitty weekend outside of the jam. Inside the jam it was slammin and very refreshing to develop around humans again. I met some cool people but was also shown how paralyzed I become because of my problems with scripting.

Scripting is the concept where in people create sequences of expected behaviors in order to interact. When you go get a coffee there is an expectation for the cashier to begin, followed by the customer. A certain amount of small chat is polite, an extended amount is allowed but not entirely desired and anything that extends the script is then a violation of the script. We get pissed when people do not adhere to them and we get really weirded out when people do not know how to follow them. They exist because social interactions are laborious. If we have to figure out how to interact with everything all over again every time we would never get anywhere. So people use scripts.

I am terrified of social interactions going poorly. That hot impending danger feeling boils up in the room. Everything physiologically about me changes. I go into a complete panic. However any hint what so ever of the panic can lead to more problems. People took advantage of these overwhelmed states when I was younger, when I was so scared, confused and embarrassed I didn’t know what to do. People recognize that as an opportunity for amusement, the psychological problems of one individual are merely an amusing curiosity to others. When I became overwhelmed it was important to keep composure. These two concepts blend together into massive scripting issues. I am very very very aware of scripting. I solve my scripts to an absurd degree, I essentially do not understand what “socializing” is if it isn’t based on a script. I let very few people close enough to be unscripted around.

I once worked for this gentleman named Rob. He was a good fellow and very analytical, you could always see his eyes working on a thought when he was talking to you. People like this scare the shit out of me because I have to spend so much time scripting for them. They don’t give a lot of information but they are obviously processing it. I can distinctly remember finishing up my work early and trying to tell him I needed another task. I was terrified to email him, there were too many unknowns. I couldn’t trust that he wouldn’t blind side me with something I couldn’t handle. I remember trembling and just being endlessly confused at why I could not convince my fingers to move. I literally just fucked around for an hour because I was too scared to tell my boss I was done a task early. At the time I had no idea I had mental health issues. To very much prove my fears right I ran my mouth one day and I can clearly remember seeing it click in Rob’s face. He looked dead at me and I knew right then I was fired. I played stupid but I saw it. I basically described some of the work habits I had because of being mentally ill, not connecting it with mental illness I was thrown pretty swiftly out on my ass. I was really really shaken up by it. I still have weird violation feelings because I had really sorta trusted them, that was one of the last times I considered myself to have “friends”. Learning that someone could just fire you and remove not only your income but your social network was disturbing. Without the lubricant of work I couldn’t maintain social relationships. My new workplace was colder, I was jaded and not interested in getting to know more “friends” bosses who will end all contact if you don’t perform. It was these experiences that led me to discovering I was mentally ill. The issues I experienced massively centered around my various problems around exhaustive scripting.

You’re Invited is a game about conversation monitoring and scripting. The vehicle for this is a Murder Mystery Dinner. Under the pretense that the player has accepted a random invitation to participate in a murder mystery. They are given the role of the detective. During the night each player has a set of information they need to relay to certain people as well as a number of tasks to complete. The detective has no information to give but instead is tasked with collecting the information, informed that there is a plot for one of the characters to be assassinated he must figure out who and stop it if he can, if not he must find the culprit.

When the player arrives at the dinner its revealed that there is a bit more going on beyond a fun night of murder mystery improv. The host of the evening is not intending for anyone to actually leave alive. He has invited 8 strangers to a dinner in order to play a game. As the detective you are tasked with both solving the murder mystery and finding out which of the characters actually intends to murder everyone. As further complications you are informed that you can’t let anyone know you know this or the game ends immediately (this is backed up). Even further complicating it you are told that other guests may have been given sub tasks as well (In total 1 guest is the player, 1 is the potential killer, 2 are also sub players, the remaining 5 think its a super awesome random murder mystery dinner).

This sets up the dynamic I need to show how intense I find conversations with people. In order to proceed and talk to anyone you want to be very careful not to give bits of information but you need to proceed through expected interactions and get the things done that are required of you. All while maintaining a constant idea that you are the only one so worried about everything and you just wish you could talk about the danger you feel. But talking about the danger makes it real.

Triggered: Contraption Creator

Triggered is an art experiment I am undertaking to translate my experiences with mental illness into game design. I attempted to raise fund to develop it and am still doing just that. My first attempt at a hail Mary crowd funding effort didn’t go well. But with good reason, it was a long shot. I had very little show, and not much beyond my words.

So I don’t want to begin developing the narrative side until I understand my funding and situation better. I need more money or the narrative is going to suffer due to the erraticness of my behavior during poverty. I have a hard time doing certain things when I am exhausted because I am afraid of the noose of poverty closing around my neck. I despise the effect money has on art and I refuse to compromise Triggered to get paid. Not because of anything beyond I want Triggered to not give off finance vibes and if I use it as a finance vehicle it will.

In order to compromise I am willing to develop a portion of Triggered into a free to play sort of game / play thing. Triggered is about interacting with a world that has observable rules and limits. While privately dealing with things that seem to have undefinable rules and unobservable limits. To starkly draw this comparison I want to give most of the functions of the world of Triggered a very accessible and real feeling. Instead of having just an elevator the elevators in triggered will be made of sub components. That are seen over and over and understood. Weaving throughout the world a sort of established mechanical reality. That these things function like expected when arranged. It’s easy to see and easy to accept as a reality.

With this in mind I came up with the idea to have a contraption creator. This is drawing heavily on games and programs in the past that I have willingly paid for. Minecraft and the Fantastic Contraption are both games that I shelled out money for to expand my experience on the game. They both offered decent free experiences but I decided to volunteer money because I enjoyed the concepts so much (to be all hipster about it I bought minecraft in alpha).

The contraption creator then seeks to make those underlying mechanics accessible to people but in a format that captures some of the things I enjoyed about those other games. Of course I don’t think you can build a contraption creator idea without also being influenced by The Incredible Machine. Which just through my entire life has plagued my ideas for game design. I spent too much time in my child hood building things. Anyways I’ve come up with nearly 120 individual parts that go Together. And made is accessible to people. These videos are through varying dates so forgive the different looks. These are all just me messing around and hitting record. If I’ve somehow offended you by borrowing and or forgetting to credit people, I’m sorry.

Lasers

Lasers are activated by logical components. When they are on they shoot a ray of light forward. At the end of this ray of light a burst of light is found. The ray of light can interact with several different things. If it hits things that can be heated it will heat them based on the intensity of the light. If it hits mirrors or mirror balls it will reflect. There is a separate logical component that represents a Gel filter that will change the color or the lasers.

The gel filters work by blocking out different colors. Here is an example of it.
PEW PEW

There are lumospheres which get charged and grow brighter and brighter as the laser shoots it. Providing light
Lumosphere

Also laser orbs are bouncing balls of light that will change their color when hit by a laser. There are laser orb dockers that will turn on when they get an orb of the appropriate color. Here is Simon standing underwater with one.
Green Orbssss

There are prisms that don’t quite work like real prisms but close enough for what I need
Prism

This is a comparison between the early laser and the current laser.

Old

New

Logical Components

There are several different systems at work in triggered. In the same manner that the laser above interacts with certain parts. There are logical parts that work together.

Those are music boxes that are tuned to different notes. Being activated as toggle switches turn on and off. The binary numbers display what state the switches are in. Using an increasing amount of toggle counters and a timed repeater you can move through a sequence. Here is that concept displayed using toggle switches and other logical components.

The logical components support basic binary logic functions. XOR, OR, AND, NOT, and some other toggle like binary functions as well.

The important part is that they work on input / output propagation. So any output can be plugged into any input. This means that the limitations to the functions are as limited as one can rearrange a near infinite number of 1’s and 0’s.

There are several sub systems that interact with the logic system. Taking advantage of the ability to wire things together. There is a music player that allows you to play sounds and change noise, pitch and volume. All functions are controlled by logical inputs. Allowing complicated music boxes to be constructed. There is a pinball bumper that sends a signal when it is struck. This means it can be used to play a sound effect for instance. While another bumper may pitch the sound.

Early Kinetic Music Box

Recently added a camera object. It interacts with the logic so when it receives an on signal the camera moves focus. Allowing monitoring and recording of complex Rube Goldberg Machines.