Archived

This topic is now archived and is closed to further replies.

Squalion

Destroying objects (shapes, textures etc)

Recommended Posts

Okay I''ve come to the ''battle mode'' stage of my RPG engine project, and basically I need it to do this; Unload and delete from memory the ''world'' textures and shapes that they''re bound to. Create new shapes for stat boxes, text etc. After the battle, delete these shapes and textures and re-load the world shapes and textures. Is this possible? Or would having 2 viewports or something be a better idea? There won''t be a great need to unload the world, but it''d make it nice and easy to have a blank screen to work with for each load..

Share this post


Link to post
Share on other sites
This is definetly possible I really don''t know why you want to do this however.

For home-brew projects, development time is crucial. This feature is really not necessary: it''s going to add something most users simply won''t need (you could just load everything at startup, there''s lot of RAM nowadays).

Another point of view is from contents and artists point of view.
1- Scenario 1: You actually have very poor content. This would mean loding would be "quite fast" however, this feature would not add any added performance - everything will just fit in memory anyway.
2- Scenario 2: You have very good content. This would be a real problem since loading it may take way too much. If you are in this case, take a look at your technologies and do estimations. Also consider that artists may want to create a level in which fights will happen very often so every minimum load will stress the player. You''ll have to find a trade off here.

Personally, I would simply load everything at startup and go fine with it. If I would be pressed to implement some sort of "dynamic loading" I would play with multiple threads.

The world textures are likely to be shared with the "combat" textures so I really don''t understand why you may want to delete them. For the geometry, this has some sense (little point to me) but there may be some cases in which this pays, it depends from your technology. I could not do it in my engine since extracting the geometry takes A LOT of time and memory. If you have a polygon soup ready to go then maybe you could do it...

Another point is what should be optimized and what not. Optimizing the "stat boxes" is not going to pay off unless you can automate everything. This is going to spare some hundred bytes at best and this speaks for itself.

Having two viewports is simply something I cannot understand.

Share this post


Link to post
Share on other sites
This may help.

The original memory you load your textures into from file (be they .bmp or .tga) becomes superfluous after you have defined the textures. That can go immediately after you''ve done the glTexImage2D, glTexParameteri and glBuild2DMipMaps.

To get rid of the texture after yu''ve finished with it...

glDeleteTextures(1, TextureId) usually does the trick.


Falkus99

Share this post


Link to post
Share on other sites