Jump to content

Turbo Game Engine Beta Update



The Turbo Game Engine beta is updated! This will allow you to load your own maps in the new engine and see the speed difference the new renderer makes.


  • LoadScene() has replaced the LoadMap() function, but it still loads your existing map files.
  • To create a PBR material, insert a line into the material file that says "lightingmodel=1". Blinn-Phong is the default lighting model.
  • The red and green channels on texture unit 2 represent metalness and roughness.
  • You generally don't need to assign shaders to your materials. The engine will automatically select one based on what textures you have.
  • Point and spot lights work. Directional lights do not.
  • Setting the world skybox only affects PBR reflections and Blinn-Phong ambient lighting. No sky will be visible.
  • Physics, scripting, particles, and terrain do not work.
  • Variance shadow maps are in use. There are currently some problems with lines appearing at cubemap seams and some flickering pixels. Objects should always cast a shadow or they won't appear correctly with VSMs.
  • I had to include glew.c in the project because the functions weren't being detected from the static lib. I'm not sure why.
  • The static libraries are huge. The release build is nearly one gigabyte. But when compiled, your executable is small.
#include "Leadwerks.h"

using namespace Leadwerks;

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/turbotest.map");
	for (auto entity : scene->entities)
		if (dynamic_pointer_cast<Camera>(entity))
			camera = dynamic_pointer_cast<Camera>(entity);

	auto model = LoadModel(world, "Models/Damaged Helmet/DamagedHelmet.mdl");
	model->Move(0, 1, 0);
	model->SetShadowMode(LIGHT_DYNAMIC, true);

	//Create a camera if one was not found
	if (camera == nullptr)
		camera = CreateCamera(world);
		camera->Move(0, 1, -3);

	//Set background color

	//Enable camera free look and hide mouse

	//Create a light
	auto light = CreateLight(world, LIGHT_POINT);
	light->SetPosition(0, 4, -4);

	while (window->KeyHit(KEY_ESCAPE) == false and window->Closed() == false)
		//Rotate model
		model->Turn(0, 0.5, 0);

		//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

		//Render the world

	return 0;
  • Like 5


Recommended Comments

Hi! Sorry for question, but can anyone explain me, what exactly Turbo Game Engine is? Is it LE 5.0 but rebranded, or that's the another engine fork?

Share this comment

Link to comment
6 hours ago, adams-antology said:

Hi! Sorry for question, but can anyone explain me, what exactly Turbo Game Engine is? Is it LE 5.0 but rebranded, or that's the another engine fork?

It will be the next version of Leadwerks, with new name.

  • Like 1

Share this comment

Link to comment

Have you ever considered switching to a text map format on a flexible format like Json that allows for expansion, addition of fields, without breaking the loading of the map itself? The idea being we can add fields to entities and if said entity has a script those fields get added to the script? It could aid in external tooling. Just a thought.

  • Like 1

Share this comment

Link to comment
On 8/24/2018 at 1:48 PM, Rick said:

Have you ever considered switching to a text map format on a flexible format like Json that allows for expansion, addition of fields, without breaking the loading of the map itself? The idea being we can add fields to entities and if said entity has a script those fields get added to the script? It could aid in external tooling. Just a thought.

Also it is good for version control. Even better it allows people to develop tools that will allow for simultaneous  multi-user editing.

Share this comment

Link to comment
4 minutes ago, gellert234 said:

Only need to buy the full version once?

I plan on paid updates every 12-18 months, but you can buy one version once and use forever.

  • Thanks 1

