Unload Bug

msmalik681

OpenBOR Developer
Staff member
Damon Caskey I know you like to keep the github issues clean so I have added this to the forum instead. I noticed a entity loaded for a level is not unloaded at the end of level I also made a short video showing the issue in action. Tested on build 6391.

 
msmalik681,

I appreciate the time you took to make the report and explain it in video - but that is intentional and documented behavior. By default once a model is loaded for any reason, it stays loaded until you shut the engine down.

The reason is that almost all beat-em' ups (including the original BOR) reuse enemies in subsequent levels once they first appear. It makes logical sense to save loading time between levels by keeping them in memory. You can modify this behavior with a flag on "load" command. 

DC
 
Thanks for clearing that up when I was looking over the source code some comments seemed to indicate the models were unloaded between stages.
 
msmalik681 said:
Thanks for clearing that up when I was looking over the source code some comments seemed to indicate the models were unloaded between stages.

Where did you see that? I might need to go and rework some of the code commenting.

DC
 
msmalik681 said:
Thanks for clearing that up when I was looking over the source code some comments seemed to indicate the models were unloaded between stages.
No, models aren't unloaded between the stages - unless you tell the to do so, by either using "spawn NAME 1" or load NAME 3
What is unloaded between stages are the stage assets.
 
Thaks O Ilusionista I did not know there were any parameters after "spawn model" I will look into that thanks. Edit: It did not work the model stays in memory  :(

Damon Caskey

openbor.c
Code:
    // Model already loaded but we might want to unload after level is completed.
    if((tempmodel = findmodel(name)) != NULL)
    {
        update_model_loadflag(tempmodel, unload);
        cache_model_sprites(tempmodel, 1);
        return tempmodel;
    }
 
Got this working now I made a level script and used "loadmodel model_name 3" this will unload the model when you move stage and it will load the model again when you enter the stage this is the important part because if you use "load model_name 3" in a entity header that entity will not be loaded again as it will stay in memory if you restart the game without exiting the engine.
 
But "load model_name 3" is not meant to be used on the entity header, but on the level header. Maybe this is why it wasn't working.
 
Back
Top Bottom