User Tag List

Results 1 to 7 of 7

Thread: Need Help With Traffic Game

  1. #1
    Clicker Fusion 2.5 (Steam)

    Join Date
    Jul 2014
    Posts
    92
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Need Help With Traffic Game

    Hi Everyone,

    I am working on a traffic type game and I am getting super confused and need some help. The game has traffic enemy ai cars. I want to program the cars to drive forward forever unless they run into another car or obstacle. I made a system where I can give each car a target x and y coordinate and it will drive to that coordinate. I made this assuming I might need pathfinding for my AI. But I think I wouldn't since I would just want the car to go forward or change lanes if it gets stuck.

    I have a tilemap to tell me what is road vs no road so that part I can easily detect. The problem for me is figuring out how to do collisions between cars. Also how do I make it so the car tries to stop if their is a car that cuts it off? Any examples or ideas on how I can structure and program this?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Never approached a traffic-jam system,
    that seems to pose an interesting set of things to figure out!

    First of all,
    I think we should know what kind of movement you used for your cars / could you change that?

    And secondly,
    all could become lot different if you plan pathfinding or not,
    if cars can just roam around randomly (going straight-steering-stopping, etc.)
    or if you need to give them a "destination" (wich I think not)

  3. #3
    Clicker Fusion 2.5 (Steam)

    Join Date
    Jul 2014
    Posts
    92
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The movement I use is custom float movement. I do a for each loop and call some fast loops to calculate the movement and perform collision tests with my tilemap. I was going for a move to target like movement system where I would tell each car where it's target x and y would be and it would move to that location. Problem I found is that doesn't work if there is an obstacle in the way or someone cuts off the car.

    The destination is just to get to the top of the screen. I think logic to either move forward or change lanes if blocked will work well enough for my game.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    I must admit,
    I've driven all way back home from work studying traffic jam,
    considering wich active objects taking into account (other cars, road conformation, traffic signs),
    thinking which alterables values I was modifying in my car to give it the correct behaviour
    It was too challenging not to try!

    Then, back home, I started to build up something...
    ...and I came out with a complete mess

    Sorry not being more helpful, but there are really many things to take into account,
    and unless you're going to make a strictly predetermined (-> path) movement for your cars
    I guess it's going to be a longer study to put down than an hour or so.

    But it's too funny not to post... so here it is:

    traffic.mfa

    Raw, messy and unpolished.
    It may give you another viewpoint... or maybe an example of what not to do!

    Hope you don't get too many explosions

  5. #5
    Clicker Fusion 2.5Android Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)
    Vetmora's Avatar
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's something I've developed in the past. It's something that I've expanded onto originally coded by Sketchy from The Daily Click.

    Cars X.mfa

    It's pretty simple and doesn't cover traffic jams or changing lanes, etc. Only really traffic lights. It may be of some use.

  6. #6
    Clicker Fusion 2.5 (Steam)

    Join Date
    Jul 2014
    Posts
    92
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Whoa, these examples are way more advanced then what I had in mind. But it gave me a bunch of ideas on how to make what I need for my game. Thank you to you both. I will report back after taking another swing at it.

  7. #7
    Clicker Fusion 2.5 (Steam)

    Join Date
    May 2013
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    please try and throw in some road ragers for added danger.....cut him up...hes gonna chase you down sort of thing

Similar Threads

  1. FLASH GAME LICENSE - FGL sponsorship, first game release advice
    By DEKE15 in forum SWF/Flash Export Module Version 2.0
    Replies: 1
    Last Post: 24th January 2014, 06:51 AM
  2. Donkey Kong JR Game & Watch cloned into arcade game some MMF2 technical problems.
    By daryuss in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 9th June 2013, 09:17 PM
  3. Open exported html doc, game doesnt load. When opening raw SWF, game fits screen!
    By Oreo in forum SWF/Flash Export Module Version 2.0
    Replies: 5
    Last Post: 19th November 2012, 03:16 PM
  4. Monetizing Foreign Traffic on SWF Ads?
    By redpandagames in forum SWF/Flash Export Module Version 2.0
    Replies: 4
    Last Post: 31st August 2012, 05:39 AM
  5. need help about traffic flow
    By webwolf in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 26th March 2012, 06:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •