Venturers


Dev time: 5 Months

Team: 1 Artist & 1 Developer (me!)

Summary


Ventures is an immersive Unity and Netcode-powered multiplayer RPG offering a realm where quests, camaraderie, and character growth flourish. As you embark on explorations and forge alliances, my role is centred on meticulously shaping the game's foundational architecture and leveraging Unity's Netcode for seamless multiplayer dynamics.

As the game's developer, I intricately craft the systems that underpin Ventures' core functionality. I utilize Unity's Netcode for gameobjects, enabling fluid player interactions that elevate the multiplayer experience. Beyond this, I extend my reach to construct a comprehensive website and a meticulously designed database—a strategic masterpiece orchestrating progression.

Filters

What I did


The goal

Driven by a thirst for knowledge, I embarked on a journey to master server authorization. My goal: safeguarding player data on a secure database. This exploration fortified data integrity and taught me how to orchestrate seamless exchanges between server and database. Through this process I learned to manage critical gameplay elements like inventory, quests, and attack damage, creating a fair and fortified gaming environment. This hands-on experience has not only deepened my understanding but also empowered me to craft enriched and secure game worlds.

The goal

I aimed to build a website that allowed players to sign up and log in, granting access to the immersive game world of "Venturers." Additionally, I designed a player spawning system tied to a character database, ensuring that each player's unique character data would seamlessly come to life as they entered the game.

How it works

Players register on the website and create accounts. In the game, a login request is sent to the site's server to verify credentials. If successful, character data is fetched from the database and integrated into the game. If data is missing, players customize their character. As players play, the server tracks progress and updates the database. When players disconnect, their data is securely stored on the server and sent to the database.

PHP

PHP stands as the website's backbone, operating as an API to facilitate async calls from C#. It swiftly processes requests, sending back data or codes to ensure a reliable connection between players and the server. Security is paramount, with PHP authorizing server actions. Players receive targeted callbacks with necessary data, streamlining their experience. PHP's versatile role orchestrates a seamless and secure gaming environment in "Venturers".

Project Image

Player Login (Client)

Player login process involves several steps to ensure a smooth and secure experience.

On the client side, the player initiates a login attempt. If successful, they gain access to connect with the server. The "HandleLogin" function plays a crucial role by validating the account on the website. If the website verification returns a success, essential data such as basic player information, result codes, character type, and body type are sent back.

In cases where character or body type data is absent, the player is directed to a character selection screen to create their persona. On the other hand, if data is present, the login screen for server access is displayed.

Upon attempting to log in to the server, the player's credentials are sent for verification. If correct, the player gains entry and their complete player data is retrieved. This comprehensive data encompasses all pertinent details required for their in-game journey.

The final step involves spawning the player within the game world. Armed with accurate and verified credentials, the player is seamlessly integrated into the virtual environment, ready to embark on their adventure.

Link to part of the code

Player Login (Server)

When a player initiates a connection request to join the game server, the request undergoes an approval check. This check involves assessing whether the server has available slots for new players. If the server's player count hasn't reached the maximum capacity (in this case, up to 4 players), the request advances to the next stage.

Upon successful approval, the server decodes the incoming payload, which contains the player's login information. The server then sends an authentication request to an external server using the decoded data. If the authentication response indicates a valid login (with a response code of 1), the server proceeds and checks if the player isn't already connected. If the player isn't online, the server fetches detailed character data by querying a designated URL with the player's ID.

With the character data, the server determines the player's character type and body type based on the received information. Depending on these attributes, the server makes an informed decision regarding connection approval.

When the character type and body type align with the game's criteria, the player's connection is approved. Furthermore, specific parameters are set such as the player's spawn position, rotation and prefab type. At this point in time, the player's location and rotation are saved in the database, however it isn't loaded in to prevent bugs with player location. First, we wanted to make sure everything else was working correctly and if a player fell through an object, it would be simple to just rejoin the game.

Link to part of the code

The goal

My goal was to create an expansive and dynamic quest system that seamlessly connects with the server. This system needed to be easily expandable, allowing for the creation of multiple quests while ensuring that players stay updated on their progress. By utilizing Scriptable Objects, my aim was to empower designers and myself to effortlessly craft diverse quests. Furthermore, I aimed to securely store quest data in a database, enabling players to resume and complete their quests at their convenience, contributing to an immersive and continuous gaming experience.

How it works

