playMaker

Author Topic: Top Down Racing Game  (Read 2811 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Top Down Racing Game
« on: March 25, 2017, 04:32:16 AM »
Hi!
I just wonder one thing. In my kind of top down racing game, it register new lap every time I cross the start/finish line. But also if I reverse the vehicle and cross the line in the wrong direction. My question is if it's possible to avoid that? To have a one way trigger or something like that.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Top Down Racing Game
« Reply #1 on: March 27, 2017, 06:53:31 PM »
Was my question to hard to understand?  8) I try again. What is the best way to register a new lap in a racing game? Sounds very simple, right? Every time the players cross the finish line, it will register a new lap. But not if the players cross the finish line in the wrong direction. That is my problem.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Re: Top Down Racing Game
« Reply #2 on: March 28, 2017, 02:27:05 AM »
Well... I'm sure that someone might have a better solution...

but what if you have 2 coliders each really close to eachother.

You manualy set up which is the correct colider...where you would expect the player to enter first. If the player enters the correct colider first then exits the next one, it's ok. If the player enters the wrong one and exits the good one... then it's bad.

Anyway... just an idea. I remember seeing something about this but I forgot where... and how they did this problem.

I'm also curious what would be the correct approach for this.
Technical Game Designer
www.GamerPET.com

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Top Down Racing Game
« Reply #3 on: March 28, 2017, 03:25:28 AM »
You could have various checkpoints throughout the track. Each checkpoint is a colider with on enter event. Three would probably do it, for one track. All three checkpoints need to be activated for it to be considered a lap.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Top Down Racing Game
« Reply #4 on: March 28, 2017, 06:16:08 AM »
Hi,
checkpoints would be good, but not 'All three checkpoints need to be activated for it to be considered a lap'

If a player would drive backwards multiple rounds and then go forward it would register a lap after the 2nd round even when he went 10 round backwards.

I would also use 2 collider like PET mentioned but then with some check points.

it is a bit hard to explain but i will try.
When the right trigger is hit, move to the next state.
When the wrong trigger is hit move to the previous state.

on the start/finish :

When the wrong trigger deduct one lap but do not show on the display (unless you want it to)
You need 2 variables : 'current lap' and 'highest lap'
When the right trigger is hit compare 'current lap' to 'highest lap'
if equal you can add a lap and display.
if current is lower than highest only add a lap to the current

i hope you understand what i mean.

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Top Down Racing Game
« Reply #5 on: March 28, 2017, 07:15:48 AM »
Hi, everybody, and thanks for the answers.

Djaydino:
Should I add FSM to the checkpoints? Or should I do all the logic on the Start/Finish trigger?

I did what tcmeric explained with 3 checkpoints, and it works. But the problem as djaydino said, if I drive backwards, then it will be problems. If I cross the finish line in the wrong direction, it will register a lap.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Top Down Racing Game
« Reply #6 on: March 28, 2017, 08:09:42 AM »
How about one checkpoint enable the next checkout (and disables) itself when the player drives through. Then as you drive around the track, the next one would always be ready. No going back. Of course, that solution would work best for single player ( but pretty complicated or not possible for multiplayer).

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Top Down Racing Game
« Reply #7 on: March 28, 2017, 11:17:01 AM »
I was planning to have multiplayer. 2 player splitscreen. And even online would be nice. And challenging. Never did that before. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no