Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 149
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: Req: Un-cache entity+sprites from memory via script?  (Read 758 times)

0 Members and 1 Guest are viewing this topic.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Req: Un-cache entity+sprites from memory via script?
« on: September 02, 2011, 12:21:40 pm »
I asked this ages ago and I'm not sure if it was resolved.

Is there a way to unload a entity via script or even something that would unload them at the end of a stage.
« Last Edit: November 19, 2011, 05:50:28 am by MatMan »

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Req! Un-cache entity from memory via script?
« Reply #1 on: September 02, 2011, 12:29:14 pm »
loadmodel(name, unload);


If you want to unload a model after the level, use loadmodel("yourmodelname", 1)

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Req! Un-cache entity from memory via script?
« Reply #2 on: September 02, 2011, 12:39:41 pm »
Quote
loadmodel(name, unload);
Thats freaking awesome.
Quote
If you want to unload a model after the level, use loadmodel("yourmodelname", 1)
Does this work even if you loaded the entity in a previous stage? (usefull to know but not important)

Offline Plombo

  • Hero Member
  • *****
  • Posts: 1724
  • Your source for useful modding tools!
Re: Req! Un-cache entity from memory via script?
« Reply #3 on: September 02, 2011, 12:54:14 pm »
Quote
loadmodel(name, unload);
Thats freaking awesome.
Quote
If you want to unload a model after the level, use loadmodel("yourmodelname", 1)
Does this work even if you loaded the entity in a previous stage? (usefull to know but not important)

It should.

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Solved: Un-cache entity from memory via script?
« Reply #4 on: September 02, 2011, 12:58:34 pm »
Yes, but that doesn't help much if you want to gain more memory since the sprites are not freed.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Req: Un-cache entity from memory via script?
« Reply #5 on: November 19, 2011, 06:00:44 am »
Quote
Yes, but that doesn't help much if you want to gain more memory since the sprites are not freed.
Just tried "loadmodel("yourmodelname", 1)" and as mentioned it doesn't free memory up.

Is there please a possibility of adding this feature as this would give me  a very usefull capability of adding a rather important and big feature to my game that would let me do so much more (including console support) with the game.

Freeing memory from sprites would let me add this feature in (which has been finished coded by me today but needs the free feature)....
Major change to the "Generator", Now you can set a limit to the Variaty of Enemies at a time.(This was made to be very easy because UTunnels made array variables possible. Big Thanx UT!!!!!!)
What this means is.......
..Can run MixMasters on lower memory systems. You set the limit to your liking :)
..Can have an unlimited amount of enemies, boss's in MixMasters. I've been waiting for this a long time ;)
..Future versions can have custom lists such as spawn "Capcom only Enemies", "Street Fighter only Enemies",  "Stage/Chapter Specific Enemies" or "Female only Enemies" etc.
..Now is capable of playing on console systems like psp (Doesn't work on them yet)
....Still needs work to lower memory some more.
....Anybody can do this easily with OpenBorStats (although I still need to organise my entity types better though).
....Things like background animations can have lower animations frame counts and especially Flash's and fireballs etc...
« Last Edit: November 19, 2011, 06:51:08 am by MatMan »

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Req: Un-cache entity+sprites from memory via script?
« Reply #6 on: November 19, 2011, 08:05:02 am »
I think you can store some animations in arrays using loadsprite and free them after you've done using them.
As for the models, it is still hard to do because of the sprites sometimes use references of each other (like you load a frame with different offset, and the sprite handle is shared among the two sprites). It is not impossible, but someone needs a fairly long time to code the feature and test it.

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Req: Un-cache entity+sprites from memory via script?
« Reply #7 on: November 19, 2011, 08:18:59 am »
This request is one of those that just isn't as simple as it sounds. SX and I have discussed it at length before.

The problem is how sprite indexing works. OpenBOR uses a dynamic sprite table, which is why it can have an unlimited number of sprites and also run as optimally as it does.

Remove an item from the table and you either a) have to leave a space in place to maintain indexing, meaning you don't get your memory back anyway, or b) every entry after the removed sprites is reassigned a new index - but everything calling back to said index is not. Obviously at that point the whole module falls apart. At best, every single animation whose resources were in a position after the deleted subjects would display the wrong sprites. More likely, the module would simply crash.

DC

*Edit*: Ninja'd by UT.
« Last Edit: November 19, 2011, 08:23:17 am by Damon Caskey »
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Req: Un-cache entity+sprites from memory via script?
« Reply #8 on: November 19, 2011, 08:34:12 am »
Oh, speaking the animations, I recall there's an spritea property coded by DC a while back that can be accessed via get/changeentityproperty, where you replace the sprite_map slot with a new sprite or free the old one.

So I think there can be trick to do that if you know what you are handling though it is not safe.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Req: Un-cache entity+sprites from memory via script?
« Reply #9 on: November 19, 2011, 09:39:38 am »
Quote
......after the removed sprites is reassigned a new index.....
Ooooooooooo. I can understand how much work that will be in the long run for a feature that most probably is unlikely to be used by most modders.

Anyhow, I won't be able to use the spawn limiter in the way i wanted to but there are a few other ideas on how I can compensate.

Thanx for the info guys.  :cheers!:

Offline Fightn Words

  • Hero Member
  • *****
  • Posts: 3264
  • Confectionary Country of the Nin-Nin
Re: Req: Un-cache entity+sprites from memory via script?
« Reply #10 on: November 19, 2011, 03:54:42 pm »
There's another way you can save memory yourself but it's involved. Shave off the excess unneeded background area around your entity's and make the level graphics tiles.

Offline BeasTie

  • Hero Member
  • *****
  • Posts: 760
Re: Req: Un-cache entity+sprites from memory via script?
« Reply #11 on: November 20, 2011, 07:04:57 am »
sometimes backgrounds can have a lot of unneeded shades in the palette, using photoshop or similar, convert the bg to RGB mode then back to indexed color mode, chose palette 'exact' and no forced options.  This will reduce the palette to just what's needed, I wouldnt of thought it would of made much diff on a PC but i noticed it ran smoother afterwards, of course you would have to be in 16-bit color mode or the backgrounds need the entire master palette.

 



 0%




mighty
SimplePortal 2.3.3 © 2008-2010, SimplePortal