Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[ANET] Send animation #302487
12/19/09 20:58
12/19/09 20:58
Joined: Aug 2008
Posts: 37
Hungary
K
Kronomanta Offline OP
Newbie
Kronomanta  Offline OP
Newbie
K

Joined: Aug 2008
Posts: 37
Hungary
Hi!

I try to send my animation to every clients. The animation works correctly on the own pc (host and/or client), but the others cannot see them.

I play the animation normal, then reverse:
Code:
if (key_ctrl > 0 && (my.skill42<1 || my.skill42>99))
			{
				if(my.skill44==-1){my.skill44=1;}
				else {my.skill44=-1;}
			}
			if (my.skill43==0)
			{
			
			if(my.skill44==-1 && my.skill42<100)
			{
					my.skill42+=10*time_step;
					ent_animate(my,"fly",my.skill42,null);
			}
			if(my.skill44==1 && my.skill42>0)
			{
					my.skill42-=10*time_step;
					ent_animate(my,"fly",my.skill42,null);
			}	
				enet_send_skills(enet_ent_globpointer(my),42,42,-1); //sends the new skill value
				my.skill43=1;
			}
			else
			{
				if(my.skill43 == 1) //only send the skill if the value has changed
				{
					my.skill43 = 0;
					enet_send_skills(enet_ent_globpointer(my),42,42,-1); //sends the new skill value
				}
			}




Where do I make the mistake?

Re: [ANET] Send animation [Re: Kronomanta] #302546
12/20/09 11:32
12/20/09 11:32
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Your mistake is the following:

my.skill[42] isn't the same as my.skill42, because my.skill42 is my.skill[43] in reality. This is because my.skill[] starts with 0 and my.skillx starts with 1.

my.skill[] is the new way to access skills (the way it should be done in Lite-C). my.skillx exists only to prefent users that have to convert their codes from C-Script to Lite-C from changing all skillx calls.

enet_send_skills() needs the skill number starting by 0.

=> if you want to send my.skill42 you have to use enet_send_skills(enet_ent_globpointer(my),41,41,-1);

But I would advise you to generally use the my.skill[] notation to prefent such problems.



By the way, if you want to produce less traffic you can do sending animations much easier. The point is, that it's not important that the animation is synchronized on all participants but it's only important that the same animation is played on all hosts.
=> you can use a skill and set it to 0 for the stand animation, 1 for the run animation, 2 for the swim animation,... Everytime the animtaion changes, you save the new value in the skill and send it to all hosts. After that, the other hosts check the current value of the skill and play the according animation.

This would produce MUCH less traffic!


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: [ANET] Send animation [Re: Dark_samurai] #302752
12/21/09 20:25
12/21/09 20:25
Joined: Aug 2008
Posts: 37
Hungary
K
Kronomanta Offline OP
Newbie
Kronomanta  Offline OP
Newbie
K

Joined: Aug 2008
Posts: 37
Hungary
Yepp, you're right wink
Sending just a number for the animation is much faster wink

Thank you for the idea wink


Moderated by  HeelX, Spirit 

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