HomeResuméContactBlog

Markus Wyrin

C# Unity Online Multiplayer Game

C# Unity Online Multiplayer Game

  1. What this project is
  2. Technology used
  3. Current features
  4. Art assets
  5. Technical challenges

What is this project?

This is a complex ongoing project that is in early prototype stages. At its core this is an online multiplayer survival game with PVE and PVP combat, looting and exploration.

I am the sole software engineer working on the technical side of this project. I get some help on art direction and project management from my friend and business partner.

Release date is unknown, and this project is not yet officially announced anywhere else.

Technology used

All code for this project is written in C#, .NET framework. The game engine used is Unity , on top of this various packages and APIs are used to complete the setup. Server hosting is currently done at home for play testing, but this will be moved to a cloud service closer to launch.

Currently implemented features

User authentication

All users must register an account to play. This is handled through a custom C# API that handles the logic. Users can register accounts, and these are stored in the database. Login works and is required in order to authenticate and connect to a game server.

Persistent user data

Information such as player location, display name etc are stored in the cloud. These are persistent across play sessions and are stored on each user account.

Play together online

Multiple players can join one game world together. Currently it is set up to only use one server, but this would be easily scaled up in the future. All actions are handled by the server and then displayed to other users. We are using FishNet to simplify the netcode, this however does not mean it is automatically multiplayer. A lot of custom logic needs to be implemented for it to work well.

Enemy AI

Zombies are implemented although currently somewhat limited in functionality. Zombies do target the nearest player within a certain radius. The Zombies do avoid obstacles and take the shortest path to the player. This logic is handled on the server.

Zombies take different amounts of damage depending on where they are hit. The location they are hit is saved and sent to nearby clients for feedback. Upon death Zombies fall to the ground and enter a "ragdoll" state.

Ragdoll physics are calculated client side only, this is done for performance reasons. Ragdolls are not affected by physics objects like the player.

Inventory

Each player has an inventory that is divided into slots. In the inventory there is a tab for crafting. This does work in its current form however this is in progress. This does not yet persist on the users account, the items are lost upon disconnecting, this will soon be fixed.

Art assets

Weapons

This grenade was modeled in Blender. The texture is a mix of hand painted and clever use of smart materials in Substance painter

3D low-poly Model of a grenade made for a videogame

This is the same model imported into the game engine.

Grenade rendered in Unity game engine

Here is another weapon added early in development, a kitchen knife.

In game screenshot of prototype knife

This is an early screenshot while holding the knife. The weapon is fully functional and has a stabbing animation which damages zombies as well as other players.

Indoors alpha screenshot of survival game

Nature

This is something we found difficult to get right. Improving this is currently a big focus art wise.

In game screenshot in unity outdoors nature

Tree game asset in blender

Technical challenges

Online Multiplayer

In the making of this project many challenges have come up. One major thing is underestimating the difficulty of writing net code. FishNet does help, but is definitely not a plug and play solution. Careful considerations have been made on what should be handled by the server, client, or both. The fact that this game is multiplayer alone more than doubles the complexion of the code.

Play testing

Since this game is not meant to be played solo, play testing with other players has been very valuable. Often times new bugs show up when doing so.

Performance

One of the goals for this game is having large amounts of enemies on screen at once. To achieve this the enemies are purposefully kept both visually and logically simple. Zombies are handled server side and do not have a big performance impact for clients, however one limitation currently is that enemies are calculated on a single CPU core. This needs to be optimized in the future.

Copyright © 2023 Markus Wyrin.