Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Make a simulated sports game?

Author
Message
Gamemasher
15
Years of Service
User Offline
Joined: 22nd Mar 2011
Location: United States
Posted: 23rd Jun 2011 22:25
My friend wants me to make a text-based simulated horse racing game for his site. Horses with specified stats such as sped, endurance, etc. would be bought on the site. It would be an RP thing where racers post their horses and stuff and whoever runs it enters the info into a "decider" which I am trying to make and is informed of the winner. I know that it is possible to make random number generators in DBPro but is it possible to have it where I enter the info and then the "decider" decides who wins based on the stats but there is still a chance of something unexpected happening? How would I do that? Thanks.
SH4773R
16
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 24th Jun 2011 03:31
Well you could just compare the stats in the program to find the logical winner then genorate a random number then depending on if the random number is say 5 make the horse who would have lost win.

Basicly:

If horse1speed > horse2speed
If Rnd(100) <> 5 then horse1win = 1
Endif
if horse1speed < horse2speed
If rnd(100) <> 5 then horse2win = 1
endif


(Untested code)

Good luck

Spritzen
16
Years of Service
User Offline
Joined: 12th Aug 2009
Location:
Posted: 24th Jun 2011 14:20 Edited at: 24th Jun 2011 16:11
Or something like this (again untested code)

SH4773R
16
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 24th Jun 2011 20:13
Use spritzen's code, its better

Gamemasher
15
Years of Service
User Offline
Joined: 22nd Mar 2011
Location: United States
Posted: 24th Jun 2011 23:21
Thanks guys If I wanted to add more variables such as endurance, acceleration, etc. I could incorporate that in too in a similar fashion, right?
Gamemasher
15
Years of Service
User Offline
Joined: 22nd Mar 2011
Location: United States
Posted: 25th Jun 2011 05:32
Spartizen, syntax error on line 2. I'm pretty new so I don't know how to fix it.
Gamemasher
15
Years of Service
User Offline
Joined: 22nd Mar 2011
Location: United States
Posted: 25th Jun 2011 05:33
Wait never mind.

Login to post a reply

Server time is: 2026-07-11 05:25:05
Your offset time is: 2026-07-11 05:25:05