[SOLVED] Racing Game, collision, getting stuck problem

0 favourites
  • 10 posts
From the Asset Store
Watercolor Fantasy Races Bundle includes over 2,100 images
  • Hi, I'm working on a simple racing game, and while trying to make some collision between the AI I ran into some problems.

    Just so you know I'm using 2 plugins by rewrainbow, "MoveTo" and "PushOutSolids", those can be found here:

    http://c2rexplugins.weebly.com/rex_moveto.html

    http://c2rexplugins.weebly.com/rex_pushoutsolid.html

    Move to is used to make the ai cars move around the track, and PushOutSolid I'm trying to use for collisions, adding Solid and PushOutSolid behaviour to the AI controled cars seemed to be the best option so far.

    The problem I'm having is that sometimes the AI get stuck and stop moving. I'm still not too sure about what is happening.

    It's fine if them bump into each other or even have a little bit of overlapping, I just don't want them to completely run over each other.

    I'm looking for any tips on how to improve collisions, different approachs are also welcome.

    Below is the current capx I'm working on.

    Stuff to look at:

    AICar object (collision polygon and behaviours)

    AI eventSheet (makes everything move)

  • Cant open your file right now , but avoid on a certain radius will probably solve your problems, from those that i am reading of at least.

  • Michaelb how would you go about coding that avoidance? As I'm using the MoveTo behaviour I feel I'm a bit limited on what I can do. If you got the time please have a look at the capx

  • anyone?

  • Hello Caio ,

    i will look at it today and message you.

    Take care.

  • Just a thought (don't have the plugins, so can't see your capx), have you messed with the cell size and cell border setting of the pathfinding behavior? (or do those plugins replace pathfinding?)

  • So I took a look to the capx.

    I tried several adjustment, but still there is a chance the cars will eventually stop moving when they are overlapping. I did an inspection on debugger & watch the remain distance of stopped car was negative value. While other cars that still run, show positive value.

    Yes it is something to do with the plugin 'move to'

    I suspect the negative value cause the error

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • spacedoubt MoveTo is replacing the pathfinding behaviour

    alextro thanks a lot for having a look at it. I've never messed with the debugger in Construct, I'm gonna have a look at it, maybe I can acess remaining distance as a variable and I don't know, this way I might be able to make a quick fix restarting the move behaviour. I might even try to modify the behaviour and make it acessible for debugging purposes, in case it's not.

    Thanks for pointing that out.

  • I modified(broke) the plugin to work in this case, thanks everyone, specially alextro for pointing out what could be causing this problem.

  • Oh well it's really good for you then, if you can handle the problem & modified the situation

    Good luck with your racing game.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)