Search Unity

Scripted simulations - help with terminology

Discussion in 'Game Design' started by nloding, Sep 1, 2017.

  1. nloding

    nloding

    Joined:
    Sep 1, 2017
    Posts:
    3
    I'm having a hard time finding the right spot to start a project I have in my head. I can do all the basics in Unity, but where I'm hitting a wall is the actual terminology for what I'm looking to do, so that I can get into some theory and then, hopefully, some code.

    I want to run a simulation of scripted events. Here's a rough example: let's recreate an Olympic race around a track. For simplicity, we won't use actual 3d meshes or animations, just cubes representing each runner. They move at certain speeds at certain points in time; at certain points in time, they are in certain known positions on the track; at a certain time, one of them trips and falls and is out the race, so that block stops moving or drifts to the center.

    This first iteration isn't meant to be interactive - just to move some objects to known places on the map at known times. With 4-6 runners in this example, it's extremely easy. But what if I had 10,000 blocks I wanted to shift around following this script. Is there a term for this?

    What do I call that? When I search for keywords like "scripted" or "simulation" I get results for sim games. What is the method I should be starting with? If you happen know an example of this and could share the link, that'd be brilliant, but I'm happy to do my research and figure out that. I just haven't found what this would be called to help me launch that research! (Researching my research has failed!)

    Any thoughts?

    Thanks!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I'm not sure there is any specific terminology. What you're describing is just scripted motion, or animation.

    Indeed, you could do this in Unity entirely with the animation editor. And sure, all 10,000 blocks can run the same animation if that's what you want.

    There are lots of other ways to do it to, such as setting up splines for your cubes to follow, or defining a data format (perhaps CSV) which you read in and use to control your objects.
     
  3. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    It depends on what you're doing with it after the first iteration.

    In some contexts, the positions and postures of those 10,000 blocks might be called the initial state, start state, or initial parameters. In other contexts, like machine learning, the initial state could be called the seed state, seed vector, or seed dataset. In other contexts, like cellular automata, it's called the first generation, or generation zero.

    Maybe I'm not understanding your question, but you might find better terms if you search on what you want to do with the data after the first iteration. Is it a deterministic simulation with no randomness? Or a stochastic simulation (with probability, randomness, or unpredictable external inputs)?
     
    EternalAmbiguity likes this.
  4. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    Are you actually trying to simulate the movement or actions? Your specific example makes it seem like you're looking to define specific events (like a single runner falling), like an animation (like JoeStrout suggested).

    I agree with TonyLi, a better understanding of what you're trying to do with the data would be valuable.
     
  5. nloding

    nloding

    Joined:
    Sep 1, 2017
    Posts:
    3
    At the moment, there isn't anything beyond running the scripted animation/simulation of events. It will be a much larger scale than the example I gave, but that is essentially what I'm looking to do. There's a start time, and end time, and the cubes are in certain places every time. I'm looking to do it within a game engine, rather than animating a video, because I'm looking to provide playback speeds, scrubbing the timeline, zoom, etc. Later I'd like to start swapping the cubes for low poly meshes at certain zoom levels, but that is a LONG way off.

    So perhaps I'm not approaching this correctly - it's more important for me to have a data structure that will fit with this, rather than the method of moving a cube from point A to point B at time X.

    tl;dr - deterministic, and a simulation of events, not just having one "runner" get injured. The same runner should get injured at the same spot in the timeline every run.
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You can do all that with Unity's animation editor. It's a somewhat unusual use case, but I don't see any reason why it shouldn't work just fine.
     
  7. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    crowd simulation
     
  8. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    No, because he's not actually simulating anything as far as I can tell — he's just playing out scripted motions.
     
    angrypenguin likes this.
  9. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    I thought he was also asking for help with googlefu to get past that point :)
     
  10. nloding

    nloding

    Joined:
    Sep 1, 2017
    Posts:
    3
    Crowd simulation is actually a great start, thank you. The now deprecated Unity asset that comes up when you Google for it has several feature that would be quite nice for what I'm looking to do. Specifically the flocking within constraints. Me saying that sort of goes against my initial question, it does and it doesn't. :D

    What this has really enlightened, though, is that I need to design the right data structure to hold all the key points of the timeline for all the objects and groups of objects. And THAT is a separate topic I may ask for feedback on later, but I have a couple ideas to experiment with for now!
     
  11. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I would call this playback. I would use keyframes to describe known state at a given point in time. I would use events to describe known changes to state at a given point in time.

    Note that this is essentially animation workflow.
     
  12. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    A "simulation" is when you're using some kind of modelling to work out or calculate what happens. What you're describing here is not that, because you have the entire course of action pre-calculated and you specifically want to stick to it. As @JoeStrout says, the part that you're describing here is "animation".

    That said, the data that you're visually representing may well be the output of a simulation.