justgos / cubism

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cubism

This is me showcasing a few basic mechanics mechanics using SpatialOS and Unity.
The blank SpatialOS started project was used as a boilerplate (so the Unity project itself is in workers/unity).

Controls

Space - jump
Space while in the air - smash

Technical aspects

Network-synchronized animator state

The player character uses an Animator-based state machine (for the delayed jump animation) that's synched via a SpatialOS component. Implemented in Assets/Scripts/Entities/PlayerStateMachine.cs and Assets/Scripts/Input/PlayerMovementControl.cs

Slowly-interpolated follow movement

The player character gradually rotates towards the requested movement direction, meanwhile moving foward in the direction it's facing now, akin to a car.
Implemented in Assets/Scripts/Input/PlayerMovementControl.cs

Server-side dynamic spawn system

Shapeshifting objects are spawned at random locations with random delays after the server's start. They drift around within the bounds specified on spawn.
Implemented in Assets/Scripts/Systems/ShapeshifterSpawnSystem.cs

Messy implementations

Player creation flow changes

A networked game should be able to authentice the connecting player and load their data from some external store, but by default the PlayerLifecycle creates a player object without any external input - meaning it doens't support an async form of the CreatePlayerEntityTemplate delegate. So i've made a modified AsyncHandleCreatePlayerRequestSystem (Assets/Scripts/Systems/AsyncHandleCreatePlayerRequestSystem.cs) and unpacked the part linking it (Assets/Scripts/Workers/UnityGameLogicConnector.cs). It sends a dummy SessionKey parameter which in read in the CreatePlayerEntityTemplate server-side method.
Note: for stability, the whole PlayerLifecycle should be unpacked, in case some update will change parts outside the modified System.

Customized Universal Rendering Pipeline shader

URP doesn't seem to support partial modifications to it's vertex/fragment shader parts, so i've re-stitched parts of the original Lit shader and modified the vertex part to smoothly morph an object between it's original shape and the sphere (Assets/Shaders/Entities/MorphingLit.shader).
Note: in case multiple different modifications of the standard URP shader will be required, it might make sense to refactor the unpacked code into a more combinable set of blocks.

About

License:MIT License


Languages

Language:C# 64.8%Language:ShaderLab 19.8%Language:Shell 10.3%Language:HLSL 5.1%