GithubHelp home page GithubHelp logo

hiinaspace / vrchat-holdem Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 0.0 219 KB

Texas Holdem with full rules enforcement in vrchat udon

Home Page: https://vrchat.com/home/world/wrld_9e6307c6-00b9-46d1-b566-29e776b28d27

License: The Unlicense

C# 100.00%
vrchat udon udonsharp

vrchat-holdem's Introduction

VRChat Holdem

No-Limit Texas Holdem implementation in VRChat Udon, with automatic dealing and full rules enforcement.

Status

Core game logic mostly works, but there are still some hard-to-catch bugs. UX is still entirely through Unity UI Canvases with programmer art. More satisfying physical interaction with the chips and cards is planned once the core game logic is fully baked.

Design

A single Holdem game is implemented as a single HoldemGame UdonSharpBehavior and 10 HoldemPlayer UdonSharpBehaviors. HoldemGame runs the game logic on the instance master. The HoldemPlayer instances broadcast each player's action (check, bet, fold).

HoldemGame

mostly encoded as a switch state machine in Update(), with game state synchronized as a 7-bit encoded UdonSynced string.

TODO more detail

HoldemPlayer

TODO

Testing

Since the Udon virtual machine has no debugger, a lot of the core logic is unit tested as real C# code using Unity's test runner EditMode (with full interactive debugging support). Unfortuantely UdonSharp can't link against (easily testable) standalone code outside a behavior, so testable methods within the behavior are made static. However, UdonSharp also doesn't support the static keyword, so the csharp preprocessor is used to conditionally compile the methods as static only in csharp. For complex static methods, return values are encoded as poor man's object[] "struct"s, as UdonSharp also lacks support for user-defined classes/structs or out parameters.

I don't think making the methods static is strictly necessary but it avoids having to stick the UdonSharpBehavior on a gameobject.

TODO need to write more PlayMode tests to exercise the rest of the stateful logic where possible.

vrchat-holdem's People

Contributors

hiinaspace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.