The quest system and server work hand in hand. When players join, the server sends them available quests. Once a quest is activated, the server tracks progress and updates players only when significant actions occur. This efficient approach keeps players informed and engaged without overwhelming them with constant updates.

Project Image

Quest base

The "Quest" class is the foundational structure that empowers the creation and management of quests within our game. It streamlines the process of constructing quests, defining their objectives, rewards, and even follow-up quests.

At its core, the "Quest" class serves as a versatile container. It encapsulates various essential attributes such as a unique Quest ID, a descriptive name, and a detailed description that paints a vivid picture of the quest's purpose. By utilizing a simple and intuitive array structure, the class enables the seamless addition of goals, making it straightforward to set objectives for the player to accomplish.

Each quest is constructed with specific objectives, represented by the "Goal" class, which can range from defeating foes to collecting items. The "Quest" class inherently understands and monitors these objectives, effortlessly tracking player progress toward completion.

Upon fulfilling the quest's prerequisites, players are rewarded with experience points and, potentially, items that enhance their in-game journey. Additionally, the class offers the fascinating capability of linking quests together, creating a narrative chain. This linkage allows follow-up quests to be automatically triggered upon quest completion, ushering players seamlessly through a captivating progression..

Link to part of the code

Project Image

Quest goals

The Goal base class is the foundation for creating various objectives within a game. It provides fundamental attributes and methods to track player progress and determine when goals are achieved. Each individual Goal instance represents a specific task or achievement that players work towards. These goals can be linked to a Quest and populate the goals of the quest.

Below you will find an example of the goals!

Link to base class

Link to gather goal

Link to input goal

Link to kill goal

Link to shrine goal

Project Image

Quest manager (client)

The QuestManagerClient class oversees quest-related activities on the client side, utilizing Unity Netcode. It manages quest tracking, activation, and completion for the player character most of it only being UI the actual tracking of quests is handled by the server. Key functionalities include:

Initialization and Ownership Check:
Determines if the game object is a client and the owner of the Netcode object to initialize or remove unnecessary components.

Quest Tracking and Display:
Dynamically creates and updates UI elements for quests based on the player's progress and active quests.

Quest Activation and Interaction:
Handles setting up active quests, receiving new quests, and managing associated UI elements and tooltips.

Quest Completion and Cleanup:
Manages completed quests, updates game elements, and handles quest cleanup.

Quest Finish and Conclusion:
Handles overall quest completion, relocating the player and showing a finish screen UI.

The class operates without a traditional update loop because Unity Netcode's synchronization mechanisms handle data synchronization across clients and the server. This ensures consistent quest tracking and management in a multiplayer environment.

Link to quest manager client

Project Image

Quest manager (server)

The quest manager server plays a pivotal role in the game's questing system, tracking players' active quests and ensuring data accuracy. All quest operations occur on the server side, minimizing the risk of exploitation. Key features of the code include:

Activating Quests:
The server activates quests for players, preventing duplicate quest completions.

Saving Quest Data:
Quest progress is saved in the database, allowing players to resume their journey seamlessly.

Managing Active Quests:
Active quests are managed, ensuring proper data representation and synchronization.

Completing Quests:
Server verifies quest completion, preventing unauthorized quest advancement.

Security Measures:
Server-centric design enhances security, preventing fraudulent manipulation.

Handling Completed Quests:
Completed quests are saved and retrieved, ensuring accurate quest history.

Available Quests:
Server stores available quests, safeguarding against data loss.

Client Communication:
Communication between server and client ensures accurate quest updates.

By meticulously managing quest data and progression, the server creates a reliable and secure environment, promoting fair gameplay and genuine accomplishments for players.

Link to quest manager server

The goal

To create a dynamic game with scalable attributes, player experience (exp) and health will increase as they progress through various levels. For example, leveling up could require 200 exp initially and then increase to 320 for the next level. To ensure fair distribution of experience points, the game's server will oversee and calibrate the allocation of exp for all players. This will ensure impartiality and equity across the player base.

How it works

In essence, the server is the invisible hand guiding your journey. It calculates, adjusts, and safeguards the various elements to your gaming experience. Every action is captured by the server and the server makes sure it is valid. This system-side orchestration ensures that you're immersed in a world where your efforts are rewarded, your character evolves, and your interactions with the game are always underpinned by fairness and security.

Project Image

Exp

