Convert Figma logo to code with AI

Unity-Technologies logoBoatAttack

Demo Project using the Universal RP from Unity3D

2,527
950
2,527
72

Top Related Projects

A first person multiplayer shooter example project in Unity

Unity C# reference source code.

16,887

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.

Streaming server for Unity

Quick Overview

The Unity-Technologies/BoatAttack repository is a sample project created by Unity Technologies, showcasing a 3D boat racing game built using the Unity game engine. The project demonstrates various Unity features and best practices for game development.

Pros

  • Comprehensive Gameplay: The project includes a complete boat racing game with various gameplay elements, such as racing, combat, and environmental interactions.
  • Showcases Unity Features: The project showcases the use of Unity's built-in features, such as the physics engine, particle effects, and UI systems.
  • Detailed Documentation: The project's documentation provides a thorough overview of the game's architecture, development process, and technical implementation.
  • Active Community: The project has an active community of contributors and users, providing support and feedback.

Cons

  • Limited Scope: The project is primarily a demonstration of Unity's capabilities and may not be suitable for a full-fledged commercial game development.
  • Potential Complexity: The project's comprehensive nature may make it challenging for beginners to understand and modify the codebase.
  • Dependency on Unity: The project is tightly coupled with the Unity game engine, limiting its portability to other game development platforms.
  • Potential Performance Issues: The project's visual complexity and physics-based gameplay may pose performance challenges on lower-end hardware.

Code Examples

N/A (This is not a code library)

Getting Started

N/A (This is not a code library)

Competitor Comparisons

A first person multiplayer shooter example project in Unity

Pros of FPSSample

  • More comprehensive networking and multiplayer features
  • Includes advanced AI systems for enemy behavior
  • Demonstrates complex game mechanics like weapon systems and character movement

Cons of FPSSample

  • Larger project size, potentially more complex to understand and modify
  • Less focus on graphical showcase and visual effects
  • May require more powerful hardware to run smoothly

Code Comparison

FPSSample (PlayerCharacterController.cs):

public void Move(Vector3 movement)
{
    m_CharacterController.Move(movement + m_VerticalSpeed * Vector3.up * Time.deltaTime);
    m_VerticalSpeed += Physics.gravity.y * Time.deltaTime;
}

BoatAttack (BoatController.cs):

private void FixedUpdate()
{
    _rb.AddForceAtPosition(transform.up * -Physics.gravity.y * _rb.mass, transform.position);
    _rb.AddTorque(-transform.right * (Vector3.Dot(_rb.velocity, transform.forward) * _turnStrength));
}

Both examples showcase physics-based movement, but FPSSample focuses on character control, while BoatAttack emphasizes boat dynamics and buoyancy.

Unity C# reference source code.

Pros of UnityCsReference

  • Provides comprehensive access to Unity's C# source code
  • Valuable resource for understanding Unity's internal workings
  • Useful for debugging and extending Unity functionality

Cons of UnityCsReference

  • Large codebase can be overwhelming for beginners
  • Not a playable demo or example project
  • Requires deep understanding of Unity architecture

Code Comparison

UnityCsReference (Editor/Mono/Inspector/Editor/ColorEditor.cs):

public override void OnInspectorGUI()
{
    serializedObject.Update();
    EditorGUILayout.PropertyField(m_Color);
    serializedObject.ApplyModifiedProperties();
}

BoatAttack (Assets/Scripts/Boat/BoatController.cs):

private void FixedUpdate()
{
    _rigidbody.AddForceAtPosition(transform.up * _enginePower, _enginePosition.position);
    _rigidbody.AddTorque(-transform.forward * _steeringPower * _steering);
}

BoatAttack is a playable demo showcasing Unity's Universal Render Pipeline, while UnityCsReference is the C# source code for the Unity Editor and runtime. BoatAttack offers a practical example of game development, whereas UnityCsReference provides in-depth insight into Unity's internals. The code snippets illustrate the difference in focus: UnityCsReference deals with editor functionality, while BoatAttack implements game mechanics.

16,887

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.

Pros of ml-agents

  • Focuses on machine learning and AI, providing a powerful framework for training intelligent agents
  • Offers a wide range of pre-built environments and examples for various AI applications
  • Actively maintained with frequent updates and a large community

Cons of ml-agents

  • Steeper learning curve for developers not familiar with machine learning concepts
  • Requires more computational resources for training and running complex AI models
  • May be overkill for projects that don't require advanced AI capabilities

Code Comparison

ml-agents:

from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.side_channel.engine_configuration_channel import EngineConfigurationChannel

channel = EngineConfigurationChannel()
env = UnityEnvironment(file_name="MyEnvironment", side_channels=[channel])

BoatAttack:

public class BoatController : MonoBehaviour
{
    public float speed = 10f;
    public float turnSpeed = 5f;
    private Rigidbody rb;
}

