News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Let It Be , now released !! horse racing game

Started by micky4fun, May 17, 2012, 07:29:03 PM

Previous topic - Next topic

micky4fun

Hi All

Quoteone of my favorite films of all time is "let it ride"
well managed to get this on dvd , and found it pretty good worth a watch , not quite like horse racing in the uk , but the begining was not a milllion miles away from how i recieved some tips a few years ago
away after watching film , i tried the key input way of mapping the ai horses and its a lot more acurate than the one i did before with the mouse method , so i will hang about for the courses and obsticales
before mapping othe runners out , no rush on them as i will be taking my time anyway , trying a few ways of doing things , must admit first time i looked at writing and reading files for the ai , quite easy and could be quite handy in the future ,

mick :)

BlinkOk

good to see you got to watch it. it reminded me of my punting days. guys would NEVER jump up and down when they were winning. they would always quietly say "im having a good day". there was even a bar
at my track that was a lot like the one in the movie.
anyway. to show i'm not woking on what i should be i did a horse selection screen.

micky4fun

Hi all

gfx's look really good at the moment great cartoon looking horses , see a slight change to Charity and dont see faith healer in the ones to pick and hoping the jockey does not fall off of lord byron , lol
ahh you was a punter to , intesresting ! , well a few still jump up and down here , the day out a year punter that is.

rather that start anything yet , i am just tinkering about at the moment and will wait till most gfx's are in , there no rush what so ever ,

thanks
mick :)

BlinkOk

no worries mick. i just got those names off the top of my head. been a little while since i've seen the movie (generally i watch it after if had a punt which is about Melbourne cup day for me)
i hustled up a bit of a splash screen as well as the stuff i sent you.

micky4fun

Hi All

ok thanks BlinkOk , yep got the file , all looks fine to me and dont think the oval shape track will cause any problems  , splash screen looks good to , i am at work at the mo , but will av a muck around with it tonight and see what it looks like in action

thanks
mick :)

BlinkOk

no worries mick. could you try something for me; could you try going around the track counter-clockwise instead of clockwise. for some reason it seems a lot easier to me. (maybe i'm just dreamin)

micky4fun

#21
Hi All

blinkOk , well did not have as much time as i wanted last night as traffic getting home was a nightmare , anyway did a bit of tinkering and playing the other dog game as well to get a feel of it , so all i managed to do is below , just your dog going around the track , no animations , shadows or fence collisions yet , but just wanted to know if the control is our you want it , it can be adjusted with the values in program , also playing the other game and this one i think the straights are a bit to narrow , what do you think?

will get much more time this weekend , also i need to adjust my ai input program for the other horses so they have the rotation angles in it as well , for when they avoid things in the straights and bends

mick :)

BlinkOk

#22
looks superb mate! feels good too. no rush. take your time. do you think it might bet a bit crowded in the straights

micky4fun

#23
Hi All

Quotelooks superb mate! feels good too. no rush. take your time. do you think it might bet a bit crowded in the straights
well its not to bad , depends as the horses do take up a bit of space when not running in a straight line , just seemed the straights in the other game were quite wide so horses could turn easy to avoid things

here is what i have come up with , just a quick demo , paths will be more persise and not so erratic as this demo , but just to show paths , 3 horse will race around still in wrong direction at mo , just press spacebar and they will reset and run at a random speed but still  the same paths as before, still no animations yet as still trying a few ways of doing things , think there is proberly an easier way of loading the files and putting them in the dim statments , but this works if a little out of the way method ,

mick :)

BlinkOk

looks awesome. i'll make sure i make the straights wider maybe the turns too, just a wider track in general.
i had a bit of a brain fart on the direction last night so don't worry about making them go the other way round.
clockwise should be fine

kevin

#25
Quote
think there is proberly an easier way of loading the files and putting them in the dim statments , but this works if a little out of the way method

  Had a quick look at the example and yeah,  it's really not an ideal long term method.  It'll work, but ultimately you're making more work for yourself for no real benefit.  If you're going to store data externally, then it's preferable to no avoid hard coding things like files names, sizes into the program.  

  For example, since the file names are sequential, we can construct the file name inside the loop and load them with a slight variation.

