tinyGFX

Game development specific discussions.
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

tinyGFX

Postby phpboxxx » May 09, 2011 4:38

Hello everyone,

I just wanted to share what I am working on with you. It is a 3D engine (yeah yet another one). This is kind of a sneak preview; if thats okay :)

BINARY INFO
Windows: 165 KB
Linux: N/A

LATEST SCREENSHOT
Image
GLSL Bloom, virtual texturing

VIDEO
http://www.youtube.com/watch?v=t35Xegks7CA

MORE INFO
http://www.tinygfx.com
Last edited by phpboxxx on Jul 03, 2011 18:20, edited 15 times in total.
Lachie Dazdarian
Posts: 2337
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Postby Lachie Dazdarian » May 09, 2011 8:45

I like the presentation and the fact it's tiny. Good lucky with it. :)
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

Postby phpboxxx » May 10, 2011 17:19

Thank you :)

I will need a bit of luck, because of all the mathematics.
TJF
Posts: 3456
Joined: Dec 06, 2009 22:27
Location: N47°, E15°

Postby TJF » May 10, 2011 17:30

phpboxxx wrote:I will need a bit of luck, because of all the mathematics.

You may ask for a bit of help here : )
Kot
Posts: 335
Joined: Dec 28, 2006 10:34

Postby Kot » May 11, 2011 20:02

How tiny is it?
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

Postby phpboxxx » May 14, 2011 14:20

As tiny as i can make it :)
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

Postby phpboxxx » May 24, 2011 22:43

after i implemented first person camera and controls, I created basic car camera and controls. There is an actual demo of it :D

SCREENSHOT
Image

DOWNLOAD
GFX_tractor_demo.zip

NOTE
This is compiled for windows only, when there are more features I will compile for linux too.
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

Postby phpboxxx » May 28, 2011 18:16

I started implementing ODE, and simple car physics works pretty well.

SCREENSHOT
Image

VIDEO
http://www.youtube.com/watch?v=-pbWsLTYutY

PS: thanks a lot to everyone who created .bi headers for many libraries, I couldn't do anything without them :)
D.J.Peters
Posts: 7667
Joined: May 28, 2005 3:28

Postby D.J.Peters » May 28, 2011 18:38

hello phpboxxx
nice tractor and ODE car video.
where are your ODE code ?

Joshy
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

Postby phpboxxx » May 28, 2011 19:07

Thanks. There is no code public yet, because it isn't clean, but it will be public at some point. However, i can give you the basic setup of the car directly from my source.


SETUP CAR

Code: Select all

' some globals
Dim shared as dWorldID      world
dim shared as dSpaceID      world_space
dim shared as dGeomID       geomground,geombox,geombox2, gWheel1, gWheel2,gWheel3,gWheel4, gChassis,gRollbar, gRamp,gMotor
dim shared as dBodyID       bodybox, tractorbox,tbox2, bWheel1,bWheel2,bWheel3, bWheel4,bChassis,bRollbar,bRamp,bMotor
dim shared as dJointGroupID contactgroup
dim shared as dContact      contacts(MAX_CONTACTS-1)
dim shared as dJointID      hing
dim shared as integer draw_contacts = 1

Dim As Single ts1=3f,ts2=2f,ts3=7.3f
Dim as dMass m,m2
Dim As dJointID jWheel1, jWheel2,jWheel3, jWheel4,jRollbar,jRamp,jMotor
   
   dInitODE2(0)
' create world and set gravity
   world = dWorldCreate()
   dWorldSetGravity(world,0,GRAVITY,0)
' craete a contact group (faster to delete)
   contactgroup = dJointGroupCreate(0)
' create an space for our objects
   world_space = dHashSpaceCreate(0)
' the ground are an static object (geom only)
   geomground = dCreatePlane(world_space,0,1,0,0)
   
' the box are an dynamic object (body and geom)
   dWorldSetAutoDisableFlag(World,1)
   dWorldSetERP(World,1)