Share this comment

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Blog Entries

    • By Josh in Josh's Dev Blog 0
      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 when they are emitted or as they are updated. This allows for unlimited features to be added to the particle system, because anything you want can be added with a plugin. A system for sending settings to the plugin will be implemented in the future so you can adjust the plugin settings and see the results. The default particle settings and features will probably stay pretty barebones and I will just use the plugin system to add any advanced functionality since it is so flexible.
      void EmitParticle(ParticleModifier* mod, ParticleSystem* particlesystem, Particle* particle) { if (mod->emissionshape == EMISSION_SHAPE_BOX) { particle->position[0] = Random(-mod->area[0], mod->area[0]); particle->position[1] = Random(-mod->area[1], mod->area[1]); particle->position[2] = Random(-mod->area[2], mod->area[2]); } else if (mod->emissionshape == EMISSION_SHAPE_CYLINDER) { particle->position[0] = Random(-mod->area[0], mod->area[0]); particle->position[1] = Random(-mod->area[1], mod->area[1]); particle->position[2] = Random(-mod->area[2], mod->area[2]); auto l = sqrt(particle->position[0] * particle->position[0] + particle->position[1] * particle->position[1] + particle->position[2] * particle->position[2]); if (l > 0.0f) { particle->position[0] /= l; particle->position[1] /= l; particle->position[2] /= l; } } particle->position[0] += particlesystem->matrix[12]; particle->position[1] += particlesystem->matrix[13]; particle->position[2] += particlesystem->matrix[14]; } There are three other new Lua examples included. Coroutines.lua shows how a sequence of actions can be added to an entity before the game starts, and the actions will be executed in order:
      --Create model local model = CreateBox(world) --Add some behaviors to be executed in order model:AddCoroutine(MoveToPoint, Vec3(3,0,0), 2) model:AddCoroutine(MoveToPoint, Vec3(-3,0,0), 2) model:AddCoroutine(MoveToPoint, Vec3(0,0,0), 2) --Main loop while window:Closed() == false do world:Update() world:Render(framebuffer) end This is great for setting up cut scenes or other sequences of events.
      An example showing how to enable tessellation is also included. Tessellation is now a per-camera setting.
      camera:SetTessellation(10) The number you input is the size in pixels of the tessellated primitives. Use zero to disable tessellation. Tessellation is disabled by default on all cameras.
      Finally, an example showing how to use a texture loader plugin is included. All you have to do is load the plugin and after that textures can be loaded in VTF format:
      local vtfloader = LoadPlugin("Plugins/VTF.dll") local tex = LoadTexture("Materials/wall01.vtf")  
    • By Josh in Josh's Dev Blog 4
      I made some changes to the design of the particle system. I am less concerned with the exact behavior of particles as they move around and move interested right now in building a system with good performance and deep physics interactions. Although I want particle behavior to be customizable, I don't think scripts are the right tool for the job. C++ plugins are better suited for this for two reasons.
      C++ is much faster, and particles are a system that will make heavy use of that. Lua scripts can't be run on separate threads. In Leadwerks Engine 4 we have basic particle collisions, but I wanted something more interactive in the new system. I move the particle update code into the physics thread. I implemented collision as well as the ability for particles to exert forces on other objects. Here's what happens when some slow-moving smoke particles interact with a scene: The lower platform rotates freely while the upper platform is motorized.
      When the particle velocity is increase they start to behave like a stream of water:
      Best of all, the speed is surprisingly fast. 4000 particles with collision update in just 2 milliseconds. The code scales well across cores so if you have a lot of CPU cores simulations with 100,000 particles are possible.
      Right now particles are processed in the physics thread, and get sent to the rendering thread for display, but right now the main thread actually never sees the individual particles.
      This is fast enough I think particles will default to full physics. Instead of just being a dumb visual effect we are going to have fully interactive fluids and gases. Flamethrowers can fill a room with fire and it will creep around corners to fill a space.
    • By Josh in Josh's Dev Blog 7
      For finer control over what 2D elements appear on what camera, I have implemented a system of "Sprite Layers". Here's how it works:
      A sprite layer is created in a world. Sprites are created in a layer. Layers are attached to a camera (in the same world). The reason the sprite layer is linked to the world is because the render tweening operates on a per-world basis, and it works with the sprite system just like the entity system. In fact, the rendering thread uses the same RenderNode class for both.
      I have basic GUI functionality working now. A GUI can be created directly on a window and use the OS drawing commands, or it can be created on a sprite layer and rendered with 3D graphics. The first method is how I plan to make the new editor user interface, while the second is quite flexible. The most common usage will be to create a sprite layer, attach it to the main camera, and add a GUI to appear in-game. However, you can just as easily attach a sprite layer to a camera that has a texture render target, and make the GUI appear in-game on a panel in 3D. Because of these different usages, you must manually insert events like mouse movements into the GUI in order for it to process them:
      while true do local event = GetEvent() if event.id == EVENT_NONE then break end if event.id == EVENT_MOUSE_DOWN or event.id == EVENT_MOUSE_MOVE or event.id == EVENT_MOUSE_UP or event.id == EVENT_KEY_DOWN or event.id == EVENT_KEY_UP then gui:ProcessEvent(event) end end You could also input your own events from the mouse position to create interactive surfaces, like in games like DOOM and Soma. Or you can render the GUI to a texture and interact with it by feeding in input from VR controllers.

      Because the new 2D drawing system uses persistent objects instead of drawing commands the code to display elements has changed quite a lot. Here is my current button script. I implemented a system of abstract GUI "rectangles" the script can create and modify. If the GUI is attached to a sprite layer these get translated into sprites, and if it is attached directly to a window they get translated into system drawing commands. Note that the AddTextRect doesn't even allow you to access the widget text directly because the widget text is stored in a wstring, which supports Unicode characters but is not supported by Lua.
      --Default values widget.pushed=false widget.hovered=false widget.textindent=4 widget.checkboxsize=14 widget.checkboxindent=5 widget.radius=3 widget.textcolor = Vec4(1,1,1,1) widget.bordercolor = Vec4(0,0,0,0) widget.hoverbordercolor = Vec4(51/255,151/255,1) widget.backgroundcolor = Vec4(0.2,0.2,0.2,1) function widget:MouseEnter(x,y) self.hovered = true self:Redraw() end function widget:MouseLeave(x,y) self.hovered = false self:Redraw() end function widget:MouseDown(button,x,y) if button == MOUSE_LEFT then self.pushed=true self:Redraw() end end function widget:MouseUp(button,x,y) if button == MOUSE_LEFT then self.pushed = false if self.hovered then EmitEvent(EVENT_WIDGET_ACTION,self) end self:Redraw() end end function widget:OK() EmitEvent(EVENT_WIDGET_ACTION,self) end function widget:KeyDown(keycode) if keycode == KEY_ENTER then EmitEvent(EVENT_WIDGET_ACTION,self) self:Redraw() end end function widget:Start() --Background self:AddRect(self.position, self.size, self.backgroundcolor, false, self.radius) --Border if self.hovered == true then self:AddRect(self.position, self.size, self.hoverbordercolor, true, self.radius) else self:AddRect(self.position, self.size, self.bordercolor, true, self.radius) end --Text if self.pushed == true then self:AddTextRect(self.position + iVec2(1,1), self.size, self.textcolor, TEXT_CENTER + TEXT_MIDDLE) else self:AddTextRect(self.position, self.size, self.textcolor, TEXT_CENTER + TEXT_MIDDLE) end end function widget:Draw() --Update position and size self.primitives[1].position = self.position self.primitives[1].size = self.size self.primitives[2].position = self.position self.primitives[2].size = self.size self.primitives[3].size = self.size --Update the border color based on the current hover state if self.hovered == true then self.primitives[2].color = self.hoverbordercolor else self.primitives[2].color = self.bordercolor end --Offset the text when button is pressed if self.pushed == true then self.primitives[3].position = self.position + iVec2(1,1) else self.primitives[3].position = self.position end end This is arguably harder to use than the Leadwerks 4 system, but it gives you advanced capabilities and better performance that the previous design did not allow.
  • Create New...