playMaker

Author Topic: Tron Light-Cycle type logic?  (Read 2815 times)

cb

  • Junior Playmaker
  • **
  • Posts: 66
    • View Profile
Tron Light-Cycle type logic?
« on: July 01, 2012, 11:58:04 PM »
I'm experimenting with a Tron type game, where the light cycles leave trails and you must avoid them. Just sketching out some potential AI here, as in how would the enemy cycles avoid trails and still look like they are chasing you? Each cycle will leave a line of simple box-colliders as a trail, my first take on this would be to use rays to detect these boxes,but would it be efficient to permanently ray-cast in all 3 directions (forward, left & right) on around 6 enemy cycles? Or maybe 'flash' a similar 3-way raycast every half a second & check for surrounding trails? Links to similar example raycasting logic would be good,
Any answers or thoughts on this very appreciated.



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: Tron Light-Cycle type logic?
« Reply #1 on: July 02, 2012, 06:04:50 AM »
Hi,

 Ahhh the good old tron cycle game. We used to spend hours with my bro in front of that game like 25 years ago!!! my dad programmed it from a magazine ( like 100 lines of code not more!) on the amstrad ( you know the one running actual tapes!!!)...

You only need one raycast per cycle, forward, as the cycle turn 90° sharp, you don't need to check the sides.

 Anyhow. You'll be find with a dozen of raycasts really.

BUT, If I were to build this, I would base the logic around a complete abstract model using a texture actually, I would draw pixels as the cycle moves and on each update check the position of the cycle and if it is on one of these pixel by simply comparing colors. the trai would just be a visual element not playing any role in the game logic.  But you can do it all with colliders yes of course

bye,

 Jean

cb

  • Junior Playmaker
  • **
  • Posts: 66
    • View Profile
Re: Tron Light-Cycle type logic?
« Reply #2 on: July 02, 2012, 10:07:07 AM »
Thanks, Jean,

Yes, I'm old enough to remember typing in the magazine codes  :D I also remember spending a fortune on the Tron arcade machine, What a beautiful cab. Great game, and the light cycles was always my favourite. I also played a pretty good version on the Spectrum called Blind Alley. Really tough game though.

The pixel thing is interesting. I wanted a 3d look so that made me think of colliders but I'm open to any suggestions. How could I leave a trail of pixels behind, is there some kind of pixel drawing/plotting method available to Unity/Playmaker?


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: Tron Light-Cycle type logic?
« Reply #3 on: July 03, 2012, 11:59:04 PM »
Hi,

 no no, I mean simply using an image as the board to check cycles. The game can be all in 3d with angled view, trails as real mesh, etc etc only they will "sit" on top of the game engine that itself only relies on setting and getting pixels.

 Otherwise you will have to create some more complex framework to create colliders as the cycle moves and turns, which is totally feasible but not sure how it's going to behave when you have 4 or more players running on a big board with hundreds of colliders, would need some stress tests to make sure it will perform ok, with my solution, it will work just fine. It depends of course what you are after. If you want a tron game like the last one ( a normal bike game around a track), then will be better, if you want the original worm like tron in a confined space, pixel base management will be easier.

bye,

 Jean