'CREATE CAR (PHYSICS BODIES)   
   bwheel1 = dBodyCreate(world)
   bwheel2 = dBodyCreate(world)
   bwheel3 = dBodyCreate(world)
   bwheel4 = dBodyCreate(world)
   bchassis = dBodyCreate(world)
   
   bMotor = dBodyCreate(world)
'CALCULATE MASS FOR CAR PARTS (PHYSICS BODIES)   
   dMassSetSphereTotal(@m,14,0.7) '14 , 50
   dMassSetBoxTotal(@m2,200,SIDEa,SIDEb,SIDEc)
   dMassTranslate(@m,0,0,0)
   
'BIND MASS TO CAR PARTS (PHYSICS BODIES)   2

   dBodySetMass (bwheel1,@m)
   dBodySetMass (bwheel2,@m)
   dBodySetMass (bwheel3,@m)
   dBodySetMass (bwheel4,@m)
   dBodySetMass (bchassis,@m2)

   dBodySetMass (bmotor,@m)
   
   Dim As Single cary = 1.1
      
'POSITION CAR PARTS (PHYSICS BODIES)   
   dBodySetPosition  (bwheel1,-2,cary-0.5,+3)
   dBodySetPosition  (bwheel2,+2,cary-0.5,+3)
   dBodySetPosition  (bwheel3,-2,cary-0.5,-3)
   dBodySetPosition  (bwheel4,+2,cary-0.5,-3)
   dBodySetPosition  (bchassis,0,cary,0) 'dBodySetPosition  (bchassis,0,1,0)
   
   'dBodySetPosition  (brollbar,0,2.3,0.01) 'Y=2 default
   dBodySetPosition  (bmotor,0,2.3,-3) 'Y=2 default
   
'CREATE GEOMETRY FOR CAR PARTS (GEOMETRIC BODIES)   
   gWheel1 = dCreateSphere(world_space,0.7)
   gWheel2 = dCreateSphere(world_space,0.7)
   gWheel3 = dCreateSphere(world_space,0.7)
   gWheel4 = dCreateSphere(world_space,0.7)
   gChassis = dCreateBox(world_space,SIDEa,SIDEb,SIDEc)

   'gRollbar = dCreateSphere(world_space,0.8)
   gMotor = dCreateSphere(world_space,0.2)
'BIND GEOMETRY TO CAR PARTS (PHYSICS BODIES)   
   dGeomSetBody (gWheel1,bWheel1)
   dGeomSetBody (gWheel2,bWheel2)
   dGeomSetBody (gWheel3,bWheel3)
   dGeomSetBody (gWheel4,bWheel4)
   dGeomSetBody (gChassis,bChassis)

   dGeomSetBody (gMotor,bMotor)
   
'CREATE JOINTS (PHYSICS BODIES)   
   jWheel1 = dJointCreateHinge2 (World,0)   
   jWheel2 = dJointCreateHinge2 (World,0)
   jWheel3 = dJointCreateHinge2 (World,0)   
   jWheel4 = dJointCreateHinge2 (World,0)
   
   jMotor = dJointCreateSlider(World,0)

'BIND CAR PARTS TOGETHER WITH JOINTS (PHYSICS BODIES)   
   dJointAttach (jWheel1, bChassis, bWheel1)
   dJointAttach (jWheel2, bChassis, bWheel2)
   dJointAttach (jWheel3, bChassis, bWHeel3)
   dJointAttach (jWheel4, bChassis, bWheel4)

   dJointAttach (jMotor, bChassis, bMotor)
   
