Leadwerks Game Engine 5.0.2 Released
[p]Leadwerks Game Engine 5.0.2 is now available with new fixes and features for you to enjoy.[/p][previewyoutube][/previewyoutube][h2]Enhanced Timing[/h2][p]New enhanced timing features provide smooth stutter-free movement and make Leadwerks a great choice for use in twitch shooters and other fast-paced games. Before you we begin, let me point out that you don't have to do any of this. 75% of players use a screen refresh rate of 60 Hz, and if you don't specify any optional parameters in the world Update and Render methods, the engine will choose settings for you. This is only for people who want extra control over their game timing.[/p][p]You can run the world update loop and the rendering loop at the same speed, perfectly synchronized, or you can render multiple frames for each world update, using interpolation on every object to smoothly display motion at high framerates, without overloading the main thread.[/p][p]For example, if your game runs at 60 hz and the screen refresh rate is 60 hz, you can specify that one frame should be synchronized across both threads.[/p][p]
[/p][p]The world is updated at 60 Hz and the world Render method specifies that one frame should be synchronized:[/p]
[/p][p]Here, we just increase the game update speed to 120 and use one synced frame:[/p]
[/p][p]Here, the world is still updated at 60 Hz and the world Render method specifies that two frames should be drawn for each world update:[/p]
[/p][p]For other screen refresh rates, you can divide the refresh rate by 60 to determine the closest value to 60 and use this for the world update frequency:[/p][p]
[/p][p]Here, the world update speed is 72 and the renderer draws two frames for every one update in the game loop:[/p]
[/p][p]Here we still use 60 Hz for the game update frequency, but with four frames drawn for each game update, proving smooth motion at 240 frames per second:[/p]
[/p][p]Of course, if you want the ultimate responsiveness you can just update the whole game at 240 Hz, but the variable-rate rendering feature allows games to run at a high framerate without being too demanding on the CPU.[/p][p]These features combined provide strong support for fast-paced games, as well as high-frequency displays and VR headsets, with a difference you can feel whenever you play.[/p][h2]Entity Collision Testing[/h2][p]New collision testing features allow you to test the intersection of two entities outside of the physics simulation. This can be used for improved object holding or custom player movement.[/p][h2]Faster Texture Compression[/h2][p]Although BC7 provides better quality texture compression, the editor now defaults to using DXT5, which compresses much faster and provides a more responsive user experience, especially when converting large batches of images into DDS format. You can switch to BC7 compression if you wish by changing the Material Generation > Compression format setting in the program options. The images below show a comparison of BC1 (DXT1) to BC7. Although DXT1 is lower quality compression than DXT5, both formats will have some similar artifacts.[/p][p]
[/p][p]BC7 does provide reduced artifacts, using the same storage space as DXT5, but at the cost of increased compression time. Many developers may prefer to have faster texture compression / conversion over slightly higher quality.[/p][p]
[/p][p]You can read more about texture compression formats here.[/p][h2]Bug Fixes Galore[/h2][p]The latest update fixes more than 75 bugs that were identified since the launch of Leadwerks 5, providing a stable and smooth experience for new and experienced developers. A big thanks is due to the entire community for their help identifying important issues. The engine currently has a 97.7% bug closure rate for all reported issues.[/p][h2]Faster Online Features[/h2][p]We've also migrated our site to a new web hosting company, so the forum, blogs, and downloads system will load a lot faster now.[/p][h2]New Commands[/h2][p]The following new commands have been added to the engine API:[/p]
[/p][p]The following DLLs will be added to your project:[/p]
[/p][p]You must also add the Microsoft GameInput library via nuget. In Visual Studio, select the Tools > NuGet Package Manager > Manage Nuget Packages for Solution... menu item, search for "GameInput" and apply to the project.[/p][p]
[/p][p]If you ran the project update before performing this step, the interface will incorrectly show the package as installed. If this happens, press the uninstall button, then find and install the Microsoft GameInput library again. If the GameInput library is not installed in your project, you will get linking errors when you try to compile it.[/p][p]New C++ projects created with Leadwerks 5.0.2 will be created with these settings enabled by default.[/p][h2]Looking Ahead[/h2][p]Thank you for your support as we continue on to the development of Leadwerks 5.1, which is planned to provide better performance and more optimizations aimed at low-end and older hardware, as well as new visual effects and tools.[/p]
world:Update(60)[p]If your screen has a refresh rate of 120 Hz, you can double the game update speed and render one frame per update, at a faster rate. The only drawback to this is your game code will only have 8 milliseconds to complete, instead of the full 16 milliseconds a 60 Hz loop would provide:[/p][p]
world:Render(framebuffer, true, 1)
world:Update(120)[h2]Variable-Rate Rendering[/h2][p]There is another way to handle this. If your screen refresh rate is 120 Hz, you can still update the game 60 times per second, while rendering at twice the speed:[/p][p]
world:Render(framebuffer, true, 1)
world:Update(60)[p]How is it possible for the game and rendering loops to run at different speeds? The renderer interpolates between the last two frames of data received to provide smooth motion. The image below provides a very exaggerated example for clarity. Both boxes are updating their rotation at just one update per second, but the renderer is using interpolation on the object on the left to provide the appearance of smooth motion.[/p][p]
world:Render(framebuffer, true, 2)
world:Update(72)[p]The code below will calculate these values for you:[/p]
world:Render(framebuffer, true, 2)
local refreshrate = window.display:GetRefreshRate()[p]You can use more than just two synced frames. The code below will render four frames for every one update in the game loop, with perfectly smooth motion, when a 240 Hz display is in use:[/p][p]
local syncedframes = Floor(refreshrate / 60)
local updatespeed = Round(refreshrate / syncedframes)
world:Update(updatespeed)
world:Render(framebuffer, true, syncedframes)
world:Update(60)[h2]Low-Latency Mouse Input[/h2][p]If the renderer is interpolating between the last two game updates, this introduces latency into the system. However, we discovered during our work with VR that not all latency matters. The only latency you can actually perceive is that which is connected to your body. In VR, this means the orientation of your headset and controllers. Our solution was to put all our VR code in the rendering thread, and always update the headset orientation right before a new frame is rendered.[/p][p]For 3D games, especially shooters, mouse look latency is a significant problem. We noticed in Leadwerks 5.0 the mouse looking could sometimes feel "mushy" and wanted a solution to this. We found that using the new Microsoft GameInput API, we could enable low-latency mouse looking behavior that could be called from any thread. The new Camera:SetMouseLook command allows us to perform the mouse look updating in the rendering thread, right before a frame is drawn, just like we did with our VR implementation.[/p][p]
world:Render(framebuffer, true, 4)
- [p]Display:GetRefreshRate[/p]
- [p]Hmd:GetRefreshRate[/p]
- [p]Camera:SetMouseLook[/p]
- [p]Entity:CollisionTest[/p]
- [p]Entity:SetPlayerSize[/p]
- [p]newton.dll[/p]
- [p]newton_d.dll[/p]
- [p]dCustomJoints.dll[/p]
- [p]dCustomJoints_d.dll[/p]
- [p]dContainers.dll[/p]
- [p]dContainers_d.dll[/p]