When I create an entity (a sprite using ent_create), there is a slight glitch. I know this can be solved by using ent_preload, but I am not sure how to use it?
you = Ent_Create("pic.tga", vector(0,0,0), null); Ent_preload(you) ??
Video memory is automatically preallocated for entities placed in the current level, but not for entities that are created during gameplay through ent_create...
As far i can understand you cant use it with ent_create.
Probably, you can attach an action to each entity placed in the level assigning a pointer to it. Then in main function and before level load you may use ent_preload to preallocatte video memory...
well, but seriously, for whatelse than entities generated via ent_create one would need ent_preload ? it is those runtime generated entities that cause problems to the performance
dejavu ... almost ... the engine cannot know which entities need to be preloaded until you create them. maybe the solution is like the one discussed in this thread from last week:
Well, basically I am trying to create a certain level of custom LoD of a sprite. I just get a glitch when the sprites are created - its meant to be a smooth transition.
That's interesting, I thought that the whole LoD series of a used sprite entity was loaded into the video memory when first using the entity. This does not seem to be the case then. Or if you mean by custom LoD that you have to morph from low to high res entity entirely, then I think you would have to find a way to preload the higher res ent into video memory. The engine could not do that unless told exactly which ents (sprites in this case) to preload. So, you would have to script that part in which your sprites-to-be-used are preloaded and the removed from the level. The entities are thereby initialized and preloaded into the video memory and there should not be any time delay when you eventually create and use your entity in the level.
I know, this seems cumbersome, but it seems to be the only way IMO to avoid the time delay when morphing or creating ebtities that were not in the level to begin with.