The code snippets highlight the different focus areas of the two projects. ml-agents emphasizes setting up AI environments, while BoatAttack deals with game-specific mechanics like boat control.

Streaming server for Unity

Pros of UnityRenderStreaming

  • Focuses on real-time streaming and remote rendering capabilities
  • Supports WebRTC for low-latency video streaming
  • Enables cloud-based rendering and remote play scenarios

Cons of UnityRenderStreaming

  • More complex setup and configuration required
  • Limited to streaming and rendering use cases
  • May have higher performance overhead for certain applications

Code Comparison

BoatAttack (water shader example):

float3 waterColor = lerp(_ShallowColor.rgb, _DeepColor.rgb, waterDepth);
float3 foam = step(foamLine, waterDepth) * _FoamColor.rgb;
finalColor = waterColor + foam;

UnityRenderStreaming (WebRTC signaling):

public override void OnCreateOffer(RTCSessionDescription offer)
{
    base.OnCreateOffer(offer);
    StartCoroutine(WebRTC.Signaling.SendOffer(offer));
}

BoatAttack is a demo project showcasing Unity's High Definition Render Pipeline (HDRP) with a focus on water rendering and boat physics. It provides a complete game example with assets and gameplay mechanics.

UnityRenderStreaming, on the other hand, is a framework for implementing real-time streaming and remote rendering in Unity projects. It's more specialized and technical, aimed at developers looking to integrate streaming capabilities into their applications.

While BoatAttack demonstrates graphics and gameplay, UnityRenderStreaming enables new distribution and interaction models for Unity content through web technologies.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Note:This repository uses GitLFS, to use this repo you need to pull via Git and make sure GitLFS is installed locally

Boat Attack

Demo Project using the Universal RP from Unity3D

Click for Youtube Video

This Unity project has been created to aid the testing and development of Universal RP. The project is a small vertical slice of a boat racing game, complete with race-able boats and island environment.

Feel free to post any issues, but know this is a 'as is' repo, it's meant more for discovery of how some of the Universal RP features work and a learning resource for some tricks.

Project Features:

  • Uses Universal RP from Unity
  • Mobile optimized, low poly, LODs, no compute
  • C# Jobs buoyancy system
  • Cinemachine camera setups
  • Shader Graph usage
  • Post-processing v3 with Volume blending
  • Addressables asset management package
  • Custom Universal RP rendering for planar reflections via SRP callbacks
  • Custom SciptableRenderPass usage for WaterFX and Caustics
  • Gerstner based water system in local package(WIP)
  • Much more..

Demo Footage

Usage

Getting the project

via Git:

  1. Make sure you have GitLFS installed, check here for details.
  2. Clone the repo as usual via cmd/terminal or in your favourite Git GUI software.
  3. Checkout the branch that matches the Unity verison you are using, eg release/2019.3

Downloadable zips:

  1. 2019.3 Project (Unity 2019.3f5)

Load the project:

Once you have the project files locally you can load the project, ideally in the Unity version that is noted in the ProjectSettings/ProjectVersion.txt for the best experience. Upon loading the project will display a small welcome screen with some buttons to load starting scenes.

Scenes worth noting:

  • scenes/main_menu.unity - Starting menu scene if you want to have a full play-through of the demo.
  • scenes/demo_island.unity - Setup to play in the editor and go straight into an AI based race.
  • scenes/_levels/level_Island.unity - The scene loaded when entering from the main menu.
  • scenes/Testing/***.unity - Assorted test scenes, these are in need of updating and come as is.

Build the project:

One thing to make sure you do before building is make sure to build the addressable assets, this can be done via the addressables window, for more information please checkout the addressables package documentation. Once the addressable assets are built you can continue to build a player as usual.

One thing to mention is not all controls and platforms have been tested, especially for the menu work. if you want to just see the project running on a device you can add the scenes/demo_island.unity scene to the build list and disable/remove the others.

Todo

As this project is on going there is a lot more left that needs to be worked on, so I repeat this is not a resource for production ready workflow ideas or systems and lots of it was put together very quickly.

Some of the things left to do:

  • Make water system more modular and improve UX
  • Improve boat AI
  • Add imposter rendering for vegetation
  • Cleanup menu system to switch between Demoing/Playing/Benchmarking
  • Implement Unity Physics
  • Optimize cross platform performance and stability
  • Continue code cleanup
  • Wiki explaining features/systems in more depth
  • Add more sizzle....

Sunny Island

Credits

Andre McGrail - Design, Programming, Modeling, Textures, SFX

Alex Best - Modeling, Textures

Stintah - Soundtrack

Special thanks to:

Felipe Lira - For Making Universal RP & LWRP

Tim Cooper - Assorted SRP code help

And thanks to many more who have helped with suggestions and feedback!

Notes

*Make sure you clone the repo as downloading the zip will not contain the GitLFS files(all textures/meshes etc)