HideEntity with Animations is SLOW. Another way???

Blitz3D Forums/Blitz3D Programming/HideEntity with Animations is SLOW. Another way???

Damien Sturdy(Posted 2005) [#1]
Hey peeps.

Does anyone know of a way of showing/hiding an animated entity speedily? EntityAlpha is not a viable method here.... Texturing them with an alpha texture is also a fail..

Any ideas at all? I need to use tweening else what i'm trying to is limited to Delta Timing. And that makes it much less useful.

Here is what i need it to work for.

http://www.blitzbasic.com/Community/posts.php?topic=45269

Now i just hope another method is possible!!!!!!!


LAB[au](Posted 2005) [#2]
Moving it far away? Hide it with a plane? Scale it very small? Scale it bigger with backface culling so that you are inside and you don't see it :) ... I don't use tweening, so I suppose none of these works, since it will be tweened as well ... Perhaps flipping it? Or use mesh manipulation or is it tweened as well?

You could use multiple "spaces" in your world, then using multiple pass (renderworld) and recompose the image with buffer manipulation.


Damien Sturdy(Posted 2005) [#3]
Mesh manipulation, i dont think is tweened, but its slow anyway
Multiple spaces? Moving items from one area to the next will be tweened
pretty much everything, even repositioning a texture.... is tweened :(

Mark, ive run out of ideas. For the capabilities this enables, we could really do with a "disabletween" or "resettweenentity" or similar command on an entity so that it isnt tweened. DisableAlphaTween would be really useful for speedups when hiding animated entities.

:( Any more ideas? i can't see any more, ive tried everything....


John Pickford(Posted 2005) [#4]
Any idea why hide is slow? I'm using a lot of renderpasses myself.


Neochrome(Posted 2005) [#5]
to hide entity, use alpha,0 the renderer wont draw it

animations tho i dont know


Damien Sturdy(Posted 2005) [#6]
@John; I dont know why hide is slow, but it certainly kills framerate, even if i just have the (animated) dragons and a mesh and hide/show them.

@Neo...Dude, EntityAlpha gets tweened. Thats the whole thing....

I have it working, but i cant use twening as that will break it.....


LAB[au](Posted 2005) [#7]
It seems to me that hiding "non parented" entities is faster, even if you have to hide a lot of them... I use it a lot as well for my multiple renderpasses but I am satisified with a constant 25 fps ...

EDIT > Sorry I wasn't aware that you are using animated meshes (with child/parents...). So what about moving the mesh outside of your skybox and then putting it back to original position? Using Positionmesh mymesh,x,0,0 and Positionmesh mymesh,-x,0,0 ?


John Blackledge(Posted 2005) [#8]
Just make sure you do something like I do with my player/camera whenever you move an entity, otherwise you get what I think of as the 'dragging' effect, accentuated by tweening:

;Before moving:
Function GhostOn()
EntityType Player\piv,0
EntityType Camera\hent,0
End Function

;After moving:
Function GhostOff()
EntityType Player\piv,TYPE_PLAYER
EntityType Camera\hent,TYPE_PLAYER
End Function


Neochrome(Posted 2005) [#9]
i got around my tweening problem.. i was getting some jagged movement on the renderworld

i had the frameTick do this

frameTicks = (frameElapsed / framePeriod)
if frameTicks<1 then frameTicks=1

for some reason, the frames smoothed out

as LAB[au] would say, move the item OFF the map if you can


Damien Sturdy(Posted 2005) [#10]
fraid that wont sort my problem. its not frameticks that causes issues, its the value of tween... Cheers for the input though, I'm currently forcing tween=1 to sort it (obviously thats pointless...)

@John, What do those functions do eh? :D


Cheers..


Damien Sturdy(Posted 2005) [#11]
Okay, @John, that may come in handy with something else, but it doesnt help my issue here at all :( Cheers anyway.

Would anyone use a water reflection "system" here if it was incompatible with tweening? :(


John Blackledge(Posted 2005) [#12]
@Cygnus, do what you must.....

But I _always_ use commands like those when moving _any_ entity which has collisions set.

And not just cos it seemed like a good idea.


Jeremy Alessi(Posted 2005) [#13]
That's strange ... Hide/Show Entity is supposed to be instantaneous.


jfk EO-11110(Posted 2005) [#14]
I have never experienced any slowdown with HideEntity myself. Probably is thas something to do with the collision state of the entity (and it's children), because HideEntity will erase collision data of the entity. Did you try to ResetEntity before hinding it?

BTW I never use tweening. My game runs with a variable Sync rate (if possible the monitors physical rate) and all Motion and Animation is set to match with the framerate.

Renderworld() won't tween your Animation, but Updateworld() will. Note: Updateworld takes a paramter (that is optional, and if it's omitted, default value 1.0 is used, AFAIK). The Parameter of Updateworld defines, how fast the Animation will be played (as a multiplyer of the Animate Speed parameter). So if you use Updateworld(zero) for every additional Updateworld, there shouldn't be any tweening issues.


Damien Sturdy(Posted 2005) [#15]
@John, Indeed those commands are useful. I already clear collision data like that :0

Yes, hideentity is supposed to be instantaneous. I dont know why it makes the difference, but, im not using collisions with the characters and the ground, only bullet to player(doesnt happen often). Using Entityalpha n,0 works if i disable tweening.

Jfk, yeah i know, updateworld works with the animations,renderworld does just the rendering. Sorry for not being clear, im not having a problem with the animation, (but it does seem slow as in the computer gets bought to a crawl :P), only the fact that renderworld DOES tween the alpha states of each entity.

Ah well, Looks like i'll be using delta timing instead...


Cheers guys though!


wizzlefish(Posted 2005) [#16]
Can't you cancel the tween, hide it, and then resume the tween?


John Blackledge(Posted 2005) [#17]
The upshot is that if you move entities, then where _we_ thought they would be instantly moved, if you're using tweening this isn't the case, and the movement is spread across frames. (Mark? Can you fix that?)

Thus you must kill collisions for the duration of the movement or else your entity will collide with something, even if only the hill over there.

As far as I remember HideEntity is described in the manual as being instituting a 'collision-less' state, but in effect this is not true if you use tweening, until your entity eventually gets to the target point.

And, yes, this did give me days of hair-tearing until I realised that it wasn't my code that was at fault.

So:
EntityType ent,0
PositionEntity ent,x,y,z
EntityType ent,TYPE_HUMAN (or whatever)
- job done.

While we're on this, another thing I noticed recemtly is that if use:
PositionEntity ent,x,y,z (or Move or TranslateEntity)
newx = EntityX#(ent)
- you _don't_ get the correct position returned unless you put UpdateWorld() between PositionEntity ent,x,y,z and the EntityX() command. There's a logic in there, I guess.

That one only cost me half a day of searching through what I thought was bugged code to finally realise it.


Damien Sturdy(Posted 2005) [#18]
@John, Useful information, it took me a while to sort that lot out (my Quad2 project was my "learning" project and that had all sorts of problems, incorrect locations and such. It returns the location you positioned it at, but updateworld updates them should they need it due to collisions?)

I'm not asking for positionentity to have no tweening, (i use that and consider it a feature) but perhaps an optional flag to say "Realtime position, tweening disabled for this movement".. would be just dandy.


Can't you cancel the tween, hide it, and then resume the tween?


UMm, commands to do that would be excelent :P they dont exist, else this problem wouldnt....


John Blackledge(Posted 2005) [#19]
Yeah, Cygnus has hit it on the head.

We need "Realtime position, tweening disabled for this movement".
Or alternately a PositionEntity command that executes exactly as described, and not the 'sorry, I'm tweening at the moment, I'll do it bit by bit' effect.

Judging by the other comments above, I guess that anyone who doesn't use tweening has not noticed this effect, and is baffled by the thread.


John Blackledge(Posted 2005) [#20]
(Yeah I'm full of it tonight!)

Just in case anyone is wondering why we're so keen on tweening, it's just that when I started my engine I tried some alternatives but found the tweening method gave the smoothest, most predictable animation of walking people that I'd seen, especially on a slower machine that can easily drop below 30fps.
The frames might drop, but the character will still be where he should be in 2 secs time, and e.g. landing on his right foot as he should be.
And of course the same goes (even more crucially) for jaw movement/lipsync.


Damien Sturdy(Posted 2005) [#21]
True, tweening is excelent for that. My main use was always that i need it to run on low spec machines, With tweening i can update things every say, 100ms, (10fps?) and use tweening to get an actual framerate of whatever my card can handle... I do this with physics to get an impressive framerate.
If positionentity was always forced, twening wouldnt work with most physics engines out at the moment.

We should make a feature request, as this one *might* be simple, and opens up quite a few possibilities.....