April 24, 2019, 11:50:11 PM

Author Topic: Is there an equivalent to Delta time in Blitz3d?  (Read 659 times)

Offline phodiS

  • Jr. Member
  • **
  • Posts: 40
Is there an equivalent to Delta time in Blitz3d?
« on: May 12, 2018, 11:00:38 PM »
Or.. a way to just slow down animations?.
    Hehe years ago, I would not have complained about the programs running too fast, however my MD2 models are going ballistic even when set to the lowest speed (1) ... on my 3d maps they are animating way to fast but I can't set the animation speed to less than 1 ... needs to be like .3 or .4 I'd say. Anyways I have looked back and forward through my Blit3d programming manual as well as online but I can't see a way to ~time~ my game to a slower speed. If anyone knows if there is a command to do so I would really appreciate it.

the context is as below...

;HORSE
horse=LoadMD2("horse.md2")
PositionEntity horse,20,1,20
ScaleEntity horse,.05,.05,.05
AnimateMD2 horse,1,.05,14,15   << Even setting the speed to .05 is the same speed as 1   it's just animates to fast!.
tex=LoadTexture("horse.jpg")
EntityTexture horse, tex, 0


Cheers guys.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 360
Re: Is there an equivalent to Delta time in Blitz3d?
« Reply #1 on: May 12, 2018, 11:50:33 PM »
I haven't tested but it seems < 1 on AnimateMD2 should work. Maybe the problem is you're writing .1 instead of 0.1?

Offline phodiS

  • Jr. Member
  • **
  • Posts: 40
Re: Is there an equivalent to Delta time in Blitz3d?
« Reply #2 on: May 13, 2018, 01:21:10 AM »
Unfortunately that doesn't work. I have tested it and it will actually move at full speed at 0.7 or .7 and up. So basically it's not really usable...unless I add in heaps of copied animations to slow the character down... not really ideal.

As this is my first successful animation ever, I think I might try animating B3d characters instead. Although at this point I have no idea how to I'm going to dive in right now and find out. If I have any success with this I will post here what I come up with.

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 371
Re: Is there an equivalent to Delta time in Blitz3d?
« Reply #3 on: May 13, 2018, 08:39:43 AM »
Check out the castle demo (samples\mak\castle\castle.bb) for an example of using fixed rate logic and tweening.  This should keep logic and animations at the same speed regardless of rendering speeds.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 360
Re: Is there an equivalent to Delta time in Blitz3d?
« Reply #4 on: May 13, 2018, 01:28:20 PM »
I think you might be able to use ExtractAnimSeq on MD2s, which converts the animation so you can use SetAnimTime or Animate.

Offline phodiS

  • Jr. Member
  • **
  • Posts: 40
Re: Is there an equivalent to Delta time in Blitz3d?
« Reply #5 on: May 13, 2018, 05:01:12 PM »
Hi guys,
           Yes I have been using the extractanimseq as below.... I might take a look at the tweening thing today.
Bahh.. I'll get there..still can't believe it takes so little code to accomplish so much..truly puts GAMEMAKER to shame.
I do have one thing that bugs me ... I commented the question into the code below
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Global screen_width = 1024, screen_height = 768
Graphics3D 1024,768,32,1
SetBuffer BackBuffer()

;CAMERA
cam1 = CreateCamera()
CameraViewport cam1, 0, 0, screen_width, screen_height
PositionEntity cam1, 512, 25,-40
CameraRange cam1,0.1,4500

;ZOMBIE
zombie=LoadMD2("zombie.md2")
PositionEntity zombie,512,1,20
ScaleEntity zombie,.05,.05,.05
AnimateMD2 zombie,1,0.05,14,15
;ZOMBIE Punch 21-30 walk 1-20 stand 0 die 34-48 hit 31-33
idle =ExtractAnimSeq(zombie,0,0)
walking=ExtractAnimSeq(zombie,1,20)
walking=True
zspeed=1
;LIGHTING
light=CreateLight(3)
LightColor light,100,20,30
LightConeAngles light,0,45
PositionEntity light,0,0,0.5
LightRange light,20
PointEntity light,zombie
;GROUND
ground=CreatePlane()
PositionEntity ground,1,1,1
ScaleEntity ground,100,100,100
EntityColor ground,0,200,100

m=1 ;                                                            <<<<<<<<<<<<<<<WHY!!!! do I need this?????

;LOOP
While Not KeyHit(1)

m=m+1                                                           <<<<<<<<<<<<<<Because without this counter...

UpdateWorld
RenderWorld

speed=1 ;<<<Works from 0.6 or .6 and up... but always seems to go to fast!...
If m=2 AnimateMD2 zombie,1,speed,walking,20   ; <<<<<<<< THE animation wont work .. I mean why cant I just say>>>> AnimateMD2 zombie,1,speed,walking,20
TurnEntity zombie,0,.5,0
MoveEntity zombie,0,0,.2
If m>2 m=2                                                 ; <<<<<<<<< Without using the ~M~ thing at all....Not a biggie, but I don't understand it.

Text 320,10,"Zombie demo"

Flip
Wend
End
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Could someone please confirm I am on the right track to produce multiple enemies that are all independent from each other..using the following function and setting the zombie up as a type..... (I just started , so it's not complete).

Function createzombie()
z.zombie=New zombie
z\zombie=LoadMD2("zombie.md2")
z\x=Rnd(width)
z\y=Rnd(height)



Cheers guys!.

Offline Matty

  • Hero Member
  • *****
  • Posts: 629
    • MattiesGames
Re: Is there an equivalent to Delta time in Blitz3d?
« Reply #6 on: May 14, 2018, 09:49:19 AM »
Your loop is going as fast as possible and if vsync is disabled on your card then it will run a million fps.

Try a simple test like this:
Start of loop:
Time = millisecs
Each frame

End of loop each frame
Time = millisecs - time
If time < 15
Delay 15 - time
Endif

Offline MagosDomina

  • Full Member
  • ***
  • Posts: 121
    • Aspiring game developer website.
Re: Is there an equivalent to Delta time in Blitz3d?
« Reply #7 on: May 15, 2018, 10:34:41 PM »
Try this after UpdateWorld and RenderWorld.

   If DoVsync Then VWait     ;If Vertical Sync is on then Vwait
   Flip False 


It is pointless to go over the refresh rate of your monitor unless you are benchmarking or enjoy stressing your hardware.
Central hub for my Game Design related activities.
http://www.magosdomina.com/

Windows 7 PRO 64-bit, 48Gb RAM, CPU: Dual Hexacore Intel Xeon 3.33 GHZ, Nvidia Quadro 5800FX 4Gb x 2 SLI.