nzso's Recent Forum Activity

  • First I can tell you that having Always is redundant when it's surrounded by other conditions. Secondly I'd recommend making a single waypoint object and giving them each a value dictating which one they are.

    Third, make it so when the waypoint's value equals the car, that a waypoint should be added to it.

    Finally, make it so when the car overlaps a point it sets the car's value to it's value+1

    I think that should do it.

    EDIT: Oh, and if car's value=31, set to 1

    So if I set Always (Every Tick) and then add sub events to it then those events are redundant? If so, that is good to know. Your solution is interesting. I will sit down and try and implement it when I get a chance. Thanks Yarfapet, you saved me a lot of time!

  • I am currently working with the RTS pathfinding behavior to try and accomplish a racing line to direct the AI around the tracks of a TD Racer I am working on. I have set up more than 30 points using individual sprites around the track to represent the path and am directing the ai to move from point to point determined by a private variable. The event sheet is getting way out of hand considering I am going to attempt to implement 22 ai opponents. I am thinking before I get to ahead of myself that I might want to think about making this met hod a bit simpler.

    My event sheet is looking something like what you see below.

    Timer is equal to 4000 - aicar01 set 'point1' to 1

    Always(Every Tick)

    +aicar01: Value 'point1' equal to 1 - add waypoint at point1

    - move to point1

    Always(Every Tick)

    +aicar01: Value 'point1' equal to 2 - add waypoint at point2

    - move to point2

    Always(Every Tick)

    +aicar01: Value 'point1' equal to 3 - add waypoint at point3

    - move to point3

    etc...etc...etc... until the ai car equals point 30 and then loops

    to change the value I have set it to change when you overlap each point as to create a loop

    so it looks like this.

    aicar01 overlaps point1 - set point1 to 2

    aicar01 overlaps point2 - set point1 to 3

    aicar01 overlaps point3 - set point1 to 4

    etc...etc...etc...

    As you can see this process becomes very repetitive when having to create each cars pathfinding and I would really like to simplify this. Any suggestions?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "On collision", and "is overlapping" need to be continuous just like always.

    In other words that condition needs to be checked every tick, start of layout just wont do.

    Thanks newt! I thought this might be the case but I kept thinking there must be a better way than to add all those collision checks to an every tick event. Much appreciated.

  • After spending some time playing around with Construct over the past few weeks I am trying to get a better understanding of how to correctly work with Collision Detection when using the various behaviors. One thing I noticed right away is , for example, if you applied car movement to a sprite and set various other sprites throughout the layout that where checked "solid" the car movement behavior handles the collision detection. This is also true for other behaviors that I had the time to play with.

    The custom movement behavior however does not handle collision detection, as I would imagine it wouldn't, but I am confused on how to "correctly" work with collision detection when using the custom movement behavior. I have done a few tests with "On collision with another object", I have set various collision modes with the "On start of layer" event and ran a few other tests but I am still getting faulty collision detection. What I mean by "faulty" is I, for example, I created one square sprite in the middle of the layout along with another sprite that I created a car movement system for with the custom movement behavior. I then used the "On collision with another object" event followed with the "Bounce" action. I noticed that half the time when coming in contact with the square obstacle I would bounce off and the other half I would drive right through with a quick speed decrease as if the collision detection caught and then failed.

    What I would really like to know is how to "correctly" work with collision detection when using the custom movement behavior. Any help is much appreciated. Thanks in advance!

  • I went ahead and took some of your advice. I had a chance to sit down last night and play with events. I did notice for some reason whenever using an "else" event along with the "on bounce" event the action(s) for the "else" event were not firing correctly. Using separate "on bounce" events along with another condition seemed to work fine. I also worked out the reverse issue by using an inverted key press event.

    Since I had some extra time last night I put together a small example of what I ended up with so anyone else that seems frustrated with the bounce effect within the "car movement" behavior can have a look at one of the possible solutions. The only thing that is missing from the example is if you let off the gas and then are hit by the ai car, you will come to a complete stop but this could easily be added. Enjoy folks and thanks for the help tulamide!

    Bounce Solution

    http://www.mediafire.com/?4564i6b96dylaga

  • Yes, that's why I said, that it only makes sense against other cars

    It is just a start, you would have to further split the events by adding sub-events, to catch all possible situations, e.g.

    + car's speed is negative

    -> set a variable to -1

    + else

    -> set a variable to 1

    + on bounce

    ++ colliding with another car

    --> Set speed as mentioned

    ++ else

    +++ variable is -1

    ---> do what is needed if the car hits anything but a car, while driving backward

    +++ else

    ---> do what is needed if the car hits anything but a car, while driving forward

    It should be doable. But, of course, you can always try to do it with custom behavior. It's just, that you don't need to completely redo the car behavior, just those on bounce situations, and therefore events are the easier solution with less overhead.

    I think I have decided to go the custom behavior route as I have already gotten the feel that I was looking for with the player vehicle and it would allow me to be able to customize more later if I run into any other snags. Your awesome tulamide, thanks for the help!

  • [quote:19l9tmek]+ On bounce

    -> car: Set speed to Abs(expression for get speed) - n * TimeDelta

    This is something I tried and works perfectly with just the right values. The only problem with this method (and I thought this may happen when thinking about it) is collisions with anything but a "moving" ai car will cause the player car to continually accelerate towards a wall or any other soild and will at times cause the player car to become stuck against a solid object.

    Edit: Also, using this method if the car is hits a wall or other solid object when in reverse the car will shoot forward in speed.

  • this is probably a useless hint,but with some work u could get a decent car movement with physics behavior. i once tried to do it,and almost managed,but i couldnt figure out how to make proper steering..(i could only steer/turn when accelerating,didnt find any way to make it right. mind you though,im just a beginner,im sure someone with more experience could pull it off)

    That's a option I considered but for now I am trying to keep things simple enough without becoming to dull. I am still playing with all the options though so I may start looking at some physics behavior in the near future.

  • I would love to give you an exact example, but I don't have a pc to work with Construct for quite a while.

    But you really don't need another behavior, just use events that take over control as soon as the car behavior needs tweaks.

    Your idea is what I would do, too. Adjusting the speed, via 'Set speed'. Do it over time (n * TimeDelta). And keep in mind, that when bouncing, all values are expressed negative. If you don't want the car to go backwards, but rather slow down against zero, just reverse 'Get Speed' with abs() in the 'on bounce'-event.

    + On bounce

    -> car: Set speed to Abs(expression for get speed) - n * TimeDelta

    n being pixels per second, e.g. 'Get deceleration'

    This would decelerate linear and only when bouncing, making sense only when hitting another car for several ticks. It's just a simple approach to point to the right direction. For more detail I would need to work with Construct. I'm sorry.

    No problem, any help at all written or example form is helpful especially since I am attempting to slowly learn the functions and methods used within Construct. Getting used to the interface, available functions etc. is going to take some time. Thanks for the help tulamide.

  • I just tested the on bounce trigger by adding stop when the action is triggered but unfortunately coming to a complete stop is not really what i am shooting for. When the car is going around the track and hits the backend of an ai opponent I am trying to more or less cancel the bounce action out from the player controlled car (slightly reducing speed) and then causing the ai opponent to "bounce" slightly from impact. My first step though is trying to get rid of the bounce effect on the player controlled car.

  • The car behavior is rather limited in the points you mentioned. But there's a trigger, 'on bounce', it will be triggered once, exactly after a collision. I used it to get rid of bouncing, by using the action 'stop', in Verve!.

    You could use the trigger to dampen the bouncing. Also, decceleration is quite possible.

    When the car drives backwards, the velocity is expressed negative. Just create a condition that checks for velocity < 0, and dampen the velocity in some way, e.g. velocity = velocity - velocity * TimeDelta, or whatever is to your likings.

    Much appreciated tulamide. I had noticed the "on bounce" trigger and did in fact play with it for awhile hoping to cancel out the bounce by adjusting the speed of the vehicle when compared to it's relevant speed but didn't get a chance yet to really play around with that idea. I am assuming that in order to apply a deceleration system to the car I will have to do this by adding a custom movement behavior to the vehicle on top of the car movement behavior? I was just hoping that by doing so there would be no conflicts by adding more than one behavior.

    I would be interested to know how you might go about dampening the bounce effect through the on bounce trigger. An interesting idea, I will have to play around with it.

  • After some searching I did find this example

    http://dl.dropbox.com/u/1646976/GP2.cap

    The custom movement in Layout 2 is nowhere near the feel of the included behavior and there is still no deacceleration when going in reverse. It's truly a shame these two options where not made editable in the included Car Movement behavior.

nzso's avatar

nzso

Member since 12 Jun, 2011

None one is following nzso yet!

Trophy Case

  • 13-Year Club

Progress

13/44
How to earn trophies