Releases: Ethanm-0371/Networks_Project
Lights Out v.0.3
GitHub Repository
https://github.com/Ethanm-0371/Networks_Project
GitHub Release
https://github.com/Ethanm-0371/Networks_Project/releases/tag/v.0.3
List of Contributions
- Jonathan Cacay - xGauss05
- Ethan Martín - Ethanm-0371
Most of the work was done using pair programming, where both of us collaborated at a single workstation. This ensured that we could work together seamlessly on the same .cs scripts without facing problems related to merging code. Merging changes in Unity can sometimes create more problems than it solves, so working this way helped us avoid such problems.
- Implemented Pause Menu. In this screen you can Continue, Exit Server and Exit to Desktop.
- A brand new Level_2 and MainMenu screen.
- Fixed jitter/latency for client side.
- Implemented ping to server. When a client does not receive a pong from the server, client gets timeout.
- A bandwidth problem was solved. Packets that were more than 1024 bytes are sent in the next update.
- When a Client exits the game, its GameObject destroys and broadcasts it to all the players. If the Server exits the game, all clients will be timeout.
Instructions
- Make sure you create a server.
- Then, other clients should put the local host IP (127.0.0.1).
- WASD for movement Input. LMB to shoot.
- E to Open the door.
- ESC open Pause Screen. (only in Gameplay)
Main Scene to run in Unity
Scenes/Main_Menu
Some difficulties
- There's an error when trying to move before starting the game. The game receives an action packet in which there is no owner for it and a null exception occurs.
- There was a bug in which the players were spawning outside the safezone. It is currently fixed, but this took a lot of time to fix.
Lights Out v.0.2
GitHub Repository
https://github.com/Ethanm-0371/Networks_Project
GitHub Release
https://github.com/Ethanm-0371/Networks_Project/releases/tag/v.0.2
List of Contributions
- Jonathan Cacay - xGauss05
- Ethan Martín - Ethanm-0371
All of the work was done using pair programming, where both of us collaborated at a single workstation. This ensured that we could work together seamlessly on the same .cs scripts without facing problems related to merging code. Merging changes in Unity can sometimes create more problems than it solves, so working this way helped us avoid such problems.
- We implemented a passive state replication model, where every single NetObject sends their actions towards the server, gets acknowledged and broadcasts it to all clients but the sender.
- Shooting behavior from the player where we used Raycast in order to implement it. Also implemented a way to avoid the camera clipping through the objects.
- Zombie behavior using a behavior state machine (Idle & Chase). These zombies are killable and are managed through an EntityManager and spawned in ZombieSpawnPoint/ZombieSpawnRoom tagged empty GameObjects. We send the following: currentState, spawnPoint, isRoomZombie and currentHealth.
- These behaviors also have a Wrapper of their own to send the data to the server.
- An extraction zone (green area) that if all of the current players in the lobby are in, the level will be completed and everyone will return to the lobby.
Instructions
- Make sure you create a server.
- Then, other clients should put the local host IP (127.0.0.1).
- WASD for movement Input. LMB to shoot.
- B to Start the game (only the host).
Main Scene to run in Unity
Scenes/Main_Menu
Some difficulties
- In the shooting mechanic we wanted to implement for a third-person view, we encountered an issue. Our goal was to have the bullet originate from the gun’s muzzle and travel toward the crosshair in the center of the screen. However, if the player stood next to a column and the crosshair aimed at another column behind the character, the bullet would end up shooting backward. This created a logical inconsistency and resulted in unrealistic behavior.
- We encountered issues when trying to Destroy the GameObjects of the zombies. This led to a problem where, upon finishing a level, the zombies were not properly removed. Consequently, the client and server became unsynchronized, disrupting the correct functioning of the game.
- There's some slightly stuttering from the clients. Not the host. We aim to reduce this towards the last delivery.
Lights Out v.0.1
GitHub Repository
https://github.com/Ethanm-0371/Networks_Project
GitHub Release
https://github.com/Ethanm-0371/Networks_Project/releases/tag/v.0.1
List of Contributions
- Jonathan Cacay - xGauss05
- Ethan Martín - Ethanm-0371
All of the work was done using pair programming, where both of us collaborated at a single workstation. This ensured that we could work together seamlessly on the same .cs scripts without facing problems related to merging code. Merging changes in Unity can sometimes create more problems than it solves, so working this way helped us avoid such problems.
What we can say is who originally came up with the ideas.
For the things we done for the first delivery are the following (you can check the commits as well):
-
PacketHandler class, in charge of handling incoming and outgoing packets. Idea by Jonathan Cacay.
-
SceneHandler class, so that when the client has finished loading the static objects, would request the server for the dynamic objects. Idea by Ethan Martín.
-
NetObjectsHandler class, a script that handles the creation, update of the NetObjects. Idea by Jonathan Cacay.
-
Action-Based inputs, player behavior accepts keyboard inputs, but translates it into Actions. Idea by Ethan Martín.
-
Passive World State replication, users send their "Actions" and the server acknowledges it and broadcasts it back towards the other clients. Idea by Jonathan Cacay.
-
Wrappers namespace, a .cs script where all the Wrappers are located. Useful for sending stuff through the networks. Idea by Ethan Martín.
-
Game has a "GameClient" and a "GameServer". Normal clients have only GameClient while the host has GameClient and a GameServer. Idea by both.
Overall, our goal was to establish the foundation of the game. At the moment, we are transmitting all the information, but in the future, we aim to optimize this by sending only specific variable changes.
Instructions
- Make sure you do not have the Unity Editor with a server started.
- Make sure you create a server.
- Then, other clients should put the local host IP (127.0.0.1)
Main Scene to run in Unity
Scenes/Main_Menu
Some difficulties
We faced difficulties when trying to serialize a Dictionary, as both the key and value are needed to be included. The solution we found was to create a Serializable Wrapper class, "DictionaryEntryWrapper" which holds both the key and the value. Then, we created a list of DictionaryEntryWrapper objects, added all the dictionary entries to this list, and serialized the list. Then, deserialize back into a list with which we populate a dictionary on the receiving end.
Another issue we encountered was the difference in input frequency. A client with higher FPS would send more inputs to the network which sometimes caused data loss. To address this temporarily, we capped everyone’s FPS at 60 and turned off VSync.
Additionally, we faced a stuttering problem when updating positions across all clients. This was caused by a Coroutine that sent updates for all network objects every 0.2 seconds. As a temporary solution, we removed this delay to ensure smoother updates.