UnderwareDESIGN

PlayBASIC => Show Case => Topic started by: monkeybot on January 23, 2014, 12:15:54 PM

Title: Super Drift Racer!!- WIP
Post by: monkeybot on January 23, 2014, 12:15:54 PM


Use the arrow keys to control the car.
UP to Accelerate
Down to Brake


Don't be tempted to hold accelerate down or you will surely crash!!!

The car will slow gently by it's own accord



Title: Re: Super Drift Racer!!- WIP
Post by: ATLUS on January 23, 2014, 12:52:31 PM
Not bad.
Title: Re: Super Drift Racer!!- WIP
Post by: BlinkOk on January 23, 2014, 05:28:36 PM
looks good monkey dude.
i think i need to see more of the track. it's almost impossible to react quickly enough to the turns.
i got stuck a couple of times in the walls
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 04, 2014, 01:15:01 PM
hmm no one  has downloaded the new version. :-(
Title: Re: Super Drift Racer!!- WIP
Post by: kevin on February 04, 2014, 01:27:11 PM

didn't know there was a newer version, can't see edits.

Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 04, 2014, 02:09:30 PM
ahh,i should have made it more obvious.

Super Drift Racer!!- Early Days WIP

NEW DOWNLOAD UP 16:31   25-1-14

Improvements Are-

Ghost Car.
Better Handling.
Better collision.
larger screen.


lots of other stuff that you can't see

http://www.underwaredesign.com/forums/index.php?topic=4135.msg27930#msg27930

i am slowly working on racer AI now,that's quite challenging,i have a few ideas i am knocking around.
Title: Re: Super Drift Racer!!- WIP
Post by: BlinkOk on February 04, 2014, 09:29:06 PM
better but i would still like a bigger view. (see attached)
i would be good if i slowed down when the up arrow wasn't pressed

it looks like it's tile based, is that right?
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 05, 2014, 11:52:19 AM
it does slow down a bit,and in the new version the faster you go, the closer to the back of the screen you get.
it is tile based indeed.
do you fancy doing some gfx? i didn't want to ask as you seemed quite busy.
Title: Re: Super Drift Racer!!- WIP
Post by: BlinkOk on February 05, 2014, 06:52:27 PM
Quotedo you fancy doing some gfx?
for now i think i'll pass on the gfx. not much free time atm
it looks good though monkey dude. keep working on it
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 06, 2014, 12:14:16 PM
no worries
Title: Re: Super Drift Racer!!- WIP
Post by: kevin on February 07, 2014, 07:19:22 AM
 
  Looked at the demo the other morning was thinking it might look even cooler with some shadows and  even some parallax  / layers stuff in the scene.   If the camera doesn't zoom in/out then the cost of drawing the odd overlay is pretty small.   Will try to find time over the weekend/tonight to knock a demo of what i'm thinking about.   


Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 07, 2014, 12:15:10 PM
funnily enough i was thinking of zoomy camera action , shadows are in now as are bridges(going under and over(is that what you meant by parallax?))


Title: Re: Super Drift Racer!!- WIP
Post by: kevin on February 07, 2014, 01:53:05 PM

  Imagine a 3D scene viewed top-down from a camera to doesn't move in/out along the (Z) axis, only on left/right (X) and UP/DOWN (Y)..    Now take our 2d scene and grid it into 3D.  So the blocks verts would be the same width/height apart, but have a depth.    When all the tile coordinates are the same depth we get a traditional 2D scene when  viewed from a fixed perspective.    But if some in the grid coords are higher than others we get perspective.  So the scene looks more 3D, but really isn't.   

  This is how the Thesius XIII tech demo works, only difference is it's a side view.. it'll work top down though. 

 

Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 07, 2014, 02:24:51 PM
(http://www.computerbrains.com/ScreenShots/ccs23.JPG)but what objects would you apply it to?

Title: Re: Super Drift Racer!!- WIP
Post by: kevin on February 08, 2014, 09:50:31 AM

with a more 2.5D scene you can have mountains / houses / trees maybe.. 
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 08, 2014, 10:27:08 AM
ahhh i see
Title: Re: Super Drift Racer!!- WIP
Post by: kevin on February 08, 2014, 10:43:08 AM
 Here's top-down height map a mock up, there's a few errors in it, but basically it shows the concept.   You wouldn't actually need to draw the ground as triangles, provided the camera never moves on the Z axis.   When the foreground occludes the map, just cull the blocks . 


[pbcode]


   Constant ProjectionX = 400
   Constant ProjectionY = 400


   Type tTerrainVertex
            x#,y#,Z      ; 3d SPACE CORD
            px#,py#      ; project 2d coord
            Col
            Flat         ; ground tile ? (drawn in first pass)
   EndType



   groundheight=1500

   GridSize=30
   Dim Terrain(GridSize,GridSize) as tTerrainVertex
   
   For ylp =0 to GridSIze
      For xlp =0 to GridSize
            Terrain(xlp,ylp) =new  tTerrainVertex
            Terrain(xlp,ylp).x = (xlp*400)
            Terrain(xlp,ylp).y = (ylp*400)

            DIST#=getdistance2d(0,0,gridsize/2,gridsize/2)

            Terrain(xlp,ylp).z = 1500
            Terrain(xlp,ylp).flat = 1
            
            Terrain(xlp,ylp).col=rndrgb()
      next   
   next


   for lp =0 to 30
         x=rnd(gridSize-2)
         y=rnd(gridSize-2)
         depth=GroundHeight-rndrange(100,300)
         Terrain(x,y).z = depth
         Terrain(x+1,y).z = depth
         Terrain(x+1,y+1).z = depth
         Terrain(x,y+1).z = depth

         Terrain(x,y).flat = 0
         Terrain(x+1,y).flat = 0
         Terrain(x+1,y+1).flat = 0
         Terrain(x,y+1).flat = 0
         
   next



   ; Clip the Camera
      Xrange=8000
      YRange=8000

        CamX=00
       CamY=00
       CamZ=-ProjectionX
   
   
    StartPass=1
   
   
          c1=$205020
;         c2=$605020
         c3=$406020
         c4=$40300
         
   
   Do

         cls $406080
      
      // project /rotate points
         For ylp =0 to GridSIze
            For xlp =0 to GridSize
      
               z#=Terrain(xlp,ylp).z-CamZ

             ; Check if the Object is in front of the camera (positive)
               If Z#>0
   
                   ; Translate the X# / Y# cooords object To the camera
                     x#=Terrain(xlp,ylp).x-CamX
                     y#=Terrain(xlp,ylp).y-Camy

                  ; Calc projected X /Y coords
                     PX#=CameraCenterX#+((x#*ProjectionX)/Z#)
                     PY#=CameraCenterY#+((y#*ProjectionY)/Z#)
   
                     Terrain(xlp,ylp).px#=px#
                     Terrain(xlp,ylp).py#=py#
   
               EndIf
   

            next   
         next


         lockbuffer




      // project /rotate points
         For Pass=0 to 1
            For ylp =0 to GridSIze-1
               For xlp =0 to GridSize-1

                  x1#=Terrain(xlp,ylp).px#
                  y1#=Terrain(xlp,ylp).py#
                  
                  x2#=Terrain(xlp+1,ylp).px#
                  y2#=Terrain(xlp+1,ylp).py#

                  x3#=Terrain(xlp+1,ylp+1).px#
                  y3#=Terrain(xlp+1,ylp+1).py#

                  x4#=Terrain(xlp,ylp+1).px#
                  y4#=Terrain(xlp,ylp+1).py#
   


                  if Terrain(xlp,ylp).Flat=Pass then continue
   

                  if crossproduct#(x1#,y1#,x2#,y2#,x3#,y3#)>=0
                        gouraudtri x1#,y1#,c1,x2#,y2#,c2,x3#,y3#,c3
                  endif
                        
                  if crossproduct#(x1#,y1#,x3#,y3#,x4#,y4#)>=0
                        gouraudtri x1#,y1#,c1,x3#,y3#,c3,x4#,y4#,c4
                  endif
         
               next   
            next
         next
         unlockbuffer
   
      StartPass=2

  ; Move the camera   
        Speed=10

       If UpKey() Then Camy=Camy+-Speed   
       If DownKey() Then Camy=Camy+Speed

       If LeftKey() Then CamX=CamX+-Speed   
       If RightKey() Then CamX=CamX+speed   

      If CamX>Xrange Then CamX=Xrange
      If CamX<-Xrange Then CamX=-Xrange
      If CamY>YRange Then CamY=YRange
      If CamY<-YRange Then CamY=-YRange
   
      Sync
   loop

[/pbcode]
Title: Re: Super Drift Racer!!- WIP
Post by: stevmjon on February 11, 2014, 11:37:13 PM
hey monkey dude

I was in the mood to make some graphics for you in my 3D program.
they are individual pics, that need to be cut up and made into a map image. I made them divisible by 64 pixels.

also, you don't need to make as many tiles as you did. use the ones with black as transparent, and you can paste these on top of dirt / road tiles. this is where z buffer comes in handy.  eg. use all grass tiles on z layer 5, use road / dirt tiles on z layer 10. this way you will use less tiles.

I like this game, and i am looking forward to seeing more.

hope this helps,  stevmjon
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 12, 2014, 04:03:28 PM
Thanks chaps.i will check these things out.
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 15, 2014, 04:50:54 AM
what does  crossproduct#() do?
i can't find it in the docs
Title: Re: Super Drift Racer!!- WIP
Post by: kevin on February 15, 2014, 07:02:19 AM
 It's for working out what direction a polygon is facing. 

http://www.underwaredesign.com/forums/index.php?topic=3988.msg27424#msg27424
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 15, 2014, 08:50:23 AM
thanks,i see you are using it for shading purposes(i think)
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 15, 2014, 09:56:32 AM
i have a problem,if i use the basic tile set in my game(via playmapper) the game runs fine but if i use the posh tileset the collision is constantly being triggered  which is level 3 on the map.
it is almost definitely  user error,it generally is...
Title: Re: Super Drift Racer!!- WIP
Post by: stevmjon on February 22, 2014, 12:47:08 AM
hey monkeybot

how are you defining collisions? are you using shapes colliding with a map? or are you manually checking collisions?

if you could post your source code with the images in a zip file, it would be handy. I understand that some people don't like to share their code, but it would be helpful to determine the issue.

  stevmjon
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 23, 2014, 09:55:08 AM
i am checking points against the map
Title: Re: Super Drift Racer!!- WIP
Post by: stevmjon on February 25, 2014, 02:23:46 AM
hey monkeybot

I re-made the map image for you, as one instead of individually. the older ones were all 24bit, but this new one is 32bit. this allows loading as AFX images to be used for an AFX map.

I adjusted the dirt and road tiles to show more detail, and I removed the specular highlights from the grass, so there are no bright spots anymore. the tiles on the right hand side are to roughen up the grass edges.
remember to use levels(layers). put grass on top, and put dirt and road underneath.

because the tiles are different, you will need to modify your map tile numbers for placement. sorry about that. you can at least use less tiles with mine.

hope you like it, if you need any adjustments, let me know. my 3D scene is set-up and I can easily adjust individual tiles.

  stevmjon
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on February 25, 2014, 04:14:42 AM
Hey nice one they look great.
I will get round to it as soon as possible.
Thanks again
Title: Re: Super Drift Racer!!- WIP
Post by: micky4fun on March 01, 2014, 03:37:27 PM
Hi all

looking good monkeybot , reminds me of auto racing on the intellivision , loved that game , thought this was such a good system , football (soccer) at the time looked so real the way they run , how things changed

https://www.youtube.com/watch?v=kWaUCaRAioQ



keep up the good work , look forward to complete game

mick :)
Title: Re: Super Drift Racer!!- WIP
Post by: monkeybot on March 01, 2014, 05:16:51 PM
nice.

I knew you couldn't stay away mick.  :-)
Title: Re: Super Drift Racer!!- WIP
Post by: kevin on March 01, 2014, 06:07:53 PM

Reminds me those sprint/supersprint arcades from the late 70's



Was thinking that for the track what you could look into making them out of polygons.    So in the designer you have mutliple layers, such as ground layer, track layer, then a foreground stuff layer.   The ground and track would be merged together and spat out as a tile map or just a big bitmap. 
Title: Re: Super Drift Racer!!- WIP
Post by: stevmjon on March 02, 2014, 08:09:53 AM
hey kev

I remember playing this at the arcade when I was younger. it was a fun to play turning the steering wheel quickly one way then the other. keeping the right gear too. games were so much simpler then, but you really needed to focus.

stevmjon
Title: Re: Super Drift Racer!!- WIP
Post by: kevin on March 02, 2014, 08:24:37 AM
  The throwing the steering wheel around in 2/4 player races is what i remember about those sprint games most..  as for simpler.. well... only if you look at them from todays programming environments, then yeah.    But try writing them without modern luxuries, you could prolly build a version of that game that runs in the   Challenge #27 -  Learn binary operations through Retro Computer Graphics  (http://www.underwaredesign.com/forums/index.php?topic=4147.0) framework.   


  Knocked up a crude track designer tool to show what I was talking about previously.  Polygon Track Editor (http://www.underwaredesign.com/forums/index.php?topic=4157.0)