PlayBASIC Code: [Select]
  for b=1 to 3

; Make this file name
File$="horse"+str$(b)+"_track1.txt"

; make sure it exists
if FileExist(File$)

readfile file$,1

for a=1 to 3000
hx(b,a)=Readint(1)
next a

for a=1 to 3000
hy(b,a)=Readint(1)
next a
for a=1 to 3000
hr(b,a)=Readint(1)
next a

CloseFile 1
endif
next b




  This is preferable as now to add more paths, we don't need to hard code file names into the program, we just bump the 'b loop end counter'    
 
  But, do we really need 3 fixed sized loops ?  The answer is no, as by saving the data in triplet form, we can remove the two extra loops.  In other words we store the X,Y and R values all together in save data.

 If we did that we've end up with a loader a little more like this.

PlayBASIC Code: [Select]
  for b=1 to 3

; Make this file name
File$="horse"+str$(b)+"_track1.txt"

; make sure it exists
if FileExist(File$)

readfile file$,1

for a=1 to 3000
hx(b,a)=Readint(1)
hy(b,a)=Readint(1)
hr(b,a)=Readint(1)
next a

CloseFile 1
endif
next b





 The  next thing to look at would be only storing the needed data.   Since the path data seems to be storing every precomputed position (a better idea is use delta paths), the length of the paths will differ.    So why store and load back more data than is needed ?   To do that, we can store the number of points in the file.  So the first integer say in the file would be the number of triplets following it.

  Which gives us a loader looking something a little like this

PlayBASIC Code: [Select]
  for b=1 to 3

; Make this file name
File$="horse"+str$(b)+"_track1.txt"

; make sure it exists
if FileExist(File$)

readfile file$,1

Path_Size=ReadInt(1)

for a=1 to Path_Size
hx(b,a)=Readint(1)
hy(b,a)=Readint(1)
hr(b,a)=Readint(1)
next a

CloseFile 1
endif
next b






 This has a knock on affect,  since the loader gets the path length, we don't have to hard code the value in the program anymore.  So you can alter the path externally without touching the program code at all.  


     

micky4fun

Hi All

ok BlinkOk , yep think a slightly wider track will make thinks lest crowded , ok i will stick to the way round its going at the moment , but can alway flip it around later
Kevin , thanks for the code for loading the files , i will amend the writing program for the paths so this new code works , thought there was an easier way , makes it much more simpler

mick :)

micky4fun

#27
Hi All

ok here is a little playable demo , you are the bottom horse , press spacebar once to start , the upkey to move forward and left and right key to steer , then to reset kinda ,, press spacebar again
this is just a playable feel demo

later demo in forward posts

mick :)

BlinkOk

#28
lookin very nice mick. (i'll shoot you some stuff later on today)
i dunno if we've been over this before but have you had a look at FLASH INTEGRATION WITH PLAYBASIC (login required)
if you're comfortable with that then i could handle all the GUI stuff in flash so you could concentrate on the gameplay.
let me know what you think huh.

micky4fun

#29
Hi all

BlinkOk ,

Quotei'll shoot you some stuff later on today
ok mate , no rush , as it gives me time to experiment with a few things within the game
Quote[FLASH INTEGRATION WITH PLAYBASIC

well will give it ago , and look good with some of your work in the game , if i can't suss anything out im sure someone might help me , but i seem to have trouble getting the demo in that thread working properly , tried with pb 1.64n and 1.64m
the arrow keys do nothing and i cannot get out of the program with out doing a hard playbasic reset
so that might not help us

mick :)

added

just tried that demo within my game and i am having the same problem as above , cannot esc out of program and arrow keys do nothing , when mouse is moved over putter etc they work ok , but nothing else
tried on 3 pc's now all the same , wonder if you get the same results and will this effect your flash program within the game ?

mick :)Error Missing Closing Square Bracket