Giter VIP home page Giter VIP logo

Comments (10)

cortfritz avatar cortfritz commented on August 15, 2024 2

Shouldn’t this exist in a separate module? Many Scenic applications would not use it.

from scenic.

boydm avatar boydm commented on August 15, 2024 2

This would definitely go in a separate module.

First, isn't targeted at games (ok if it is used for some tho!), so wouldn't want to fill up the main lib with game targeted code.
Second, not sure there is a "right" way to do it that solves enough game types. Seems game specific to me??

from scenic.

cortfritz avatar cortfritz commented on August 15, 2024 2

A separate collision detection module seems smart.

Initialize the module as a scenic remote of the viewport.

Register has_collided functions with the CD module. These will reference 2 or more specific primitives, groups, etc in the graph of the viewport to be monitored for collision.

Scenic remoting will replicate graph changes to the CD module.

CD module will respond to incoming graph changes pattern matching on the render against the items marked for possible collision

If a match is made, then math is performed to determine if the change to the referenced graph item has collided with another.

If they have collided then we call the appropriate has_collided func

Right? Wrong?

from scenic.

ejc123 avatar ejc123 commented on August 15, 2024 2

A separate collision detection module seems smart.

Initialize the module as a scenic remote of the viewport.

Register has_collided functions with the CD module. These will reference 2 or more specific primitives, groups, etc in the graph of the viewport to be monitored for collision.

Scenic remoting will replicate graph changes to the CD module.

CD module will respond to incoming graph changes pattern matching on the render against the items marked for possible collision

If a match is made, then math is performed to determine if the change to the referenced graph item has collided with another.

If they have collided then we call the appropriate has_collided func

Right? Wrong?

I've been lurking because I started a game and quickly started wanting collision detection.
I really like this idea and using a remote view is brilliant.

from scenic.

axelson avatar axelson commented on August 15, 2024

Yeah, those are definitely fair points. Do you have any pointers on getting the transformed coordinates for scene components out of a graph? Or do I need to eschew all the transforms and model all the primitive shapes in my user code? (or just pretend everything is a square)

from scenic.

axelson avatar axelson commented on August 15, 2024

Yeah, a remote view sounds like an interesting approach, although I do wonder if there's some overhead that could be avoided. I'll have to think about it some more and look at the remote view docs to understand it better.

from scenic.

boydm avatar boydm commented on August 15, 2024

Don't know how it would be hooked in yet, but I was imagining an api where you register graph/primitive tuples that you want to track to see if they are colliding. (This gives a minimal set of data that needs to be tracked/reduced at run time). Then when it fines a collision, it would send a message to the requesting scene.

The pro of building this as a driver is that the communication machinery is all there and is fast.

The con of building it as a driver is that it would need to expose an api to the scene. I've tried so far to have the scenes not need to know about drivers. This would break that model, although it is only a philosophical one, not a hard enforce thing.

Thoughts?

from scenic.

cortfritz avatar cortfritz commented on August 15, 2024

can the game process be outside of Scenic, materializing scenic elements. my game process materializes a ship and a bullet and stuffs them "into" scenic and stuffs them as a tuple into the CD process. But I still imagine the CD process is a remote viewer of the viewport. It's pattern matching everything that moves as the telemetry comes in to run the math to determine if the "elements" have intersected. Then it calls back to the game process, not scenic.

right?

from scenic.

cortfritz avatar cortfritz commented on August 15, 2024

@boydm: it might be good to be able to put in a filter in the telemetry send pipeline. Only relevant changes get sent. In the above scenario the "game" would put the your graph tuple in the CD module and also put the tuple into a filter in the pipeline in the telemetry being sent from scenic to the CD module. The function put in would have the tuple, would inspect the change to see if a parent of one of the graph items had changed, thus translating the graph item, or if one of the graph items had itself changed. Then pass that on.

This would minimize events sent over wire to CD module.

Not sure if that's needed or helpful, but it occurs to me that a general pipeline for remoting on the scenic side would be helpful for filters or other purposes. May already exist.

from scenic.

crertel avatar crertel commented on August 15, 2024

I'd argue you'd probably want to have the dumbest-possible/flattest scenegraph, and use scenic just for the input/rendering layer. Like, you might be better off just keeping the scenegraph under the control of your physics code and occasionally walking the important bits and sending them back to scenic for rendering.

from scenic.

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.