❄️🎁⛄ The Winter Games Tournament is Live! 🎄🎅❄️
Jump to content

Recommended Posts

Posted

On most situations, I get a crash when loading a map. I first discovered this on a complex project and I thought it was me doing something stupid. Turns out, on a very basic project, the problem still happens.

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Leadwerks", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create a world
    auto world = CreateWorld();

    //Create a framebuffer
    auto framebuffer = CreateFramebuffer(window);

    auto scene = LoadScene(world, "Maps/Start.map");

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer);
    }

    return 0;
}

 

SceneCrash.7z

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Posted

This has something to do with the Lua binding code being too big for the stack. When I declare this before the call to LoadScene, the program works correctly:

GetLuaState();

Specifically, it's crashing in the Entity class binding code, which is probably the class with the most methods.

Let's build cool stuff and have fun. :)

Posted

Another option is to increase the stack reserve size in the project settings:

Properties->Configuration Properties->Linker->System->Stack Reserve Size

The default value is one MB. Set this value to 4194304 to change it to four MB.

image.thumb.png.faf5d316e02012602a4ebd4335d22281.png

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

×
×
  • Create New...