This server-sided code manages player levels, experience (exp) gain, and leveling up in a game. The server calculates the required exp based on the player's current level. When players gain exp, the server tracks their progress and automatically triggers level-ups when exp thresholds are reached. This avoids constant updates.

Key features:
Server-Sided Operation:
The entire code runs on the server, ensuring control over player progression and data handling.

Exp and Level Calculation:
The server calculates the amount of exp needed for each level based on a base value and an exponent. This scaling system ensures that higher levels require more exp.

Exp Gain and Level-Up:
When players gain exp, the server updates their current exp and automatically triggers level-ups when exp thresholds are met. Level-ups reset the exp and increase the player's level.

Minimized Updates:
Instead of constant updates, the server sends data only when players gain exp or level up. This efficient approach reduces unnecessary communication.

By managing exp, levels, and updates server-sided, this code creates a seamless and controlled gaming experience, allowing players to progress and level up naturally while maintaining fairness and performance.

Link to EXP manager server

Project Image

Health

This server-side code effectively handles player health, damage, and respawning. It ensures accurate health tracking and seamless gameplay.

Key Features:
Server-Side Precision:
Entirely server-side, providing precise control over player health.

Health and Damage:
Manages health calculations and accurately applies damage.

Responsive Respawn:
Triggers respawns when health is critically low.

Client Updates:
Updates clients with health changes through targeted RPCs.

Efficient Communication:
Minimizes unnecessary data transfer for optimal performance.

By centrally managing health, this code enhances gameplay by maintaining balanced and accurate health tracking for players.



Link to health manager server

The goal

The game's inventory and item system is designed for both convenience and security. Items are created using scriptable objects, simplifying the addition of new items by assigning unique IDs. The server keeps track of each player's items, preventing any tampering with saved data. This server-side approach ensures that item usage is legitimate, enhancing gameplay integrity.

How it works

The inventory and item system operates seamlessly through the integration of scriptable objects. These objects facilitate the easy creation of new items by assigning distinct IDs. These IDs are crucial for item recognition within the game. On the server side, a vigilant watch is maintained over each player's item collection. The server not only prevents unauthorized alterations but also validates item usage for an authentic gameplay experience.

Project Image

The item class

The ItemBase class offers a streamlined way to customize variables and create various types of items with ease. Whether it's a mighty sword or a protective armour, the class lets you define the item's properties effortlessly. Once your item is ready, you can ensure its uniqueness by checking its ID against the game's list. This helps maintain consistency across both server and client environments in multiplayer gameplay.

Link to itembase

Project Image

Inventory (client)

The client-side inventory script manages the visual representation and interaction of a player's inventory in our game, "Venturers".

When a player interacts with items in the game world, the client handles displaying those items within inventory slots. The inventory is represented by a list of slots, each containing information about the item type and quantity. The script also communicates with the server to receive updates about item changes. The server handles whether the player really picked up an item or not.

Key Features:
Visual Representation:
The script displays items in the player's inventory using a list of image slots. Each slot corresponds to an item and shows its associated inventory art.

Synchronization:
The inventory is synchronized between the server and clients, ensuring that all players see the same items in the same slots.

Initialization:
The script initializes the inventory's appearance and behaviour. It disables certain elements if the player is not the owner of the inventory.

Interaction:
When the player picks up or receives items, the script updates the inventory slots based on the received item information. It refreshes the UI to reflect changes accurately.


Overall, the client-side inventory script enhances the player experience by providing a seamless and synchronized way to manage and interact with items in the game world.

Link to inventory manager client

Project Image

Inventory (Server)

The InventoryManager script in "Venturers" is the backbone of the multiplayer inventory system. It manages how players' inventories interact, synchronize, and update within the game.

Key Functions:
Inventory Structure:
Defines how inventory data is organized, with slots, item IDs, and quantities.

Database Interaction:
Handles saving and retrieving inventory data from the database.

Item Actions:
Manages giving, receiving, and updating items for players.

Error Handling:
Deals with issues like full inventories and invalid item IDs.

Networking:
Ensures inventory updates are shared correctly between server and clients.

Player Experience:
Players collect, manage, and use items seamlessly in multiplayer scenarios. The script's coordination ensures everyone sees consistent inventory changes, enhancing gameplay.

In essence, the InventoryManager script streamlines inventory management, improving the multiplayer experience in "Venturers" by maintaining a smooth and synchronized item interaction system.

Link to inventory manager server