Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Billiard Template

Discussion in 'Assets and Asset Store' started by Nitugard, Oct 19, 2022.

  1. Nitugard

    Nitugard

    Joined:
    May 10, 2015
    Posts:
    343


    Latest Version 1.0 - Released

    Billiard Template
    Links: [Asset Store]
    [Discord]


    About:
    Billiard Game Template for Unity is an event-based billiard physics engine in which differential equations of motion are solved exactly, thus creating a simulation that conforms to reality. This method is much faster than conventional solvers used in physics engines as it does not have an explicit simulation step but rather a search is performed for the next event(state change) when the differential equation to be solved is updated. Differential equations are solved analytically so precision only depends on the model!

    Features:
    • Event-Based Physics Engine
    • Finite State Machine Gameplay
    • Fast And Stable Solvers
    • 6-DOF Ball Movement
    • Impulse-Based Collision Response With Friction
    • Double precision
    • Threaded solver using Jobs and Burst Compilation
    • 8Pool Example
    • And more!
    Todo:
    • Network
    • VR Support
    • Android Support
    Support:
     
    Last edited: Nov 9, 2022
  2. Nitugard

    Nitugard

    Joined:
    May 10, 2015
    Posts:
    343
    Initial version 1.0 is now available on the asset store!

    If you have any questions I'll be happy to answer :)
     
  3. povit

    povit

    Joined:
    Nov 7, 2022
    Posts:
    2
    The board returns to the starting state after the stroke,I don't know where it was configured
     
  4. Nitugard

    Nitugard

    Joined:
    May 10, 2015
    Posts:
    343
    Hello @povit,

    If the initial strike does not satisfy common eight pool ball rules, then the board is reset to previous(initial) state.
    You can change this behavior in BilliardTemplate/Code/Billiard/EightPool/EightPoolBilliard.cs

    I am working on making billiard template simpler to use and edit. Will post results soon.
     
  5. LoveAndDreams

    LoveAndDreams

    Joined:
    May 19, 2023
    Posts:
    5
    For single player game, how does it handle computer ai ? is there a way to handle the actions on code? can you get the probabilities to know what would be the best action to take.

    thanks in advance
     
  6. Nitugard

    Nitugard

    Joined:
    May 10, 2015
    Posts:
    343
    Hello @LoveAndDreams ,

    Here's how the AI integration works:

    1. Handling Computer AI:
    The billiard simulation is designed to be event-driven, eliminating the need for simulating by incrementing delta time steps. This streamlined approach simplifies the AI integration process, enhances efficiency, and results in more intelligent AI behaviors. This represents a cutting-edge approach in game development.

    2. Handling Actions in Code:

    Yes, you can handle AI actions in code. You'll need to define AI behavior, evaluate game states, and make decisions based on the current situation.

    3. Probabilities for Best Action:

    The billiard simulation is deterministic, so there are no inherent probabilities involved. However, you have the flexibility to introduce uncertainty if desired, making the AI choose suboptimal shots in some cases.

    It's worth noting that I've previously implemented AI using this template. The AI selected the best shot by simulating event-driven outcomes and considering the resulting table state. If you need assistance or have more questions, feel free to ask here or on our Discord for faster replies.
     
  7. LoveAndDreams

    LoveAndDreams

    Joined:
    May 19, 2023
    Posts:
    5
    Thank you for the fast response. Your asset seems to be good at a good price. Does it include 2vs2?
     
  8. Nitugard

    Nitugard

    Joined:
    May 10, 2015
    Posts:
    343
    No, it is just a core template with very realistic physics. You have the freedom to turn it into any kind of game you want.
     
  9. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,195
    Hi, Looks like a very nice billiard template.
    One question I have though is if there is support for applying spin to the cue ball (Backspin, side spin, etc.)? I see that the physics simulation has 6DOF and support for sliding states etc. so it seems like the physics can handle that, but I cannot see any obvious way from the videos to input cue ball spin, and no reference in the documentation. Is that a supported feature and if not do you think it could be added in the future?
    Also is the physics simulation deterministic? For example: if you take the same table state and inputs and simulate them on 2 different devices, will the outcome be identical?
    Thanks in advance.
     
    Nitugard likes this.
  10. Nitugard

    Nitugard

    Joined:
    May 10, 2015
    Posts:
    343
    Hello @scottyboy805

    Certainly, the physics simulation in the billiard template accounts for various types of spins. I'm excited to share this Android game with you, which was created using my billiard template. As they say, a video is worth a thousand pictures, so I invite you to take a look:



    Feel free to explore the immersive experience and witness the realistic spin mechanics in action. Let me know your thoughts!
     
    scottyboy805 likes this.
  11. vertexx

    vertexx

    Joined:
    Mar 18, 2014
    Posts:
    379
    Great work indeed! Well done. Now to convince the "better-half"..Her indoors!
     
    Nitugard likes this.
  12. unity_4DF4B4F40A6FEB666A89

    unity_4DF4B4F40A6FEB666A89

    Joined:
    Aug 25, 2023
    Posts:
    1
    protected override void OnStableStateChange(bool isStable)
    The parameters of this method represent whether the batting is completed, but it will be called multiple times in the Android environment. The iOS environment is normal. How can it be made normal in the Android environment?
     
  13. Nitugard

    Nitugard

    Joined:
    May 10, 2015
    Posts:
    343
    Hello,

    I'd be happy to assist you in resolving the issue you are experiencing. To better understand and address the problem, could you please provide more context or details about the issue you're facing?

    If you'd like, you can also contact me on Discord.

    Regards.