Simulate a race result with arrays?

0 favourites
  • 13 posts
From the Asset Store
Top Down Racing Game Pixel Artwork for any kind of racing game you can imagine.
  • Hey folks,

    I'm developing a racing manager game right now.

    But now I just have some trouble in simulating a race (without visual just result)

    This is what I got:

    ArrayTeam

               Team1     Team2
    Name       team1     team2
    Car          80        74
    [/code:ygb3edri]
    
    [b]ArrayDrivers[/b]
    
    [code:ygb3edri]
               Driver1     Driver2     Driver3    Driver4
    Name        alex       daniel      kevin      niko
    Skill       65         70          84         61
    onteam      team2      team1      team2       team1
    [/code:ygb3edri]
    
    Now I wanted to simulate a race mixing the car performance and the driver skill (Plus a random given tolerance by +/- 10% for every car and driver. That way I would get some random rankings). After that I wanted to show a a result text screen with every driver gets points for the position they ended up with (1st gets 25 Points, 2nd gets 18 and so on).
    
    My english is not the best. Hope anyone can help me out with it!
    
    Regards,
    Kraudi
  • No one with some array knowledge out there?

    Can't figure it out...

  • I've got something to work but now I still have some

    problems.

    I sorted the array but sometimes some names are shown duplicated and sometimes it works great.

    Dont know why this happens. Anyone has some experience with it?

  • RaceArray.capx

    edit: ...fixed capx...I hope...

  • RaceArray.capx

    edit: ...fixed capx...I hope...

    Wow! Thank you very much! Exactly what I was trying to do. I'll try to integrate it into my project.

    Looks like I have to read some array stuff to get more comfortable with!

    Just one question. I wanted to add a drivers and team standings into the app. Can I easily add the won points to the Drivers and Teams Array?

    Thank you!

  • I wanted to add a drivers and team standings into the app. Can I easily add the won points to the Drivers and Teams Array?

    Of course.. just give me some time to figure out the easiest way...probably another array or two

  • > I wanted to add a drivers and team standings into the app. Can I easily add the won points to the Drivers and Teams Array?

    >

    Of course.. just give me some time to figure out the easiest way...probably another array or two

    Wow cool! SOunds great. Thought the same about a new array. One for DriverStandings and one for TeamtStandigns maybe?

    Edit: I've seen you integrated possible crashes. That is an awesome little feature. I really like this. Just tested it and seen that the crashed drivers have no name on the classement (I think because you delete the whole line). Is it possible to set the crashed drivers to the end of the standigns and instead of points give out a text like "DNF"? That would be awesome Because then I could extend this myself to technical car failures also.

    Sorry for the bunch of questions. I just try to understand the way you are doing this nice capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To display the crash : Capx modified

    Use a specific index value, use a function to display the score, allow to navigate between the different result page (20 racers for 12 results only displayed).

  • To display the crash : Capx modified

    Use a specific index value, use a function to display the score, allow to navigate between the different result page (20 racers for 12 results only displayed).

    Ah now I understand. Thanks for the excellent addition!

    I also extended the standings to display all 20 on one page. But your way is also very cool if you have more drivers.

    Thank you very much for your time! Well done.

    Now I only need to get the driver standings and team standings to work

  • Kraudi please check function "printRank" ..

    I'm not sure that gives correct results..and really do not have time..

    race2Array.capx

  • Kraudi please check function "printRank" ..

    I'm not sure that gives correct results..and really do not have time..

    race2Array.capx

    Simulated 10 races and it looks good to me. Looks like it's counting correct!

    BIG thank you for your time! I'll look deeper into it after work:)

    Thank you!

  • I wanted to say thank your for your help in this case!

    I've integrated most parts of your capx files into my project. It works great!

    Regards

    Kraudi

  • Just one small question I have left.

    I've had some cases where at the end of the season 2 drivers had the same amount of points. So I need the driver with more wins/more 2nd places/ etc. as champion. Is this difficult to add to? What would be the easiest way to this? Maybe add every position they gained in the ArrayDrivers?

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