'SET JOINT PARAMATERS (PHYSICS BODIES)

        Dim as dReal Ptr a
        a = dBodyGetPosition(bWheel1)
        dJointSetHinge2Anchor(jWheel1,a[0],a[1],a[2])
        a = dBodyGetPosition(bWheel2)
        dJointSetHinge2Anchor(jWheel2,a[0],a[1],a[2])
        a = dBodyGetPosition(bWheel3)
        dJointSetHinge2Anchor(jWheel3,a[0],a[1],a[2])
        a = dBodyGetPosition(bWheel4)
        dJointSetHinge2Anchor(jWheel4,a[0],a[1],a[2])


   dJointSetSliderParam (jMotor,dParamLoStop,-1)
   dJointSetSliderParam (jMotor,dParamHiStop,1)


   dJointSetHinge2Param (jWheel3,dParamLoStop,0)
   dJointSetHinge2Param (jWheel3,dParamHiStop,0)
   dJointSetHinge2Param (jWheel4,dParamLoStop,0)
   dJointSetHinge2Param (jWHeel4,dParamHiStop,0)
   
   
   dJointSetHinge2Axis1 (jWheel1,   0,   1,   0)
   dJointSetHinge2Axis2 (jWheel1,   -1,   0,   0)
   dJointSetHinge2Param(jWheel1,dParamSuspensionERP,1)
   dJointSetHinge2Param(jWheel1,dParamSuspensionCFM,0.001)

   
   dJointSetHinge2Axis1 (jWheel2,   0,   1,   0)
   dJointSetHinge2Axis2 (jWheel2,   -1,   0,   0)
   dJointSetHinge2Param(jWheel2,dParamSuspensionERP,1)
   dJointSetHinge2Param(jWheel2,dParamSuspensionCFM,0.001)
   
   
   
   dJointSetHinge2Axis1 (jWheel3,   0,   1,   0)
   dJointSetHinge2Axis2 (jWheel3,   -1,   0,   0)
   dJointSetHinge2Param(jWheel3,dParamSuspensionERP,1)
   dJointSetHinge2Param(jWheel3,dParamSuspensionCFM,0.003)


   
   dJointSetHinge2Axis1 (jWheel4,   0,   1,   0)
   dJointSetHinge2Axis2 (jWheel4,   -1,   0,   0)
   dJointSetHinge2Param(jWheel4,dParamSuspensionERP,1)
   dJointSetHinge2Param(jWheel4,dParamSuspensionCFM,0.003)
   
      
   dJointSetHinge2Param (jWheel1,dParamVel2,0)
   dJointSetHinge2Param (jWheel2,dParamVel2,0)
   dJointSetHinge2Param (jWheel3,dParamVel2,0)
   dJointSetHinge2Param (jWheel4,dParamVel2,0)     



SIM LOOP

Code: Select all

'PHYSICS
        If (pause=0) then
   
       dBodyEnable(bWheel1)
       dBodyEnable(bWheel2)
       dBodyEnable(bWheel3)
       dBodyEnable(bWheel4)
           
       dJointSetHinge2Param(jWheel3,dParamVel2,Speed)
      dJointSetHinge2Param(jWheel3,dParamFMax2,100)
       dJointSetHinge2Param(jWheel4,dParamVel2,Speed)
      dJointSetHinge2Param(jWheel4,dParamFMax2,100)



   Dim as dReal angle
   angle=Steer-dJointGetHinge2Angle1(jWheel1)
   
   dJointSetHinge2Param(jWheel1,dParamVel1,angle)
   dJointSetHinge2Param(jWheel1,dParamFMax1,20)
      dJointSetHinge2Param(jWheel1,dParamLoStop,-15*DEG2RAD)
   dJointSetHinge2Param(jWheel1,dParamHiStop, 15*DEG2RAD)
   dJointSetHinge2Param(jWheel1,dParamFudgeFactor,0.01)

   angle=Steer-dJointGetHinge2Angle1(jWheel2)
   dJointSetHinge2Param(jWheel2,dParamVel1,angle)
   dJointSetHinge2Param(jWheel2,dParamFMax1,20)
   dJointSetHinge2Param(jWheel2,dParamLoStop,-15*DEG2RAD)
   dJointSetHinge2Param(jWheel2,dParamHiStop, 15*DEG2RAD)
   dJointSetHinge2Param(jWheel2,dParamFudgeFactor,0.01)


      If Not MultiKey(FB.SC_T) And Not MultiKey(FB.SC_G) And Not MultiKey(FB.SC_SPACE) Then
          If speed < 0 Then speed = speed + 0.0006
          If speed > 0 Then speed = speed - 0.0006
      EndIf


endif


KEYS

