Search Unity

Attract mode for a pc,mac game

Discussion in 'General Discussion' started by Numonic, Jan 9, 2018.

  1. Numonic

    Numonic

    Joined:
    Mar 22, 2009
    Posts:
    241
    Does anyone know what approach to record a characters movements to create a Attract Mode for a PC and Mac game?
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,511
    Can you elaborate?
     
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,141
    He's referring to the demo mode that plays on arcade machines.

    http://tvtropes.org/pmwiki/pmwiki.php/Main/AttractMode

    It's entirely dependent on the game. If the game is deterministic you can just record player input and play it back through the game. If it isn't then you'd need to record quite a bit more data (transforms, animations, etc) for both the players and any enemies.

    I haven't had to implement this for projects (either it wasn't needed or someone else handled it), but if I did I'd probably start with a script attached to every important object that recorded the necessary data and passed it off to a master script for storage and serialization. Playback would involve requesting the data back from that script and feeding it into the object.
     
    Last edited: Jan 10, 2018
    angrypenguin and orb like this.
  4. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    What Ryiah said. If you've decoupled things well enough it shouldn't be hard to write an input recorder that simply collects a list of sequential presses you can then feed to the objects again. I'd implement recording as a feature of the input handler, so that a list of inputs is built while playing a game, and the input handler would be interchangeable with a playback list handler.

    If the game is more randomised it's as "easy" as just implementing a perfect player-replacement AI ;)
     
    angrypenguin likes this.
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You could also consider using a capture program like Fraps to record a few play sessions, and then just playing one of those videos as an attract mode. Very little code required doing it that way.
     
    RavenOfCode, Peter77, Ryiah and 2 others like this.
  6. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Cheap and dirty :)

    Should work well on desktop, where you can expect to have space for some video.
     
  7. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    +1 for just prerecording videos with a screen capture set up.

    If you must capture actual player footage at run time, then I would simply shove every transform into a set of animation curves. My trending project could be used to do this, with a little tweaking.

    https://bitbucket.org/BoredMormon/trend.me
     
    angrypenguin and Ryiah like this.
  8. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,141
    For that matter it gives you a starting point for a video to upload to each store.
     
  9. Numonic

    Numonic

    Joined:
    Mar 22, 2009
    Posts:
    241
    That seems interesting any tutorials on how to go about doing this? I've been working with C# for a year now and always learning.
     
  10. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    None that I'm aware of. I could probably do one up if you are interested, but I can't promise one any time soon.
     
  11. Numonic

    Numonic

    Joined:
    Mar 22, 2009
    Posts:
    241
    Yes that would help immensley thanks!
     
  12. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I'll add it to the list.
     
    theANMATOR2b likes this.
  13. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
    I would absolutely do this. There's no way I'd design/implement a complex and potentially heavy system when I could just use a video texture.
     
    Numonic and Kiwasi like this.
  14. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Why have an attract mode if the game is not going to be sitting there idle with no-one playing it trying to attract attention?
     
    angrypenguin likes this.
  15. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Now, don't go around applying that logical thinking of yours to everything. Some people are perfectly happy making everything complicated!
     
    theANMATOR2b likes this.
  16. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    It could be an excuse to have a play with the Unity AI system, let it play the game and learn as it goes.

    Note there was an 80s game called Virus that did this, if you watched the attract mode the cpu player got better and better. Not sure how the developer did this, possibly some sliding scale that limited inputs from perfect to useless.
     
  17. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    not implementation, but here is a GDC talk about deterministic games and tricks you can do like replaying user input.
     
    Numonic likes this.
  18. Numonic

    Numonic

    Joined:
    Mar 22, 2009
    Posts:
    241
    I'm planning on actually making this run on a micro computer droid like oDroid and plan on exporting a Linux executable to run on a mini arcade box.
     
  19. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Yeah, I can see an attract mode being fun for that :)
     
    Numonic likes this.