Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bones are fps eating packmans! #399340
04/14/12 12:11
04/14/12 12:11
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
here an example code of an entity looking at the player constantly.
Everything works fine and here. (a bit slow but ok):

Code:
action look_at_player()
{
	while(1)
	{
		VECTOR temp_vec; 
		ANGLE temp_angle;
		ANGLE head_angle;

		vec_set(temp_vec,player.x); 
		vec_sub(temp_vec,my.x); 
		vec_to_angle(temp_angle,temp_vec);
		vec_sub(temp_angle, my.pan);    
		//head
		head_angle.pan = temp_angle.pan;
		head_angle.tilt = temp_angle.tilt;
		head_angle.roll = 0;
		head_angle.tilt = clamp(head_angle.tilt, -80, 80);
		head_angle.pan = clamp(head_angle.pan, -90, 90);
		ent_bonereset(my,"Head");    
		ent_bonerotate(my,"Head",head_angle);

		wait(1);
	}
}



But now I don`t only need the head to rotate, but also the (lets say) right arm and left arm.
Then it would look like this;

Code:
action look_at_player()
{
	while(1)
	{
		VECTOR temp_vec; 
		ANGLE temp_angle;
		ANGLE head_angle;
		ANGLE right_arm_angle;
		ANGLE left_arm_angle;

		vec_set(temp_vec,player.x); 
		vec_sub(temp_vec,my.x); 
		vec_to_angle(temp_angle,temp_vec);
		vec_sub(temp_angle, my.pan);    
		
		//head
		head_angle.pan = temp_angle.pan;
		head_angle.tilt = temp_angle.tilt;
		head_angle.roll = 0;
		ent_bonereset(my,"Head");    
		ent_bonerotate(my,"Head",head_angle);

		//right arm
		right_arm_angle.pan = temp_angle.pan;
		right_arm_angle.tilt = temp_angle.tilt;
		right_arm_angle.roll = 0;
		ent_bonereset(my,"right_arm");    
		ent_bonerotate(my,"right_arm",right_arm_angle);

		//left arm
		left_arm_angle.pan = temp_angle.pan;
		left_arm_angle.tilt = temp_angle.tilt;
		left_arm_angle.roll = 0;
		ent_bonereset(my,"left_arm");    
		ent_bonerotate(my,"left_arm",left_arm_angle);

		wait(1);
	}
}



And that is a real fps killer.
Is there any way to save fps in that example?
I needs alot more ghosts to stop this fps packman!



Re: bones are fps eating packmans! [Re: Random] #399342
04/14/12 12:25
04/14/12 12:25
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try this and see if it makes a difference in FPS...
Code:
action look_at_player()
{
	ANGLE temp;
	while(1)
	{
		vec_sub(vec_set(temp, player.x), my.x);
		vec_to_angle(temp, temp);
		vec_sub(temp, my.pan);    
		
		//head
		ent_bonereset(my,"Head");    
		ent_bonerotate(my,"Head", vector(temp.pan, temp.tilt, 0));

		//right arm
		ent_bonereset(my,"right_arm");    
		ent_bonerotate(my,"right_arm", vector(temp.pan, temp.tilt, 0));

		//left arm
		ent_bonereset(my,"left_arm");    
		ent_bonerotate(my,"left_arm", vector(temp.pan, temp.tilt, 0));

		wait(1);
	}
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: bones are fps eating packmans! [Re: EvilSOB] #399405
04/14/12 23:18
04/14/12 23:18
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Every time you move a bone you're also updating every vertex attached to that bone (and any attached to children of that bone). By default GS does this on the CPU, but you can look at matBones to find a much faster alternative -- the vertices are only moved in the shader (GPU is much better suited to this kind of thing), but it means if you use vec_for_vertex or something similar you won't get the correct position.

I love matBones. It makes a huge difference to performance with bones-animation.


Formerly known as JulzMighty.
I made KarBOOM!
Re: bones are fps eating packmans! [Re: JibbSmart] #399419
04/15/12 07:46
04/15/12 07:46
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
hi JibbSmart,
is there any better example than crowd.c of this shader based bone animation? I'm planning to upgrade to commercial because I really need this feature to handle my crowd of similar characters. (and of course I badly need some other shaders...)


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: bones are fps eating packmans! [Re: sivan] #399420
04/15/12 08:07
04/15/12 08:07
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
matBones is "A8 P" - A8 Pro, not commercial smirk

Re: bones are fps eating packmans! [Re: Rei_Ayanami] #399422
04/15/12 09:25
04/15/12 09:25
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
arrrgghh, that costs too much. as I read somewhere it's in commercial...
but thanks laugh

okay finally found the matBones page in the manual, really Pro.

Last edited by sivan; 04/15/12 11:02. Reason: I found it

Free world editor for 3D Gamestudio: MapBuilder Editor
Re: bones are fps eating packmans! [Re: sivan] #399432
04/15/12 11:36
04/15/12 11:36
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Sorry. I forgot about version differences.


Formerly known as JulzMighty.
I made KarBOOM!
Re: bones are fps eating packmans! [Re: JibbSmart] #399436
04/15/12 12:38
04/15/12 12:38
Joined: May 2009
Posts: 5,365
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,365
Caucasus
Yeah, it's really easy to forget if you own pro version grin


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: bones are fps eating packmans! [Re: JibbSmart] #401176
05/14/12 22:02
05/14/12 22:02
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
JippSmart, could you show me how you would use "matBones" to solve this FPS problem?




Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1