Most games that I spent a lot of time in are multiplayer games. I think it’s just amazing that you can enjoy a game toghether with friends. Because of this I was interested on making my own multiplayer games. For this someone has recommended Photon to me.
I’ve made a few project with Photon to learn how it works, and to learn what the best way possible is to get something to function through networking. I have worked with multiple versions of photon including Pun Classic, Pun2 and bolt. Sadly these are now depricated and due to a update on windows not all of my projects work anymore. Even though they may not work now it did learn me the fundaments of networking.
In the read more section I have listed a few of the projects I have made with Photon and the problems/solutions I had working with it. Currently I’m looking into other ways to make multiplayer work Like Mirror or Fishnet since they could be free alternatives. Though I’m tempted to just learn the new Photon versions.
Before beginning this project I started to research which type of networking would be the best for this kind of project. I eventually concluded that P2P would be the way to handle this, and with that I chose to learn Photon Bolt.
This game has equipment, weapons, abilities that all needed to be synced up. And also bosses that you would like to do the same thing on each screen. These were all challenges I needed to tackle in order for this project to work.
Luckily for the equipment and weapons it was easy, since I already had an inventory system the reference to what item it was, was already bound to an index. So I just had to send an index to set a different item to display them for other players.
Abilities were a bit different. I did have a index for what type it wasn’t just an visual thing. For example there is an ability that would create a healing ring around the user. I could just send information about that it was called and then only display it. But then the user will keep sending information to other players that they were healed. So I opted for a different option. I called it and then the function was split up depending on if you were the player owner or not. Now only the call was server sided. Each player would show the ring and the player could recieve the healing from that player on client side.
For the bosses It was once again a different story. Calling the attacks from the boss was simple since they could be done through the host. But that was only for simple targeted attacks. But not all of them are like that, some of them are randomized. For example one attack from the first boss was to make it rain fishes that would damage the player. And sending the location of each fish wouldn’t be optimized. So I opted to make a randomized algorithm. That way I could send a seed with the call and the algorithm would send out a randomized pattern for the game to use.
“Sadly this project doesn’t work anymore since the bolt version it was made in broke.
The gifs are taken from video’s made during the making of this project”
This was the first game I made custom character physics and networking combined, so I also had to create my own network sync up for the players to sort of show their correct location. I eventually settled on giving the location, direction, and velocity of each player. That way I could lerp the player towards the lcoation with the velocity combined to sort of predict where he should be.
Since this was a killing floor clone the game also needed ragdolls and most importantly gore. That also needed to sort of sync up, but I also didn’t want to create particles and keep the ragdoll data on the server. The way I handled it was by disabling the networking on the enemy the moment they died, while also sending the information of the killing blow. This way I knew how to apply the force on the enemy, while also delimbing the part that would be blown off.
This was a small project I did for myself. I wanted to make multiple simple board games that I could then play with my friends. It ended up only having 2 functional games.
The first one was Cards Against Humanity. It was something a played a lot around that time with my friends. So I wanted to make it inside of this small project. You could set up the room with different card packs, You could set the points needed to win and add black cards in which players could write their own prompt.
The other game was a game about writing a story. 1 player would be the voter. Each player would add a word that could be the next in the story. The voter would choose which word he liked the most and that would be added to the story.
This was the first school project that I used Photon Multiplayer on. It was a pvp firs person shooter around a warehouse. You can play it in teams or free for all. I was as on of the programmers responsible for the gameloop, weapons and the main networking.
One of the struggles I encountered with the gameloop was to sync up information for players that joined during a match. Or the time of a match not being correct for all players. The way I handled it by having the mindset of the host has the correct information. When someone joins that player will request the correct information from the host. And then the host of course provides that information.
For the weapons I tried to find a good way to play the sounds and show the particles to each player in a good manner. Because just instantiating a server object didn’t seem optimized. I eventually realized that I should really look at the core of what information is needed. So for the sounds it was: what sound, and where. With that I could reduce the information that needed to be send to a index of the sound and a vector3 for the location. For the particles it was the same but then also adding a direction for the impact direction.