Marooned
Marooned: Island Survival (C# Unity)
3D first person survival game where you are stranded on a procedurally
generated island and must collect resources, craft equipment, and fend off mobs
to survive. Features include server authoritative multiplayer, a flexible ability
system, and an inventory/crafting system.
Â
Summoning a boss
Getting killed by Goblins
Multiplayer
Play solo or host a server your friends can join. Implemented with Fish-Net: Networking Evolved. Most features are server authoritative with movement that is client-side predicted. Hosts have the option to change the world generation seed, and joining players can save servers to quickly join for future sessions.
Â
Hosting and joining a server
Ability System
I wanted to create an ability system that was easy to extend and easy to edit using built in inspectors. I was heavily inspired by the Unreal Gameplay Ability System and was able to implement an ability system that incorporates many of the same elements. Like GAS it is built around assets that define Abilities, Effects, and Cues. # Ability assets define the behavior of an ability, what effects to apply, animations to play etc. Abilities typically use Tasks to handle behavior over time like playing an animation and waiting for an animation event to check for collision and apply an effect. Tasks are wrappers for C# async tasks that respond to events.
Effect assets are used to modify the value of a Stat such as health or stamina. this can be a simple addition/subtraction or a custom calculation. Effects can also trigger cues via tags.
Cue assets define a visual or auditory response to an action such as playing particles or sounds. Cues are triggered via tag rather than directly. This means an actor can define what cue it wants to activate in response to a particular tag or fallback to a default cue. For example, trees and rocks can each have their own particle effect to play in response to a melee hit or play a default dust effect.
The first iteration of the ability system was built around polymorphic plain C# classes using Serialize Reference. While this was functional it required me to write custom editors and inspectors to allow authoring abilities in the unity editor. This ended up being more brittle than desired and I eventually switched to a system based on Scriptable Objects. In Unity, Scriptable Objects are first class citizens with respect to serialization and editor support, allowing references to be assigned through drag and drop or the asset search box. The ability Scriptable Objects are not instantiated on a per instance basis but rather have a single instance per unique ability and are treated as read only. Individual ability instances are still plain C# class objects passed to the ability operation functions.
Items, Inventory, and Crafting
Crafting and equipping armor
Inside the inventory window there is a crafting menu for items that can be crafted without a crafting station. After collecting rocks and logs, players can craft a stone axe and pickaxe to allow better materials to be collected. The workbench, furnace, and forge can be crafted and placed to unlock new crafting recipes. The crafting interface has a selection of icons indicating which items can be crafted at the current station. The materials required are shown by tooltip when hovering over a slot. Slots will be greyed out if the player does not have the required materials.