Code: Select all



        If MultiKey(FB.SC_SPACE) Then
            world_friction = 2
            
            dJointSetHinge2Param (jWheel1,dParamVel,0)
            dJointSetHinge2Param (jWheel2,dParamVel,0)
            
            dJointSetHinge2Param (jWheel1,dParamVel1,0)
            dJointSetHinge2Param (jWheel2,dParamVel1,0)

            dJointSetHinge2Param (jWheel1,dParamVel2,0)
            dJointSetHinge2Param (jWheel2,dParamVel2,0)


            dJointSetHinge2Param (jWheel3,dParamVel,0)
            dJointSetHinge2Param (jWheel4,dParamVel,0)
            
            dJointSetHinge2Param (jWheel3,dParamVel1,0)
            dJointSetHinge2Param (jWheel4,dParamVel1,0)

            dJointSetHinge2Param (jWheel3,dParamVel2,0)
            dJointSetHinge2Param (jWheel4,dParamVel2,0)

            dJointSetSliderParam (jMotor,dParamVel,0)

          If speed < 0 Then speed = speed + 0.1
          If speed > 0 Then speed = speed - 0.1
         
         
   endif

    If MultiKey(FB.SC_G) then
      Speed=Speed-0.01
      If Speed<-11 Then Speed=-11
      If Speed>0 Then Speed=Speed*0.97
     EndIf
     

     If MultiKey(FB.SC_T) then
      Speed=Speed+0.02
      If Speed>30 Then Speed=30
     EndIf
   
   If MultiKey (FB.SC_F) Then
      steer -= 0.01
      dJointSetSliderParam (jMotor,dParamVel,-0.01)
      dJointSetSliderParam(jMotor,dParamFMax,500)
   EndIf

   If MultiKey (FB.SC_H) Then
      steer += 0.01
      dJointSetSliderParam (jMotor,dParamVel,0.01)
      dJointSetSliderParam(jMotor,dParamFMax,500)
   EndIf





it is not perfect in any way. Note: jMotor is really a stabilisator that has to move to opposite side of steering to prevent car flip. You have to play with different car weight a little to make it work good.
D.J.Peters
Posts: 7667
Joined: May 28, 2005 3:28

Postby D.J.Peters » May 28, 2011 19:53

hello phpboxxx,
i know how ODE works i used it more than 100 times in the past
and i translated all include files and macros for FreeBASIC.
I was only looking how you setup the suspension and damping.

By the way:
ODE, Newton and the Tokamak are not the right libs for me.
I played the last 3 years with these libs but my results and all others i saw of vehicle dynamics looks more than a toy car.

Now i know why Gran Turismo, LFS and so one created his own car physics.

But the last 3 years was really funny with the free physics libs.

Do you know the engine from CarX ?
if not here are one video

Good luck with your own car setup.

Joshy
(sorry about my bad english)
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

Postby phpboxxx » May 28, 2011 20:10

No problem about the english Joshy. Yeah i have seen carX, it is very good. It uses Ray casting car physics, where you cast rays to the ground from all 4 wheels and calculate all physics from this. It is easier to control and can be very realistic. Most car games use this technique.

It can be done with ODE, but because i just begin using it i choose the normal way of using hinge2 joints. :D

Thanks to your header files I could try out a lot of things, it is really good what you do!
Last edited by phpboxxx on May 28, 2011 20:30, edited 4 times in total.
D.J.Peters
Posts: 7667
Joined: May 28, 2005 3:28

Postby D.J.Peters » May 28, 2011 20:10

i'm again :-)
why to hell is http://www.tinyband.com not public ?

Joshy
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

Postby phpboxxx » May 28, 2011 20:12

Because i have not created it yet. It is on my ToDo list, and i bought the domain already as a reminder. One web service that works but is not public is ressr.com. If you want you can try it http://ressr.com/test/
phpboxxx
Posts: 17
Joined: Dec 08, 2010 0:36
Location: Berlin/Germany
Contact:

Re: tinyGFX

Postby phpboxxx » Mar 15, 2012 16:46

After a long time I have some news.

There is a new site at http://tinygfx.com and it documents the progress I have made so far.

I hope you enjoy it as much as I do :)

Return to “Game Dev”

Who is online

Users browsing this forum: No registered users and 1 guest