Jump to content

Josh

Staff
  • Posts

    23,516
  • Joined

  • Last visited

Blog Entries posted by Josh

  1. Josh
    C++11 modernizes the C++ programming language with many new features and techniques. Below are just a few of the new ways you can use C++ with Leadwerks.
     
    auto
    You can automatically declare a new variable type by the data that is assigned to it:

    auto i = 42; // i is an int auto l = 42LL; // l is an long long
    auto p = new foo(); // p is a foo*
     
    Here's a more practical use that saves a lot of typing. The code below:

    std::map<std::string, std::vector<int>> map; for (std::map<std::string, std::vector<int>>::iterator it = begin(map); it != end(map); ++it)
    {
    }
     
    Can be replaced with this:

    std::map<std::string, std::vector<int>> map; for (auto it = begin(map); it != end(map); ++it)
    {
    }
     
    std::next
    You can retrieve the nth element of a standard list with the new std::next function. For example, I use this internally in the engine to retrieve a spotlight or other entity by index:

    return *(std::next(spotlights.begin(), n));  
    Shared Pointers
    C++11 supports unique pointers, which are like regular pointers we use now. It also supports shared pointers, which use automatic reference counting, and weak pointers, which do not increment the object reference count. This basically provides built-in functionality similar to the reference counting system Leadwerks uses. Future major versions of the engine may make more heavy use of this feature.
     
    And one bonus feature: nullptr
    The new nullptr value is not interchangeable with NULL, which can convert to an integer. This makes it easier to specify that a value is supposed to be a pointer and that zero is not a valid input.
     
    You can read more about new C++11 tricks and features here.
  2. Josh
    Note: This article contains some referral links for affiliate systems that I added after writing it. My purpose for including them is so that I can learn how these systems work by participating in them, because I am interested in possibly implementing one of our own in the future. The article was written because these are all things I am using and recommend and I am very bored with the same old things.
    Except for VR, the last decade of technology has been pretty yawn-inducing. I think Silicon Valley effectively killed the entire tech industry by showering a few companies with unlimited free money, but the scam is running out and you can't hold back innovation forever. In this blog I will talk about three technologies you might not have heard of and explain what each one can do for you.
    Proton Mail
    Proton Mail is like the new Gmail, except better because it uses end-to-end encryption so your email is never visible on the company's servers. You can read your email by logging into the website, using the smartphone app, or by installing the bridge application to decrypt mail on your PC and integrating with Outlook (requires the paid plan, but that is only $4.99 a month). There's also a free VPN available so you can have secure encrypted connections on the coffee shop wifi.
    A quick search of our mailing list shows that a lot of you have already switched to Proton Mail, making Gmail the new AOL.

    It is possible to use Proton Mail's secure system with your own domain, which gives you the ability to separate your email from your website. This is pretty nice for a couple of reasons. First, if your website is down temporarily for maintenance, email keeps flowing without a hitch. Second, if some type of theoretical security breach were to hit your site, email would be unaffected by it, or vice-versa. I think it is also possible to set up directly with your DNS so you can have email on your own domain with no web hosting at all.
    Why you need it:
    End-to-end encryption makes your email secure. No data harvesting to show you annoying ads. It just looks cool. Brave Browser
    On the surface, Brave browser looks nearly identical to Chrome, but underneath the hood it is a different beast. This is the browser that is really pushing new technology with features like built-in bit torrent, crypto currency, tor, and support for the peer-to-peer IPFS Internet protocol. Not all these technologies are going to pan out, but the possibilities of doing away with the DNS system or revolutionizing online commerce are tantalizing, and some of them are going to work out. With 20 million users Brave now has the size to benefit from network effects so it will be interesting to see what kinds of things are possible with this browser.

    I feel I should warn you. Once you start using Brave it is difficult to go back, especially once you understand what that would involve.

    Why you need it
    Built-in ad blocker. No data harvesting. Innovative new features. Works all with Chrome extensions. BackBlaze B2
    BackBlaze B2 is a cloud storage system similar to Amazon S3. These types of systems are critical for us because it allows a separate of website files and content files. Our website is only a few gigabytes and lives on our server, while all the user-generated files including images, attachments, avatars, and any other uploaded content is all stored on a backend file system. This makes backups to the website very small and as our content grows our core site stays the same size. Invision Power Board does not yet support BackBlaze B2 but the moment it does I plan to switch and cut 75% off our file storage costs.

    Why you need it:
    Like Amazon S3, at 25% the cost. Bonus Tip: KeyCDN
    KeyCDN is a content distribution network like Cloudflare, and is another Swiss company. You can set this up to deliver images or other files faster to the user, and the basic plan lets you get started for free. I plan to integrate this into our site to serve up images and other files faster in the future.

    Why you need it:
    Try a CDN for free. Very inexpensive paid plan. In Summary
    When we continue to rely on old familiar technologies and services we block ourselves from getting involved in new things. I had no idea what IPFS was until I started using Brave, and now I want to add support for it with our website. What are some of the interesting technologies, products, services, or websites you have seen popping up? I feel like a new era has begun.
  3. Josh
    In designing the new engine, I have found that there are three distinct types of optimization.
    Streamlining
    This is refinement. You make small changes and try to gain a small amount of performance. Typically, this is done as a last step before releasing code. The process can be ongoing, but suffers from diminishing returns after a while. When you eliminate unnecessary math based on guaranteed assumptions you are streamlining code. For example, a 4x4 matrix multiplication can skip the calculations to fill the right-most column if the matrices are guaranteed to be orthogonal (non-sheared).
    Quality Degradation
    This is when you downgrade the quality of your results within a certain tolerable level where it won't be noticed much. An example of this is using a low-resolution copy of a model when it is far away from the camera. Quality degradation can be pretty arbitrary, and can mask your true performance, so it's best to keep an option to disable this.
    Architectural
    By designing algorithms in a way that makes maximum use of hardware and produces the most optimum results, we can greatly increase performance. Architectural optimization produces groundbreaking changes that can be ten or 100 times faster than the old architecture. An example of this is GPU hardware, which produces a massive performance increase over software rendering. We're seeing a lot of these types of improvements in Leadwerks Game Engine 5 because the entire system is being designed to make maximum use of modern graphics hardware.
     
  4. Josh
    In this blog I want to talk about some cheap and easy ways to give your players a deeper more memorable experience, without touching a line of code.

    Voice Acting
    Games have used off-screen voice actors for years to add character, tell stories, and create a setting with minimal investment. A good voice actor will give enough texture to the backstory that the player will make up the missing pieces in their own imagination. All it takes is a microphone and someone with a nice speaking voice. 



    Hint at what has come before
    Many, many games have scenes set up as the aftermath of what has come before. Graffiti on the walls or gruesome scenes of the remains of carnage are two ways to accomplish this. Hinting at past events visually can be much more powerful than explicitly stating what happened. 


    Logo Design
    If you hunt around, you can get amazing logo design work done on Fiverr.com for next to nothing. You will probably spend more than five dollars, but it will still be insanely cheap. A good logo creates your game's identity, and hints at the possibilities contained within. Again, this is about putting a mood and aesthetic out there, and letting the player's imagination take care of the rest. 

     
    These are three simple things you can do to set your game apart and make a memorable experience that intrigues the user's imagination, without touching a line of code. In fact, any of these techniques could be far more effective than spending weeks coding a new feature.
  5. Josh
    Crowd navigation is built into Leadwerks3D. You just set a destination, and your characters will automatically travel wherever you tell them to go. I think having navigation built into the engine will give us better results than a third party add-on would. We can automatically recalculate sections of the map that change, AI script functions can be called when certain events occur, and the code to control characters is extremely simple.
     


  6. Josh
    As I have stated before, my goa for this game enginel is not to build a marketplace of 3D models, but instead to just make sure our model loading code reliably loads all 3D models that are compliant with the glTF specification. I started testing more 3D models from Sketchfab, and found that many of them are using specular/gloss materials. At first I thought I could just fudge the result, but I wasn't getting very good results, and the Windows 10 3D Object Viewer was showing them perfectly. This made me very upset because I feel that the software I make for you should be the absolute best thing possible. So I went ahead and implemented the actual KHR_materials_pbrSpecularGlossiness extension. Here are the results:

    It looks quite good without breaking the specular/gloss approach. I think this would be an ideal way to upgrade the Leadwerks renderer without making changes that are too big.
    To implement this, I used the glTF sample viewer source code, which is a bit of a reference renderer for glTF materials. It has changed quite a lot since I first used it as a guide to implementing PBR materials. I decided I might as well integrated the latest code into our renderer. The shader code is very well organized, so it was pretty simple to integrate into my latest code. The glTF materials system is great because it provides a standardized materials system with a lot of advanced effects, along with a reference renderer that shows exactly how the materials are supposed to appear. This means that any engine or tool that is conforms to the glTF standard will always display the same materials the same way, while still allowing additional more specialized features like shadows and post-processing effects to be added.
    In addition to revising our metal-roughness code, I went ahead and added support for some more features. The KHR_materials_clearcoat extension basically makes cars look like cars:
    It adds an extra layer of reflections that gives a dark surface a big boost, and can even use a separate normal map for the clearcoat layer:

    The KHR_materials_sheen extension makes cloth look like cloth. You can see for yourself in the image below. The appearance kind of makes my skin crawl because I can't stand the feeling of velvet / velour. Apparently this is some kind of common tactile hypersensitivity and I actually get a feeling like electricity shooting through my spine just looking at this image, so I think the effect is working well:

    Another creepy example. Just the thought of running my hand over that fuzzy orange fabric is making me shiver:

    The KHR_materials_transmission extensions provides a physically accurate model for transparent surfaces, with support for refraction. Here's a shot of refraction bending the background image:

    This also supports roughness, for making the refracted background appear blurry like frosted glass:

    I feel the background is too pixellated and should be improved. This problem occurs in the reference renderer, and I have several ideas on how to solve it.
    The transparency system is very advanced, and introduces a lot of interesting new commands to the engine:
    Material::SetIndexOfRfraction(const float ior) Material::SetThickness(const float thickness) Material::SetTransmission(const float transmission) These features will give you reliable support for loading glTF models from any source, as well as the best image quality possible for your games. I think realistic materials in VR will also make a big difference in bridging the uncanny valley. And all of this is done with the fastest possible performance for VR.
    And yes, of course I used a gamepad to do all of this.
     
     
  7. Josh
    Yesterday I tried a plugin I've been meaning to try out for a long time, Steam Sign-in for IPB. It worked without a hitch and I was able to easily figure out how to locate a Steam ID from a forum account, and vice versa. You can sign straight into Leadwerks using your Steam ID, or you can add a Steam ID to your existing account. (See "Edit Profile".)
     
    The gallery, videos, Workshop, and games sections will now correctly link to your Leadwerks profile page. Notice when you click on the author's name, it now navigates to their forum profile page:
    http://www.leadwerks.com/werkspace/page/viewitem?fileid=634076765
     
    This also will allow me to add sections in your profile to show all your screenshots, videos, Workshop items, and games. A Steam badge will be shown next to your forum posts that links to your Steam profile.
     
    But wait, there's more we can do with this. Here are some of the ideas I've wanted to try for a long time:
    Display statistics like hours played and boxes created next to your forum posts.
    Display your achievements in the forum (and add some more!)
    Add achievements for forum posts, blogs, etc.
    Add achievements that unlock free custom assets.
    Gamify the game creation and learning process. (Quizzes?)
    Gain more transparency on how people are actually using the engine.

     
    Basically, this allows us to integrate community interaction with the editor usage more closely. I'm not exactly sure how it will work out, but it allows us to try a lot of new ideas in the future.
  8. Josh
    I thought I would take a minute to write down some of the things I have learned about releasing software on Steam, in order to help with your game releases.
     
    First of all, always wait a week after you are "finished" to release a major update. This is because you will always find little problems, and sometimes major ones, after you think you've finished everything. Leadwerks 3.6 was scheduled for release at the start of this week, as far as I knew everything was working, but I knew to give it a buffer of one week. During this week I found and solved a lot of small problems that will make the postponed release much better.
     
    Second, you need a "latest" and a "stable" build. Steam has a wonderful feature that lets you create multiple branches for your application. Leadwerks uses a "beta" branch for more frequent updates and testing. This receives updates several times a week. The default branch is for official releases, and only gets updated every couple of months. You do NOT want to be releasing new features and fixes on your default branch immediately. It's very scary to release updates to thousands of people without widespread testing being carried out on them first. The "latest" / beta branch lets you get a large pool of testers who have all opted into the branch, so they will be more forgiving if you break something.
     
    Third, create a sticky thread in your game forum that points users to the download locations for graphics drivers, like this. This is the most common problem you will run into as a game developer, no matter what technology you use. Also, make sure you configure Steam to install OpenAL, and the VC 2010 and 2013 redistributables.
     
    Finally, I recommend releasing support one platform at a time. In the beginning you will have to upload frequent updates. Although Leadwerks is generally platform-independent, it's better to make sure things are working on Windows first, and then add Linux once everything has calmed down. This is the approach I am taking with Leadwerks Game Launcher.
     
    These practices will help your game launch go as smoothly as possible. Good luck and have fun!
  9. Josh
    While working with zlib, I implemented the package system, and it turned out really cool. Here's some stuff you can do
     
    First, let's load the package and register it in the file system:

    Package* pak = ReadPackage("mystuff.pak"); //Read the package RegisterPackage(pak); //Register package into file system
    Read a file from a package, just as if it were on the hard drive:

    Stream* stream = ReadFile("mystuff/new document.txt"); //Read a file straight out of the package!
    Write a file to a package, just as if it were on the hard drive:

    Stream* stream = WriteFile("mystuff/new document.txt"); //Write a file straight into the package!
    To save your changes permanently in the package, make sure you close it before the program ends:

    pak->Close(); //Close the package when finished to save the changes
    This should work in the editor, too, so you can store all your files in packages and the editor will automatically save any packages that change.
     
    When a file exists both on the hard drive and in a package, the engine will preferentially read from the file on the hard drive. When a file is written, the engine will preferentially write to a package file, if one is available with the directory the file is being written to. Zip folders and file hierarchy are kept intact.
     
    The idea is you can register all your packages, probably with a recursive function, and then read files from and write them to the packages, without knowing or caring whether you are dealing with a file on the hard drive or a file in a package. This is different from the abstract file system, because each file has a precise file path. The only ambiguity is when you have a file on the hard drive and in a package file with the same name, in the same directory. The package file names are considered folders. So if I had a model "teapot.mdl" in a package file "Models.pak" I would load it by calling LoadModel("Models\teapot.mdl"). If you want, you can leave all your files on the hard drive during development, and then let Leadwerks automatically package them up for publishing, and you won't have to change any code to load your files.
     
    Once a package is registered, all the file system commands will include them in the file hierarchy, and there is no need to worry about packages at all. If you do write to any, you should close them before ending the program so your changes are saved.
     
    My idea I mentioned last time about putting shaders in zip packages and calling the .shd files won't work, because that involves packages within packages, and I don't want to do that. So the shaders are simply going to be left as collections of associated .vert, .frag, .geom, .ctrl, and .tess files, which will be easier to keep track of when editing anyways.
  10. Josh
    The script editor and Lua implementation is very close to being a usable programming environment. You can actually see the pointers to the C++ objects you create, and step through code. It's still missing features, but the parts I was worried about are working.
     
    I am adding Lua commands like crazy, and it's easy to keep track of them because they all reside in one header file. The function overloading is great, as you can see in my example here, where I use a single float value to set the ambient light color. There's also a new Camera::SetFOV command.



    I also fired up the editor for the first time in a couple weeks, and it immediately struck me that there should be single texture, shader, model, etc. editors, instead of creating a new one in a window every time an asset is opened. That and I want to make the interface more like 3D World Studio are the two things I will be working on in the editor. I'm nearly ready to start writing the scene editor. That's not an area of new research, so it will go a lot faster. It's just a lot of work and careful planning, but no more crazy unknown parts that I'm not sure will actually work.
     
    All in all, the tools I am using now give me complete control to give you the best experience possible, and I am really happy with Leadwerks Engine 3 so far!
  11. Josh
    These are the top-ten top grossing items in the Leadwerks Workshop Store over the last three months:
    Nature Model Pack
    SciFi Materials 1
    Modern Sewer Construction Kit
    Zombie Action Figures
    Old Furniture Pack
    SciFi Materials 5
    Mercenary Action Figure
    Morgue
    Strike Troop
    The Stalker

     
    First of all, we can see that outdoor vegetation and rocks sells best. This is consistent with what I have seen with our DLCs and with products in the past.
     
    We also see four character models, with the character pack selling better than single characters.
     
    There are three environment models packs.
     
    Finally, texture packs are actually selling. I believe this is because of our focus on easy CSG mapping, which makes good textures very useful.
     
    All of these products are priced at roughly $10, $20, or $30. Lower prices don't seem to make up with higher volume sales, based on the data we have. In fact, the highest priced item in the store also happens to be the top-grossing.
  12. Josh
    Today I implemented the last two compound primitives. Tubes are the same as in 3D World Studio, with parameters for the number of segments and thickness. Since the Leadwerks3D editor supports smooth groups, another new compound primitive has been added. A torus is a "donut" shape. These can be used to make curved pipes and other things. Here are the two compound primitives, side by side:

     
    Smooth groups and new primitives in Leadwerks3D allow you to create new kinds of geometry which were traditionally not possible with CSG editing:

     
    An interesting case occurs when a torus' cross-sectional radius exceeds the radius of the ring. At this point the shape folds in on itself, eventually degenerating into a sphere. To prevent this from occurring, the creation function automatically adjusts the cross-sectional radius, as shown in the image below:

  13. Josh
    One of the downsides of deferred rendering is it isn't very good at handling transparent surfaces. Since we have moved to a new forward renderer, one of my goals in Leadwerks 5 is to have easy hassle-free transparency with lighting and refraction that just works.
    Pre-multiplied alpha provides a better blending equation than traditional alpha blending. I'm not going to go into the details here, but it makes it so the transparent surface can be brighter than the underlying surface, as you can see on the vehicle's windshield here:

    I've been working for a while to build an automatic post-processing step into the engine that occurs when a transparency object is onscreen. If no transparent objects are onscreen, then the post-processing step can be skipped.
    You can also call Camera::SetRefraction(false) and just use regular GPU-blended transparency with no fancy refraction of the background, but I plan to enable it by default.
    To use this effect, there is absolutely nothing you have to do except to create a material, make it transparent, and apply it to a mesh somewhere.
    auto mtl = CreateMaterial(); mtl->SetTransparent(true); mtl->SetColor(1,1,1,0.5); The lower the alpha value of the material color, the more see-through it is. You can use an alpha value of zero to make a refractive predator-like effect.
     
  14. Josh
    A new update is available for beta subscribers. Transparent materials are now supported. Unlike the old deferred renderer, our new clustered forward renderer supports transparency really really well! You can add these in a JSON material file with a Boolean property called "transparent" set to true:
    "transparent": true There are no separate blend modes now, since pre-multiplied alpha allows alpha and additive blending in a single pass. This is actually a really simple technique but for some reason all the information about it online are these horrible academic examples that don't show any clear benefit. It wasn't until I thought "how do I make shiny glass?" that I actually started looking for a way to do this.
    The command Material::SetTransparent(true) replaces the old SetBlendMode(blendmode) function. GLTF materials with blending will be automatically loaded. Per-object Z-sorting is not yet supported, but transparent groups of objects will always be rendered on top of opaque objects automatically, so you don't actually need to enable sorting if you don't expect to have two layers of transparency visible anywhere..

    We haven't seen a lot of transparency in games since the mid-2000s, because at the time deferred rendering was the best lighting technique. I think the capabilities of our new renderer will open up a lot of possibilities to create games that look different from anything in the past.
    You can get access to the beta and private forum right now for just $5.
  15. Josh
    After about four days of trying to get render-to-texture working in Vulkan, I have everything working except...it doesn't work. No errors, no clue what is wrong, but the renderer is not even clearing the depth attachment, which is why the texture read shown here is flat red.

    There's not much else to say right now. I will keep trying to find the magic combination of cryptic obscure settings it takes to make Vulkan do what I want.
    This is very hard stuff, but once I have it working I think that gives me all the functionality I need to finish the Vulkan renderer. Post-processing effects are just another render-to-texture problem. Now, the Vulkan renderer is much more strict than OpenGL, and I think the way post-processing will work is with a an automatically created blur texture and a single post-process shader. It's very wasteful to render a bunch of different passes for each effect, so instead I think we will just have some different effects files and a shader that can include whatever effects you want. In fact, the post-process pass can probably be done as a third Vulkan subpass which would be very efficient.
  16. Josh
    Virtual reality rendering is very demanding on hardware for two reasons. First, the refresh rate of most VR headsets is 90 hz instead of the standard 60 hz refresh rate most computer monitors operate at. This means that rendering must complete in about 11 milliseconds instead of 16. Second, we have to render the scene twice with two different views, one for each eye. Without any special optimizations, this roughly means that we have to pack 16 milliseconds worth of rendering code into five milliseconds.
    There are a few optimizations we can make to improve efficiency over a naive implementation. Although VR rendering requires two different views to be rendered, the two views are only a few centimeters apart.

    We can perform culling for both views at once by simply widening the camera frustum a little bit so that both eyes are included the camera volume.

    For rendering, Nvidia provides an extension for single-pass stereo rendering. This doubles up the geometry and renders to two different viewports at once, ensuring that the engine makes the same number of draw calls when rendering in stereo or normal mode. (The same can be done using a geometry shader with Intel graphics, although it has yet to be determined if VR will be possible on this hardware.) Here is the result:
    Combined with all the other optimizations I've packed into Turbo, like clustered forward rendering and a multithreaded rendering architecture designed specifically for VR, this makes VR rendering blazingly fast. How fast is it? Well, it's so fast that SteamVR diagnostics thinks that it is going backwards in time. Take a look at the timer in the lower left corner here:

    The obvious conclusion is that we have successfully broken the speed of light barrier and time travel will be possible shortly. Start thinking about what items or information you want to gift your past self with now, so that you can be prepared when I start offering temporal tourism packages on this site.

  17. Josh
    Environment probes are now available on the beta branch. To access them, you must set the "UnlockBetaFeatures" setting in the config file to 1, then start the editor. Environment probes are available in the "Effects" object creation category.
     
    Environment probes should be placed with one in each room. Use the object scale to make the probe's volume fill the room. (Like decals, probes will display a bounding box when selected.) You do not have to worry about covering every single space as the GI effect will blend in pretty well with the regular old ambient light level. Outdoor scenes do not need probes covering everywhere. There is not presently an entity icon for probes so you will have to select them from the scene panel. The AI & Events map has been updated with probes added, and it just took a couple of minutes.
     

     
    The color value of the probe (under the "Appearance" tab in the object properties) is used to control the amount of ambient lighting the probe contributes. The specular color of the probe is used to control the strength of the reflections it casts.
     
    Materials can control their reflectivity with their specular color and specular texture, if it exists. You may find some materials are highly reflective and need to be toned down a bit, so just make their specular color darker. The roughness setting is used to control how sharp or blurry reflections are. Higher roughness = blurrier reflections.
     
    When you first create an environment probe, its cubemap will be rendered immediately. You should re-render it when you have made some changes to your map and want to see the updated global illumination. To do this, select the Tools > Build Global Illumination menu item, which will update all environment probes in the scene.
     
    Global illumination is an inexpensive effect because it is precomputed. However, environment probes will be skipped if the lighting quality is set to the lowest setting.
  18. Josh
    A new beta update is available for subscribers. What's new?
    Lighting
    Point and spot lights are now supported in the new Vulkan renderer, with either PBR or Blinn-Phong lighting. Lighting is controlled by the shader in the material file. There are two main shaders you can use, "Shaders/PBR.spv" and "Shaders/Blinn-Phong.spv". See below for more details.

    JSON Materials
    Materials can now be loaded from JSON files. I am currently using the .json file extension instead of "mat", "mtl", or something else. If you load a scene and a JSON file is available with the same name as a material in that scene, the material will be loaded from a JSON file instead of the Leadwerks 4 .mat files. For example, you can create a JSON file named "brick01.json", place it in the same folder as "brick01.mat" and the new engine will load the JSON material if the brick material is used in a scene. However, it is not necessary to do this as the engine can also load Leadwerks 4 material files.
    A Turbo JSON material file looks like this. The string tokens are more or less locked in now and it is safe to start using them.
    { "turboMaterialDef": { "color": [ 1, 1, 1, 1 ], "emission": [ 0, 0, 0 ], "metallic": 0, "roughness": 0.6, "doubleSided": false, "blend": false, "albedoMap": "./concrete_clean_diff.tex", "normalMap": "./concrete_clean_dot3.tex", "metallicRoughnessMap": "", "emissionMap": "", "baseShader": "Shaders/PBR.spv", "shadowShader": "Shaders/Shadow.spv", "depthShader": "Shaders/DepthPass.spv" } } You can also indicate a shader for the new engine to use in an old Leadwerks 4 material file by adding a text line like this to the .mat file:
    baseshader="Shaders/myshader.spv" You do not need to specify a shader unless you are using a custom shader. JSON material files, by default, will use the PBR shader. Leadwerks 4 material files, by default, will use the Blinn-Phong shader.
    BC5 / BC7 Texture Compression
    A ton of new compression formats have been added, including the BC7 and BC5 formats, which provide better quality than DXT compression. Visual Studio 2019 actually has some good built-in DDS tools, although the BC7 compressor Is very slow. A sample material is provided using DDS textures (see "Materials/Rough-rockface1.json").
    Lua Commands
    A set of simple global Lua commands has been added.
    template<typename T> void LuaSetGlobal(const std::string& name, T var) template<typename T> void LuaPushObject(const std::string& name, T var) template<typename T> T LuaToObject(const int index = -1) int LuaCollectGarbage(const int what = LUA_GCCOLLECT, const int data = 0); void LuaPushString(const std::string& s); void LuaPushNumber(const double n); void LuaPushBoolean(const bool b); void LuaPushNil(); void LuaPushValue(const int index = -1); bool LuaIsTable(const int index = -1); bool LuaIsNumber(const int index = -1); bool LuaIsString(const int index = -1); bool LuaIsBoolean(const int index = -1); bool LuaIsObject(const int index = -1); bool LuaIsNil(const int index = -1); bool LuaIsFunction(const int index = -1); bool LuaToBoolean(const int index = -1); std::string LuaToString(const int index = -1); double LuaToNumber(const int index = -1); int LuaType(const int index = -1); int LuaGetField(const std::string& name, const int index = -1); int LuaGetTable(const std::string& name, const int index = -1); int LuaGetGlobal(const std::string& name); void LuaSetField(const std::string& name, const int index = -1); void LuaSetTable(const int index = -1); void LuaPop(const int levels = 1); void LuaRemove(const int index = -1); void LuaSetStackSize(const int sz); int LuaGetStackSize(); void LuaNewTable(); This makes our code simpler and more readable:
    #include "Turbo.h" using namespace Turbo; int main(int argc, const char *argv[]) { //Create a window auto window = CreateWindow("MyGame", 0, 0, 1280, 720); //Create a rendering context auto context = CreateContext(window); //Set some variables in the script environment LuaSetGlobal("mainwindow", window); LuaSetGlobal("maincontext", context); //Create the world auto world = CreateWorld(); //Load a scene auto scene = LoadScene(world, "Maps/start.map"); //Show off a PBR material auto sphere = CreateSphere(world); auto mtl = LoadMaterial("Materials/Rough-rockface1.json"); sphere->SetMaterial(mtl); sphere->Move(0, 1, 0); sphere->SetScale(2); while (window->KeyHit(KEY_ESCAPE) == false and window->Closed() == false) { world->Update(); world->Render(context); } return 0; } You can gain access to the beta and support development by subscribing for just $5.
  19. Josh
    An update for the beta of the new engine is now available with the following changes:
    GLTF loader is now working for most models. A large collection of GLTF files are available online for free from many sources, and they can be loaded right into the engine without any adjustment for materials or textures. Single-file GLB files also work. Added support for GLTF extension KHR_materials_pbrSpecularGlossiness. Disabled PNG loader gamma correction. world->SetSkybox(texture) can now be used to make PBR reflections appear. (The sky will not yet be visible though.) I'm going to try to use a voxel GI system for further reflections, and not use environment probes at all. Window::GetWidth(), Window::GetHeight(), Context::GetWidth(), and Context::GetHeight() are removed. Use GetSize() instead. It will return an iVec2 object with x and y components. JSON material files are changed slightly. in order to accommodate additional per-texture settings. None of these work yet, but you can see where it is going: "albedoMap": { "file": "./Rough-rockface1_Base_Color.jpg", "filter": "linear", "tilingU": "repeat", "tilingV": "repeat" }, So before if you had this:
    "albedoMap": "./Rough-rockface1_Base_Color.jpg" Just change it to this:
    "albedoMap": {"file": "./Rough-rockface1_Base_Color.jpg"} And then it will work.
    The screenshot below is a GLTF loaded and rendered with Vulkan. Note that this model uses baked lighting that is already included in the model. But the fact I can download these things and have them appear correctly with no adjustments is great.

    You can get access to the beta and private forum right now for just $5.
  20. Josh
    The beta of our new game engine has been updated with a new renderer built with the Vulkan graphics API, and all OpenGL code has been removed. Vulkan provides us with low-overhead rendering that delivers a massive increase in rendering performance. Early benchmarks indicate as much as a 10x improvement in speed over the Leadwerks 4 renderer.
    The new engine features an streamlined API with modern C++ features and an improved binding library for Lua. Here's a simple C++ program in Turbo:
    #include "Turbo.h" using namespace Turbo; int main(int argc, const char *argv[]) { //Create a window auto window = CreateWindow("MyGame", 0, 0, 1280, 720); //Create a rendering context auto context = CreateContext(window); //Set some Lua variables VirtualMachine::lua->set("mainwindow", window); VirtualMachine::lua->set("maincontext", context); //Create the world auto world = CreateWorld(); //Load a scene auto scene = LoadScene(world, "Maps/start.map"); while (window->KeyHit(KEY_ESCAPE) == false and window->Closed() == false) { world->Update(); world->Render(context); } return 0; } Early adopters can get access to beta builds with a subscription of just $4.99 a month, which can be canceled at any time. New updates will come more frequently now that the basic renderer is working.
  21. Josh
    A big update for the beta of the upcoming Turbo Game Engine is now available, adding support for VR and Lua script!
    VR Rendering
    Turbo Game Engine now supports VR rendering, with support for true single-pass stereoscopic rendering on Nvidia GPUs. Other hardware will use a double-rendering path that is still faster than Leadwerks. To turn VR on simply call EnableVR(). Controllers are not yet supported, just rendering.
    Lua Scripting
    Lua script is now supported in Turbo! The amount of classes and functions is limited, but the foundation for full Lua support is in. Here are some of the great features in the new system.
    No Script Object
    All scripts operate on the entity itself. Instead of this:
    function Script:Update() self.entity:Turn(1,0,0) end You type this:
    function Object:Update() self:Turn(1,0,0) end This is especially nice when it comes to functions that retrieve another entity since you don't have to type "entity.script" to get Lua values and functions:
    function Object:Collision(entity,position,normal,speed) entity:Kill() end Smart Pointers
    Lua garbage collection now works together with C++11 smart pointers. You will never have to deal with invalid pointers or object deletion again. There is no Release() anymore. Just set your variable to nil to delete an object:
    local box = CreateBox(world) box = nil If you want the object to be collected immediately, you can force a GC step like this:
    local box = CreateBox(world) box = nil collectgarbage() Best of all, because Lua runs on the game logic thread separate from the rendering thread, it's perfectly fine to use Lua high-performance applications, even in VR. A pause in the game execution for Lua garbage collection will not pause the rendering thread.
    Multiple Scripts
    You can add any number of scripts to an object with the AddScript command:
    entity->AddScript("Scripts/Object/test.lua") Scripts on Any Object (Experimental)
    Now all object types can have scripts, not just entities:
    material->AddScript("Scripts/Object/Appearance/Pulse.lua") Set and Get Script Values in C++
    You can easily set and get values on any object, whether or not it has had a script added to it:
    entity->SetValue("health",100); Print(entity->GetNumberValue("health")); Vector Swizzle
    Using getters and setters I was able to implement vector swizzles. If you write shaders with GLSL you will be familiar with this convenient  feature:
    local a = Vec3(1,2,3) local b = a.xz --equivalent to Vec2(a.x,a.z) In Lua you can now return any combination of vector elements, using the XYZW or RGBA names. The code below will swap the red and blue elements of a color:
    local color = Vec4(1,0,0.5,1) local color = color.bgra Not only can you retrieve a value, but you can assign values using the swizzle:
    local v = Vec3(1,2,3) v.zy = Vec2(1,2) Print(v) --prints 1,2,1 Note there are presently only two engine script hooks that get called, Start() and Update().
    Simpler Uber Shaders
    I decided to do away with the complicated #ifdef macros in the shaders and use if statements within a single shader:
    //Diffuse Texture if (texturebound[0]) { color *= texture(texture0,texcoords0); } This makes internal shader management MUCH simpler because I don't have to load 64 variations of each shader. I am not sure yet, but I suspect modern GPUs will handle the branching logic with no performance penalty. It also means you can do things like have a material with just a color and normal map, with no need for a diffuse map. The shader will just adjust to whatever textures are present.
    A C++ Turbo program now looks like this:
    #include "Turbo.h" using namespace Turbo; int main(int argc, const char *argv[]) { //Create a window auto window = CreateWindow("MyGame", 0, 0, 1280, 720); //Create a rendering context auto context = CreateContext(window); //Create the world auto world = CreateWorld(); //This only affects reflections at this time world->SetSkybox("Models/Damaged Helmet/papermill.tex"); shared_ptr<Camera> camera; auto scene = LoadScene(world, "Maps/start.map"); //Create a camera if one was not found if (camera == nullptr) { camera = CreateCamera(world); camera->Move(0, 1, -2); } //Set background color camera->SetClearColor(0.15); //Enable camera free look and hide mouse camera->SetFreeLookMode(true); window->HideMouse(); while (window->KeyHit(KEY_ESCAPE) == false and window->Closed() == false) { //Camera movement if (window->KeyDown(KEY_A)) camera->Move(-0.1, 0, 0); if (window->KeyDown(KEY_D)) camera->Move(0.1, 0, 0); if (window->KeyDown(KEY_W)) camera->Move(0, 0, 0.1); if (window->KeyDown(KEY_S)) camera->Move(0, 0, -0.1); //Update the world world->Update(); //Render the world world->Render(context); } return 0; } If you would like to try out the new engine and give feedback during development, you can get access now for just $5 a month.
    I am now going to turn my attention to Leadwerks 4.6 and getting that ready for the Christmas season.
    The next step in Turbo development will probably be physics, because once that is working we will have a usable game engine.
  22. Josh
    Leadwerks Game Engine 4.6 will feature a new peer-to-peer networking system that solves the NAT punch-through problem and provides an easy way to create a public list of game servers. Together with this and Leadwerks GUI which was released last year, we will soon have the tools to make a great deal of new types of games. Previously we have been focused on single-player games but the ability to create multiplayer games with fast reliable networking opens up a lot of new and fun possibilities.
    In many ways, multiplayer games are actually easier to make than single-player games. Most of your gameplay tends to arise through the interaction of the players, so making things fun centers around creating environmental challenges. Coding-wise, multiplayer games tend to use a small core program and don't need a lot of extensive per-object scripting.
    Since we have the tools to do it, there are two community projects I want to carry out this year. By "community project" I mean I am going to write the code, put it out there, and anyone who wants to join in is welcome.
    Gears Arena
    This is simply going to be a modern version of Quake 3 Arena, with the option to play in VR. It can serve as a basis for many different types of games, and a lot of fun can be had with level design alone. New game modes like CTF can be added, or new weapons. I fully intend to make a gun that shoots chickens that then attack your enemies, a well as a grenade launcher that shoots grenades that split into more grenades. It will be all the fun of modding without having to rip out a lot of pre-existing code from the base game.

    Gears Rally
    The code from the previous project can be easily reconfigured into a multiplayer racing game. Maybe we can even add weapons.

    Now that the base systems of networking and the GUI are nearly in place, both these projects will be achievable in a very small amount of code, and can serve as a basis of derivative games.
  23. Josh
    Here's something I've been thinking about. What do you think?
     
    Apple
    Locking down OSX.
    No optical drive. The Mac software shelf at Fry's is now obsolete.
    Mac App Store.
    Gatekeeper only allows "signed" applications, by default.
    [*]Miniaturization of computer hardware, at the cost of graphical performance.
    [*]Move to non-upgradable hardware (glued-in memory).
    [*]Moving away from file system access (iCloud).
    [*]Hardware is expensive, and will always be a luxury item.


     
    Windows
    The people who made Windows 2000 and XP have retired. Microsoft does not appear to possess the same talents it once had.
    Artificial upgrade requirements for DirectX are impeding development (tessellation works fine on Windows XP with OpenGL).
    Attempting to lock down Windows like iOS.
    Intel attempting to absorb entire PC (socketless CPUs).
    Moving away from file system access.
    MS failures tend to encourage them, so I expect the trend to continue:
    Office ribbon sucked, so they added it to everything.
    Zune interface sucked, so they used it for everything.



     
    Ubuntu
    Valve and THQ coming to Ubuntu.
    Less fragmented than Windows.
    One UI (GTK).
    vs. MFC, WPF, .NET, and Modern UI.
    [*]GUI applications can be developed with one language (C++) instead of C#/Objective-C.
    [*]One environment.

    vs. Legacy/Modern division.
    [*]One version (12.10).

    vs. XP, Vista, 7, 8, and Blue.


    [*]Competition between Linux distros.

    If Ubuntu really pisses developers off, they can easily switch to a competing one like Mint.
    Can never be "locked down".
    [*]Fastest performance.
    [*]Still sucks, but getting better while Windows and Mac get worse.


     
    Maybe in five years, computing will look like this:
    Office workers will use Windows.
    Gamers wil use Linux.
    The general population will use a cheap tablet for Email and web browsing.

     
    What do you think?
  24. Josh

    Articles
    Ultra App Kit 1.2 is now available on our site and on Steam. This is a bug fix update that resolves numerous small issues reported in the bug reports forum.
    To download the latest version, see My Purchases.
×
×
  • Create New...