Giter Site home page Giter Site logo

Jump or masse shots? about pooltool HOT 4 CLOSED

zhaodong-wang avatar zhaodong-wang commented on July 26, 2024
Jump or masse shots?

from pooltool.

Comments (4)

zhaodong-wang avatar zhaodong-wang commented on July 26, 2024

Actually after checking into the code, I have a follow up question: why would we choose to use some fixed physics formula as evolution or resolution instead of directly leveraging some physics engine like Bullet? Maybe that can generate more realistic results? I see that pandas3d has bullet support.

from pooltool.

ekiefl avatar ekiefl commented on July 26, 2024

Hi @zhaodong-wang, currently all ball trajectories are bound to the table. There are no other hurdles besides time that prevent extension to the third dimension.

The design philosophy of pooltool prioritizes modular, custom physics. While realism is currently subpar due to the current physics models being used, the framework allows for future improvements and the integration of advanced physics models that are far more realistic than the out-of-box solutions afforded by a real-time physics engine such as Bullet. For example, it is on the roadmap to include the Mathavan et al treatment for the ball-cushion interaction (see here).

Furthermore, the Bullet engine use discrete time evolution algorithms to advance the system state. Pooltool is fundamentally different in that it uses an event-based evolution algorithm. To learn more about their differences, see this blog post.

That said, some very preliminary experimentation with Bullet has been performed, but not with much success (link here). If you think this is a direction worth moving in, I would encourage you to experiment and see if you can get something working. Please report back.

from pooltool.

zhaodong-wang avatar zhaodong-wang commented on July 26, 2024

@ekiefl thank you for the comprehensive explanation! I now grasp your motivation more clearly. Interestingly, a few years back, I embarked on a similar endeavor. My aim was to employ RL to train an AI agent to play pool at a professional level. I believe this challenge is even more daunting than mastering Go, given the vast action space and the inherent unpredictability in cue actions. Crafting a model that can decide the optimal sequence of shots and positions akin to a professional player is quite an uphill task. Although there are several papers addressing this issue, I feel they somewhat underestimate its complexity, particularly since they lack the nuanced understanding of pool play at a near-professional level.

Initially, I utilized pybullet, the go-to library for RL at the time, to create a fairly robust environment. The quality was not bad, e.g., break shot, jump shot. The missing piece that I didn't get into implementation was the soft-body modeling of the cushion (such that I can repro some cushion compression effects, example). My objective was to develop something akin to ShootersPool, which I still regard as the premier pool simulator. However, the simulation speed in pybullet was insufficient for effective RL model training due to its low sample efficiency. Subsequently, I came across a repo fastfiz that employs discrete event simulation, trading off a bit of accuracy for speed, yet still maintaining sufficient fidelity. By integrating the physics models mentioned in your papers and rectifying some bugs, I achieved the simulation speed I desired. I didn't get a decent RL policy at the end, but this was a fun journey and I learned a lot..

I concur with your endorsement of discrete event-based simulation (DES), having utilized it in other projects myself (like this) (btw, The SimPy library offers a great abstraction of DES using coroutine-style syntax, making it less prone to errors, albeit slightly slower, but there is also a simcpp20). I'm curious to know if you're still actively developing this library. I genuinely believe that a high-quality, open-source pool simulator on par with ShootersPool could significantly demystify numerous aspects of billiards, which typically require high-speed cameras or extensive experiments for elucidation.

from pooltool.

ekiefl avatar ekiefl commented on July 26, 2024

@zhaodong-wang, the RL-based AI agent sounds like a really interesting project, and it's similar to a project I am working on in collaboration with the folks at LightZero.

The quality was not bad, e.g., break shot, jump shot

This looks awesome. Thanks for sharing. I agree that speed is a major drawback for using pybullet.

I'm curious to know if you're still actively developing this library

Yes, I am. And I anticipate I will be for a long time.

btw, The SimPy library offers a great abstraction of DES using coroutine-style syntax, making it less prone to errors, albeit slightly slower, but there is also a simcpp20

Good to know. I would be curious if the simulation speed could be increased by using these out-of-box tools. The pooltool shot evolution algorithm is already quite fast as it is compiled into machine code using numba, but it would be nice to benchmark. One drawback to the current code is the lack of parallelization. Advancing to the next event requires calculating the time until all possible events, which for a game like 8-ball--with 15 balls and 40 cushion segments--can be close to a thousand root solving operations per time step.

If you're interested in getting involved, please let me know.

This conversation is now off-topic. Please join the discord if you want to discuss ideas further (https://discord.gg/8Y8qUgzZhz)

from pooltool.

Related Issues (20)

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.