* *
Welcome, Guest. Please login or register.
Did you miss your activation email?
February 18, 2018, 01:23:50 PM

Login with username, password and session length

[SOLVED] Better memory management

  • 4 Replies
  • 105 Views
*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 5295
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
[SOLVED] Better memory management
« on: February 12, 2018, 07:04:03 PM »
Hello guys, I need to hear from you all some ideas for a problem I will have in the future if I don't plan it ahead,

Right now, my game has 20 playable characters, and each one has at least one aditional model (weapon) and will have another. So we are talking about 60 models just for the playable characters.

With only 2 exceptions, all those alternate models will be used only in two specific stages (which set the wepaon in the level header) and them nowhere on the game. But since weapons are called using LOAD, all those models will be on the memory all the time, eating resources.

So, how you I could handle it better?

I have an idea, let's see if it's good:

- Call all those alternate models as KNOW, not LOAD
- Track the stage number/name storing it on a Global var
- In SELECT animation, check this Global Var and use a script to load the alternate model - loadmodel(name).
- After the stage end, unloads all the alternate models (probably, using endlevel.c). I know we have a function to "loadmodel", but do we have a function to "unloadmodel" by script?

Any other idea?
Thanks

EDIT: Oh wait, There is a configuration which could help me
Quote
weapon {name} {bi} Give this spawned enemy {name} as a weapon to start with. The enemy will wield this weapon and attack with it.

~If enemy is knocked down or dies, the weapon will be dropped.
~{bi} determines if model stays in memory or not after current level ends.
0 = Model stays in memory.
1 = Model is unloaded when current level ends.

~Make sure the weapon is available before setting this.
This would unload the weapon after the level ends, but I would still need to LOAD it right at the start, which impacts the game loading. I would like to bypass this.
[/s]

Nevermind, it doesn't works with setweap.
« Last Edit: February 13, 2018, 10:46:31 AM by O Ilusionista »

*

Offline msmalik681

  • Hero Member
  • *****
  • 956
Re: Better memory management
« Reply #1 on: February 12, 2018, 11:26:32 PM »
If this was a possibility then a 1 on 1 fighting game would not be a problem.

I thought of a work around for that 1 level you could spawn a npc and control it using keyscripts but that maybe a long way around the issue.

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 5295
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Better memory management
« Reply #2 on: February 13, 2018, 09:57:57 AM »
Hum, NPC could be an idea, but I think it would bring more harm than good.
But thanks anyway.

*

Offline Damon Caskey

  • Administrator
  • Hero Member
  • *****
  • 1857
    • DC Current
Re: Better memory management
« Reply #3 on: February 13, 2018, 10:38:34 AM »
Per my PM, this is a case where you'd lose more than gain. Those weapon models are likely ~4K at most. Just not worth trying to save - it won't make any performance difference.

In programming, we call that micro-optimization (which I am very often guilty of). Don't waste resources ever, and if there's a way to optimize for free take it. Just don't go out of the way chasing meaningless gains. Often times you might even decrease performance.

DC
« Last Edit: February 13, 2018, 10:41:05 AM by Damon Caskey »
Projects in progress are now available here: https://github.com/DCurrent

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 5295
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Better memory management
« Reply #4 on: February 13, 2018, 10:46:15 AM »
Thanks! Case closed.

 

Recent

Members
Stats
  • Total Posts: 48704
  • Total Topics: 3342
  • Online Today: 59
  • Online Ever: 316
  • (January 04, 2013, 09:43:02 AM)
Users Online
Users: 2
Guests: 38
Total: 40