Racing game

Previous topic - Next topic

MrTAToad

This is a test program for a game I'm thinking of doing.  I did try something like this a year or so ago, but didn't get anywhere.  However, I'm starting things again and the idea works pretty well.

Its loosely based on an iPhone game I played when I had the device (can't remember the name though) - the idea is to race past all the obstacles within the allotted time.  Hitting an object will stop you and bounce you back a bit...

I wrote a simple (at the moment at the movement) routine that displays only a section of the track and not the whole thing, so very large tracks could be made without any slowdown.

I'm hoping that the program will allow user defined tracks (which could use in app purchases) as well as computer generated ones based on required distance and difficulty.

At the moment, aside from blocks, I'm working on other objects as well including shapes, like spheres with holes in.

As you can see from the screenshots, textures are messed up - this is because I was originally using gameSpace to create the objects, but have now transfered to using the demo version of AC3D.

I've included the Windows and Palm Pre version - will also be interesting to see how the Android version runs too...

The Pre version runs very smoothly, mainly because my track routine seems to be working very well :)

[attachment deleted by admin]

bigsofty

Very nice idea, its unique to me at least? I will be interested to see how this develops!  :good:
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Ian Price

That's nice and smooth (Pre), but I'm crap at it - my 3D spacial awareness is good, but my motor skills in the rotational dept. are lacking!
I came. I saw. I played.

Slydog

Cool, this would work great for a game!  :good:

The included map isn't random correct? 
I found that if you find the sweet spot near the center, you will squeeze through and fall without hitting anything.
It'll keep going faster until the program crashes (or exits). 
Not a complaint, ha I know this is very preliminary, I just thought it was fun!
I assume you're 'falling' down (as opposed to 'flying' through a tunnel)?

You could add power-ups such as:

  • fall speed / gravity modifiers (+ or -)
  • movement modifiers to speed / slow your x/y movement
  • player size modifiers (if you decide to show the player)
  • block size modifiers (change the overall scale for all blocks to make it easier for a bit)
  • remove (ha or add!) some blocks entirely for a bit to make it easier
  • score / time modifiers (x2 etc)
If your level had walls surrounding the perimeter, you could add alternate (or secret) routes.

Good luck with this, I'd like to see where you can take it!
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

MrTAToad

Yes, its randomly generated...  With other objects apart from blocks, being able to just keep to the centre shouldn't then work...

Its supposed to be flying through a tunnel, although falling down would also work.  Unfortunately I can't remember the iPhone game name - it was something like "3D Tunnel Race" or something...

I had thought about allowing the player to hit what would be the play boundaries to slow down...


MrTAToad

#5
Here are some new videos for you :







As usual Fraps cant record the program correctly, hence the static every so often...

You might want to try the included program...


[attachment deleted by admin]

Ian Price

That looks pretty neat - a massive improvement over the original demo. :)
I came. I saw. I played.

matchy

Progressing well.

The four player mode is interesting. Could you tell us more about that?! 8)

MrTAToad

The idea will be to finish first or something.  Its a split-screen mode (it will allow between 1 and 4 players).

MrTAToad

#9
Can you give this try.

I get a steady 59FPS on this medium short course.

There is a bit of popup mainly due to the need to finding the optimal distance I want to draw the track.  I think that part is now as optimised as much as possible :)

This is my track display routine :

Code (glbasic) Select
FUNCTION DisplayCourse%:setup AS TSetup,player AS TPlayer,speed
LOCAL currentUserArrayPos%,startArrayPos%,piPow%
LOCAL collision%,endArrayPos%

currentUserArrayPos%=MAX(INTEGER(player.ReturnZPos()/OBJECT_STEP),0)
endArrayPos%=MIN(currentUserArrayPos%+18,BOUNDS(self.track[],0)-1)

FOR startArrayPos%=MAX(currentUserArrayPos%-2,0) TO endArrayPos%
self.DisplayBorder(setup,self.track[startArrayPos%].border)

collision%=self.DisplayObjects(setup,player,startArrayPos%,currentUserArrayPos%,self.track[startArrayPos%].object[],speed)

IF collision%
// There was a collison between an object, so bounce the player off the object
player.BouncePlayer()
ELSEIF startArrayPos%=currentUserArrayPos% AND BOUNDS(self.track[startArrayPos%].object[],0)>0
piPow%=POW(2,player.ReturnPlayerIndex()-PLAYER_1%)

IF bAND(self.track[startArrayPos%].processed%,piPow%)=0 // AND startZ>self.course[arrayPos%].z
self.track[startArrayPos%].processed%=bOR(self.track[startArrayPos%].processed%,piPow%)

player.ChangeTopSpeed(0.05)
player.UpdateScore(10.0)
player.UpdateTime(5.0)
DEBUG "Speed Increase\n"
//KEYWAIT
ENDIF
ENDIF
NEXT
ENDFUNCTION

FUNCTION DisplayBorder%:setup AS TSetup,border AS tTrackBorder
X_MOVEMENT border.x,border.y,border.z
X_ROTATION 0.0,0,0,1
X_SETTEXTURE setup.spriteLoadData[border.spriteID%].idNumber%,-1
X_DRAWOBJ setup.objectLoadData[border.objectID%].idNumber%,0
ENDFUNCTION

FUNCTION DisplayObjects%:setup AS TSetup,player AS TPlayer,currentArrayPos%,playerArrayPos%,objects[] AS tTrackObject,speed
LOCAL collision%
LOCAL loop AS tObject

collision%=FALSE

FOREACH loop IN objects[]
X_MOVEMENT loop.x,loop.y,loop.z
X_ROTATION loop.angle,0,0,1
X_SETTEXTURE setup.spriteLoadData[loop.spriteID%].idNumber%,-1
X_DRAWOBJ setup.objectLoadData[loop.objectID%].idNumber%,0


SELECT loop.rotationType%
CASE ROTATION_NONE% // Do nothing

CASE ROTATION_ROTATE1% // 360 degree movement
INC loop.angle,speed*loop.rotationSpeed*loop.rotationDir
IF loop.angle<0.0
INC loop.angle,360.0
ELSEIF loop.angle>=360.0
DEC loop.angle,360.0
ENDIF

CASE ROTATION_ROTATE2% // Yo-yo
ENDSELECT

IF currentArrayPos%=playerArrayPos% AND X_COLLISION(loop.objectID%,0,2.0,player.object.x,player.object.y,player.object.z) THEN collision%=TRUE
NEXT

RETURN collision%
ENDFUNCTION


I have found that finding the holes for some objects can be tricky as all objects use the same texture, some shapes can blend in with the next one...  Would make things more interesting too anyway.

The program will stop at the end - this is due to the deacceleration value currently being too large :)

Collision detection isn't quite as optimal as it should be yet...






[attachment deleted by admin]

MrTAToad

If you haven't seen it already, I uploaded a new video of the game :



At the moment, I'm upgrading most of the graphics to 2.0, but I've included the program as well..

[attachment deleted by admin]

matchy

Nice. I'm interested to see what the texture map designs will be like.

Kitty Hello

it looks really nice.

MrTAToad

Thanks - the improved graphics also helps things too...

erico

looks great, maybe the player could have some sort of transparency? maybe only around the middle part, like glass or something?