Jump to content

Josh's Dev Blog

Entries in this blog

Leadwerks Game Engine 5 Beta Updated with Pathfinding, Bone Attachments, and more...

A new update is available for beta testers. This adds navmesh pathfinding, bone attachments, and the beginning of the Lua debugging capabilities.New commands for creating navigation meshes for AI pathfinding are included. NavMesh Pathfinding In Leadwerks Game Engine 5 you can create your own navmeshes and AI agents, with all your own parameters for player height, step height, walkable slope, etc.: shared_ptr<NavMesh> CreateNavMesh(shared_ptr<World> world, const float wi

Josh

Josh

Bone Attachments

In Leadwerks Game Engine 4, bones are a type of entity. This is nice because all the regular entity commands work just the same on them, and there is not much to think about. However, for ultimate performance in Leadwerks 5 we treat bones differently. Each model can have a skeleton made up of bones. Skeletons can be unique for each model, or shared between models. Animation occurs on a skeleton, not a model. When a skeleton is animated, every model that uses that skeleton will display the same m

Josh

Josh

Leadwerks Game Engine 5 Beta Update

An update is available for beta testers. What's new: GLTF animations now work! New example included. Any models from Sketchfab should work. Added Camera::SetGamma, GetGamma. Gamma is 1.0 by default, use 2.2 for dark scenes. Fixed bug that was creating extra bones. This is why the animation example was running slow in previous versions. Fixed bug where metalness was being read from wrong channel in metal-roughness map. Metal = R, roughness = G. T

Josh

Josh

Leadwerks Game Engine 5 Beta Update

A new beta update to Leadwerks Game Engine 5 is available now. New stuff: Streaming terrain CopyRect and Texture::SetSubPixels Texture saving Note that the "SharedObject" class has been renamed to "Object" and that math classes (Vec3, Vec4, Plane, Mat3, etc.) no longer derive from anything.

Josh

Josh

Streaming Terrain in Leadwerks Game Engine 5

The terrain system in Leadwerks Game Engine 4 allows terrains up to 64 square kilometers in size. This is big enough for any game where you walk and most driving games, but is not sufficient for flight simulators or space simulations. For truly massive terrain, we need to be able to dynamically stream data in and out of memory, at multiple resolutions, so we can support terrains bigger than what would otherwise fit in memory all at once. The next update of Leadwerks Game Engine 5 beta suppo

Josh

Josh

Leadwerks 5 Beta Update

A new beta is available in the beta forum. This adds new texture and pixmap features, Basis texture support, and support for customized project workflows. Use of Basis textures brought the download size down to less than 300 megabytes. New Lua examples are included: Build Texture Build Cubemap SetSubPixels

Josh

Josh

Building Textures in Leadwerks Game Engine 5

Building Textures in Leadwerks Game Engine 5

The new engine features advanced image and texture manipulation commands that allow a much deeper level of control than the mostly automated pipeline in Leadwerks Game Engine 4. This article is a deep dive into the new image and texture system, showing how to load, modify, and save textures in a variety of file formats and compression modes. Texture creation has been finalized. Here is the command: shared_ptr<Texture> CreateTexture(const TextureType type, const int width, const in

Josh

Josh

Project Workflows

It's funny how all of the various features in the new engine are interconnected and development just flows from one to another. I was working on terrain, and I needed to save out some texture data so I implemented Pixmaps, and I wanted to add Basis support and DXT decompression, and then I started converting texture formats, and now I need a way to manage this all. This is an idea I have had for several years and I finally got to try it out. Leadwerks Game Engine 4 has a strictly defined wo

Josh

Josh

Basis Universal Texture Support

Basis Universal Texture Support

Last year Google and Binomial LLC partnered to release the Basic Universal library as open-source. This library is the successor to Crunch. Both these libraries are like OGG compression for textures. They compress data very well into small file sizes, but once loaded the data takes the same space in memory as it normally does. The benefit is that it can reduce the size of your game files. Crunch only supports DXT compression, but the newer Basis library supports modern compression formats like B

Josh

Josh

Advanced Terrain Building in Leadwerks Game Engine 5

Advanced Terrain Building in Leadwerks Game Engine 5

In Leadwerks Game Engine 4, terrain was a static object that could only be modified in the editor. Developers requested access to the terrain API but it was so complex I felt it was not a good idea to expose it. The new terrain system is better thought out and more flexible, but still fairly complicated because you can do so much with it. This article is a deep dive into the inner workings of the new terrain system. Creating Terrain Terrain can be treated as an editable object, which i

Josh

Josh

Pixmap Class and DDS Saving

Pixmap Class and DDS Saving

Textures in Leadwerks don't actually store any pixel data in system memory. Instead the data is sent straight from the hard drive to the GPU and dumped from memory, because there is no reason to have all that data sitting around in RAM. However, I needed to implement texture saving for our terrain system so I implemented a simple "Pixmap" class for handling image data: class Pixmap : public SharedObject { VkFormat m_format; iVec2 m_size; shared_ptr<Buffer> m_pixels; int

Josh

Josh

Terrain Compression

I wanted to see if any of the terrain data can be compressed down, mostly to reduce GPU memory usage. I implemented some fast texture compression algorithms for BC1, BC3, BC4, BC5, and BC7 compression. BC6 and BC7 are not terribly useful in this situation because they involve a complex lookup table, so data from different textures can't be mixed and matched. I found two areas where texture compression could be used, in alpha layers and normal maps. I implemented BC3 compression for terrain alpha

Josh

Josh

Terrain in Leadwerks 5 Beta Updated

Terrain in Leadwerks 5 Beta Updated

A new update is available for beta testers. This adds a new LOD system to the terrain system, fixes the terrain normals, and adds some new features. The terrain example has been updated ans shows how to apply multiple material layers and save the data. Terrain in LE4 uses a system of tiles. The tiles are rendered at a different resolution based on distance. This works great for medium sized terrains, but problems arise when we have very large view distances. This is why it is okay to

Josh

Josh

Documentation and Code Details

Documentation in Leadwerks 5 will start in the header files, where functions descriptions are being added directly like this: /// <summary> /// Sets the height of one terrain point. /// </summary> /// <param name="x">Horizontal position of the point to modify.</param> /// <param name="y">Vertical position of the point to modify.</param> /// <param name="height">Height to set, in the range -1.0 to +1.0.</param> virtual void SetHeight(const int x

Josh

Josh

Leadwerks 5 Beta Update

A new update is available for beta testers. Terrain The terrain building API is now available and you can begin working with it, This allows you to construct and modify terrains in pure code. Terrain supports up to 256 materials, each with its own albedo, normal, and displacement maps. Collision and raycasting are currently not supported. Fast C++ Builds Precompiled headers have been integrated into the example project. The Debug build will compile in about 20 seconds the first run

Josh

Josh

Terrain Building API in Leadwerks 5 Beta

Terrain Building API in Leadwerks 5 Beta

An often-requested feature for terrain building commands in Leadwerks 5 is being implemented. Here is my script to create a terrain. This creates a 256 x 256 terrain with one terrain point every meter, and a maximum height of +/- 50 meters: --Create terrain local terrain = CreateTerrain(world,256,256) terrain:SetScale(256,100,256) Here is what it looks like: A single material layer is then added to the terrain. --Add a material layer local mtl = LoadMaterial("Materials/Dirt

Josh

Josh

How to Fix Slow Windows 10 (this week)

How to Fix Slow Windows 10 (this week)

Here are some things I did in the last couple days to fix a computer that was basically unusable. It seems that Superfetch was rebranded to "SysMain" in an update and automatically re-enabled. If your computer is grinding away either the CPU or disk usage while doing nothing, this is the culprit. Disable it in Windows services. The XBox games bar is suspect. I recommend disabling it now that FRAPS supports Vulkan. Some features in Visual Studio are making it unusably slow. In

Josh

Josh

Leadwerks 5 Beta Update

A new beta is uploaded with lots of new features and improvements. Things are really taking shape! Animation is now supported and it's really fast. Two examples are included. Package loader plugins now supported, VPK package loader for Source Engine games included with example. Added localization example. Shaders folder very neatly organized, now contains shader family files. Config folder eliminated. Engine headers cleaned up and organized. Lots

Josh

Josh

Animation speed in Vulkan vs. OpenGL

Animation speed in Vulkan vs. OpenGL

I created a test of 1000 animated crawler models to see how the performance of Vulkan stacks up against our older OpenGL renderer. Here it is in OpenGL running at 37 FPS, which is pretty respectable considering how many animations are playing (and about 4 million polygons). With Vulkan the same test yields a framerate of 66 FPS, 78% faster than the OpenGL version. Here is a video of the characters animating. Each skeleton is its own unique animation system, there are no sha

Josh

Josh

Skinned Animation in Vulkan

Skinned Animation in Vulkan

It's been nearly a year since I made the decision to port our OpenGL renderer over to Vulkan, and it has been very difficult work, but we are getting back up to speed. I was able to get skinned animation working for the first time in Vulkan yesterday, using a slightly modified version of our original animation shader code. The system works exactly the same as in Leadwerks 4, with a few differences: Animation features are confined to the Model class only, and are no longer

Josh

Josh

Game Analytics API Plugin

Analytics is a feature I have long thought was a good candidate to be moved into a plugin. It is an optional features that only some users care about. It imports some pretty big third-party libraries into the engine. It requires an extra DLL be distributed with your game. It's a totally self-contained features that is easy to separate out from the rest of the engine. I have uploaded my code for Analytics in Leadwerks here as a new empty Visual Studio project:

Josh

Josh

Organizing the New Engine

The addition of our plugin system makes the engine feel different. There is a stronger distinction between core and non-essential functionality. I removed a lot of third-party libraries from the project and am just focusing on graphics, physics, pathfinding, and other features that are core to the functioning of your game. Things like file importers terrain generation, etc. can be stored away in self-contained optional plugins, or can be part of the editor project, and do not need to reside in t

Josh

Josh

Package Plugins and Mods

Package Plugins and Mods

Leadwerks 4 supports compressed and encrypted game files in ZIP format, but there are many different custom package formats different games use. The plugin system in Leadwerks 5 allows us to create importers for these different package formats so we can access content directly from commercial games you have installed on your computer. The example below shows how to load a VTF texture from the game Half-Life 2 directly from the game's install files. First we need to load some plugins to deal

Josh

Josh

Leadwerks Plugin SDK

Leadwerks Plugin SDK

I've restructured the plugin SDK for our new engine and created a new repository on Github here: https://github.com/Leadwerks/PluginSDK The GMF2 format will only be used as an internal data transfer protocol for model loader plugins. Our main supported file format will be GLTF. As of now, the plugin system can be used to write texture loaders for different file formats, model loaders, or to modify behavior of particles in the new particle system. The FreeImage texture loader has been

Josh

Josh

Particle Plugins and More

The Leadwerks 5 beta will soon be updated with particle emitters and an example particle system plugin. Previously, I showed some impressive results with physically interactive particles that collide with and exert forces on the environment. I decided to use the plugin system for controlling particle behavior, as this offers the best performance and can be run on the physics thread.  A particle system plugin uses some predefined structures and functions to modify the behavior of particles w

Josh

Josh

×
×
  • Create New...