Code Monkey home page Code Monkey logo

unet-controller's Introduction

An authoritative CharacterController based controller for use in Unity's UNet.

Features
  • Client-side prediction.
  • Client-side reconciliation.
  • Interpolation.
  • Snapping to grid in order to suppress floating point nature.
  • Relatively low overhead.
  • Quake-like strafing. But most likely very incomparable.
  • Crouching.
  • Animations.
  • Network data analyzer to compare the results between the server and the client.
  • First person and third person camera.
  • Sliding of steep surfaces.
  • Ability to set AI target (basic, moves straight towards the target).
  • Recording and playing back gameplay.
  • Foot IK.
  • Ragdoll.
  • Lag compensation (WIP).
Performance (On 2015 MacBook Pro with quad-core i7)
  • Up to 1 millisecond on server every time a network update happens.
  • Up to 1 millisecond on client every time a network update happens. Sometimes it jumps a bit higher if there are a lot of inputs to replay during reconciliation. That is due to high latency.
  • Very small overhead on non local clients moving.
  • GC allocations 80 bytes per player. This is due to CharacterController.
  • Way higher GC allocations on the server side (and while recording gameplay for that matter), due to the need of storing history of the objects for lag compensation.
How does it run fast
  • It moves character only when network update occurs and then interpolate until the next network update in LateUpdate.
  • Efficient data reusing with as least locals as possible (as they cause GC allocations).
Current issues
  • Update Once and Lerp mode does not work well with the update rates over 50hz. Use lower send rate or a higher one with Update Once mode.
TODO
  • Add jumping between updates so jumping would feel good even on small update periods.
  • Complete lag compensation.
  • Fix issues.

unet-controller's People

Contributors

pcjax avatar

Stargazers

Jos Yule avatar Wagner avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.