Leadwerks Engine SDK 1.14 release
BlitzMax Forums/BlitzMax Programming/Leadwerks Engine SDK 1.14 release
| ||
SDK 1.14 is out. Features: -Bump mapping with specular highlights on any surface, with any lighting style. -New collision system lets you control which objects collide with which. Use collision on any mesh (like Blitz3D). -Fast built-in lightmapper. -No more BuildWorld(). You can collapse brushes to meshes and set up collision any way you like. -More stable than any version to date. I've run a lot of memory tests and loaded/deleted entire worlds in a loop. It's very good. -30 pages of documentation in a CHM help file. -Experimental dll support. Here is an example program: Import leadwerks.engine SetAudioDriver "OpenALEx" SetGraphicsDriver GLGraphicsDriver() Graphics 800,600,0,60 'Create a new world world:TWorld=CreateWorld() 'Create a camera camera:TCamera=CreateCamera() CameraClsColor camera,0,0,255 CameraFogColor camera,128,128,128,128 CameraFogRange camera,1000,4000 CameraFogMode camera,True CameraClsMode camera,0,1 'Load a scene LoadWorld("maps\testscene.3dw") 'Calculate lightmaps BuildLighting() 'Bodies-bodies collision Collisions 1,1,1 'Bodies-world collision Collisions 1,2,1 'Collapse scene brushes into a single mesh collapsedbrushes:TMesh=CollapseBrushes() EntityType collapsedbrushes,2 UpdateCollision collapsedbrushes 'Process the scene For entity:TEntity=EachIn CurrentWorld().entities Select EntityClass(entity) Case "terrain" EntityType entity,2 Case "brush" If EntityHidden(entity) EntityType entity,2 Case "body" EntityType entity,1 End Select Next 'Create a player player:TPlayer=CreatePlayer() EntityType player,1 PositionEntity player,0,200,-600 'Enable tri-linear filter TFilter 1 'AFilter MaxAFilter()' Anisotropic filter 'Load footstep sounds footstep_1:TSound=LoadSound("sound\footsteps\stone1.wav") footstep_2:TSound=LoadSound("sound\footsteps\stone2.wav") footstep_3:TSound=LoadSound("sound\footsteps\stone3.wav") footstep_4:TSound=LoadSound("sound\footsteps\stone4.wav") If EAXSupported() EnableEAX EAXEffect EAX_ALLEY EndIf 'Load some music music:TSound=LoadSound("sound\new_horizons.ogg") channel:TChannel=CueSound(music) SetChannelVolume channel,0.25 ResumeChannel channel HideMouse MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 Repeat 'Player input to exit program If KeyHit(KEY_ESCAPE) End If AppTerminate() End 'Player controls strafe=KeyDown(KEY_W)-KeyDown(KEY_S) move=KeyDown(KEY_D)-KeyDown(KEY_A) jump=KeyHit(KEY_SPACE) 'Player footsteps If player.onground timeonground#=timeonground#+AppSpeed() If move<>0 Or strafe<>0 If timeonground>25.0 Select Rand(1,4) Case 1 PlaySound footstep_1 Case 2 PlaySound footstep_2 Case 3 PlaySound footstep_3 Case 4 PlaySound footstep_4 End Select timeonground=0 EndIf EndIf EndIf 'Set user input to move the player object UpdatePlayer player,strafe,move,jump 'Mouse input dx#=Curve(MouseX()-GraphicsWidth()/2,dx#,2.0) dy#=Curve(MouseY()-GraphicsHeight()/2,dy#,2.0) pitch#=EntityPitch(camera)+dy*0.25 yaw#=EntityYaw(camera)-dx*0.25 RotateEntity camera,pitch,yaw,0 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 RotateEntity player,0,yaw,0 'Update physics, sound, etc. UpdateWorld() 'Position the camera PositionEntity camera,player.position.x,Curve(player.position.y+180,camera.position.y,4),player.position.z 'Render the world RenderWorld() 'Display the framerate lwSetBlend BLEND_ALPHA lwSetColor 255,255,255,192 lwDrawText "FPS: "+UPS(),0,0 'Flip the graphics buffer Flip 1 Forever This gives you an idea of what the docs and API are like: |
| ||
Tested the 1.14 testbuilt on your boards seems like the world handling still lags a constant tick rate or was it just disabled in that built? Its ok to have 1000 FPS but it is NOT ok to have physics and collision running at that level, thats a very serious problem ... definitely one of the main reasons I'm still not considering it anywhere "production ready" In the example above I don't see any "SetPhysicTickRate" or similar, thats why I am asking. (Blitz commandset is nice but blitz did not have physics integrated otherwise that command would have existed as tweening does not resolve simulation problems) |
| ||
Julio of Newton has explained that no physics lib can work with a variable timestep. For physical simulations you should lock the refresh rate. Besides, even if the program runs at 1000 FPS, you can only see what your monitor can display, which is 60-75 hz. |
| ||
For physical simulations you should lock the refresh rate. No, you should lock the timestep. There is no necessity for the screen update to match the physics timestep. |
| ||
It'll make you sick to your stomach if you lock the time step without locking the refresh rate. I have tried it. |
| ||
Out of my experience with Newton the best way to achieve a good simulation is to use an accumulated timestep. At least this means you have to call NewtonUpdate more then once a loop and keep more track about forces etc. But therefore you will achieve much faster and accurate simulation. But Leadwerks is right, the best way is to lock the refresh rate and not the timestep. BTW: Nice demo. I wished I would have someone who mades media like this for me ;) |
| ||
It'll make you sick to your stomach if you lock the time step without locking the refresh rate. I have tried it. So have I. It just requires good timing. You lock the physics down, decouple the rendering from the physics and tween the rendering to match the physics. It's what they used in Tribes 2, among others. But Leadwerks is right, the best way is to lock the refresh rate and not the timestep. That's even worse, and it's not what Leadwerks said. What Leadwerks said is to lock the refresh rate *and* the timestep. His is a valid solution, yours is not. Yours requires a variable timestep which is precisely the problem he's trying to solve. Namely that no physics engine can handle a variable timestep very well. Accumulate the timestep, yes, call newtonupdate more than once per loop, again yes, but it absolutely has to be a constant timestep or the physics become unreliable, just as Leadwerks said. |
| ||
Awesome work Josh ! I use B3D and really appreciate it's elegant design and can accomplish much despite it's age and limitations. What I see with this SDK + BMAX gives me that same great spine tingling feeling. I'm a Blitzmax owner and I've patiently waited for Max3d. The screen shots, SDK, syntax look like what I expected Max3D to be. I don't own any Leadwerks products todate, but I'm excited about the decisions and direction Leadwerks has taken with this SDK. I've got tons of respect for Julio, and Josh. Leadwerks and Newton both have lots of support and continue to grow. These are good times guys. Right now Leadwerks looks to becoming the Max3d many have waited to see. It's not just the awesome screen shots, it's the rock hard abs of the engine. - Future Customer |
| ||
OK I should have specified the problem more. speed is FPS bound not the moment it is updated. ie with 600 FPS it walks 10 times faster than with 60 FPS, which is definitely wrong. At 600 FPS, the timedifference since last physics update is 1/10 of that of 60FPS and therefor the result is only 1/10 as well. I know that physic update and rendering need to be coupled, but so far I thought the update is done by a timedifference variable, not with a constant value. Just a simple example of this problem: with the 1.14 testbuilt on leadwerks board, the hanging tire moves at around lightspeed due to the 1000 fps when I get near or I jump that fast that I am back on ground before I really realize that I left ground. And thats definitely not the correct thing that is meant to happen. Unless there is a way to set the target FPS (again, above there is no command to do that), the engine should correctly do this thing internally. I don't have a license yet, so I don't know if it potentially can be done. |
| ||
@Gabriel: Sure you're right. I have misunderstood Josh and the accumulative timestep is for sure a constant. |
| ||
Tweening physics is an interesting idea, and it could be done pretty easily, since it is all contained within the TBody class. I will look into this. I also added some code in my forum to pick objects up and throw them around. :D |
| ||
Josh, go to www.Gaffer.org . He has everything you need for physics and timing. Basically it's something like this: 'Original Code From www.Gaffer.org Graphics 800,600,0,0 Const dt:Float = 1.0 / 50.0 'this is how fast you want the logic loop to run at (50 FPS) Local accumulator:Float Local t:Float Local newTime:Int = MilliSecs() Local oldTime:Int = newTime Local deltaTime:Float = 0.01 While Not KeyDown(KEY_ESCAPE) Cls newTime = MilliSecs() deltaTime = (newTime - oldTime) / 1000.0 oldTime = newTime accumulator :+ deltaTime If accumulator > dt ''Update Physics Logic Here 'Local this:PhysObj 'For this = EachIn PhysObjList ' this.Update(dt) 'Next DrawText 1.0/accumulator,5,100 accumulator :- dt t :+ dt EndIf alpha = accumulator / dt 'Render All Entity Positions Here at Full Speed 'Local this:PhysObj 'For this = EachIn PhysObjList ' this.render(alpha) 'Next 'RenderWorld DrawText "DelatTime: "+deltaTime,5,5 DrawText "Render FPS: "+ Int(1.0/DeltaTime),5,35 Flip 0 'Let the loop run at full speed Wend End |
| ||
I have to tell all of you, this engine is amazing! It is approaching AAA status and works seamlessly with Leadwerks impressive 3D World Studio. It's like a one-two punch. You create your levels and worlds in 3DWS and then with a click of one button begin playing your game in Leadwerks Engine. Just amazing. The new shaders and lighting models are incredible! The FPS, as long as you have a reasonably decent card (any current one will do), is excellent. The physics are as real looking as they get. There's a demo of a car you can drive around and it reacts just like it would in the real world. I love the tire swinging from a tree - just incredible. My favorite thing about this engine, though, is that I can use it in BlitzMax - so now I have a POWERFUL 3D engine running in a language I can program in for all the menus, ai, level changes, etc. You really should check this out if you have been looking for a game engine to work with BlitzMax or other API's. It does have its own scripting editor for those that don't have a programming language - and it is VERY close to Basic, so it's not that hard. Although there are a few things left to be finished, this engine (graphically) easily competes with the likes of Half Life 2 and Doom 3, etc. Mike |
| ||
MusicMan, your post sounds a bit....like a rehearsed commercial. It does look pretty cool though. But I only got around 40ish FPS. |
| ||
Bumpmapping is a little slow on old shader cards, and that test renderer I posted runs at 2x antialias, so there is another big slowdown. In non-aa mode with no bumpmapping, this version of the engine is actually about 30% faster than previous versions. Give this one a try if you are interested: http://www.leadwerks.com/post/1.14test.zip It has AA turned off. It also uses DDS textures, which even on my card gives me about a 25% speed increase. Oh, and I added the ability to pick up objects by pressing the E key. :D It's kind of fun, though I am still figuring out how to keep them from rotating. I added that in script after releasing the SDK, so it isn't a special thing I added inside the engine. It's just an application of the physics command set that anyone could have done. |
| ||
Runs pretty well on my ATI 9600SE 30-60FPS. |
| ||
Nice build but physics seems to be disabled ... and using the tire (e) and shoot it upwards results in a little funky result (like flying in the air rotating with crazy angle and speed) |
| ||
I turned off collision with the cinder blocks. It's usually good to not have the player collide with small objects like that. Press V to toggle vertical sync, and get a real FPS reading. |
| ||
Yep, once I messed with that tire I felt like I needed to run for my life. |
| ||
It crashed all video on my laptop.. :( First it loaded fine, and the scene appeared. There was graphic glitches on two of the "walls", chich made it look kind of white and full of holes.. Then, after maybe 10 seconds of watching the scene, my computer froze. No movement, no mouse movement in windows, no keypresses worked at all. Acouple of seconds later, the graphics fell out, leaving both my external monitor, and the LCD screen turn black (off).. Nothing to do but to hard reset by holding the power button in for 5 secs... :( Laptop is an Asus A7K (I think), Mobility Radeon x1600 graphics card. |
| ||
With disabled VSync the stone hits ground the moment I press E and the tire looks like a NES pixel object due to its massive speed. I've 998+ FPS Core 2 Duo E6600 oc @ 2x3Ghz, 8800GTS oc @ GTX specs, 2GB RAM |
| ||
Hey Josh, I know it's Friday but I paid like 8 hours ago. Any chance of a download or something? |
| ||
Interesting... I have downloaded v. 1.14 on my computer...but it try to open a window but nothing. Athlon64 3500+ 1Gb Ram GeForce 6600GT (Nvidia latest driver 162.18 - sigh...) Where can I download the older gfx driver? Since I installed them I have only problem with the demo of Leadwerks... |
| ||
I tried out the idea with interpolating physics...not just an accumulated time step, but actually tweening the bodies before the render and restoring their position after. It works amazingly well. Physics look fluid and smooth, even at 1000 FPS. I am surprised something so simple provided such an improvement with no problems. |
| ||
Where is the link to the new demo ? |
| ||
Good News Josh :) |
| ||
Nice to hear that the effect I've seen back then was really the "undesired" one :) |