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
0 registered members (), 1,012 guests, and 8 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
[ANET] NPC Global Registered #321492
04/29/10 18:20
04/29/10 18:20
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
Hi there,

i´m thinking about how to create npcs in my multiplayer game?

If i enet_ent_create them and move them around the problem is that they dont do the same things on every client. I want to read out the health an mana and so on and every player should see the same. ALso see the entity on the same position.

But i cant send the pos from every npc. How shall i manage that?

Especially asking Dark_Samurai wink

Re: [ANET] NPC Global Registered [Re: Rasch] #321496
04/29/10 19:17
04/29/10 19:17
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
You will have to send and update the positions of the npc. The npc movement should be done on the server and the server should also send and update the positions of the npc to all clients. Theoretically it's not that important that npcs have always absolutely the same position on all clients, so you shouldn't update the positions to often and waste to much traffic for that.
For health etc. use skills (also controlled by the server). Then send the skills per enet_send_skills() to the clients (if the skills have changed).


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: [ANET] NPC Global Registered [Re: Dark_samurai] #321524
04/29/10 22:05
04/29/10 22:05
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
And when is the best moment to create the entitys on the server? THere´s a difference between Action on local machine and action on all others. I´m talking bout that.

if(enet_ent_creator(enet_ent_globpointer(my)) == enet_get_clientid()) //if this function runs on the client which created the entity
{
}
else //if the host didn't created the entity
{

Will people see the animation off the npc and all those questions.

Maybe you can write simple npc functions that works. THat would be really great laugh

Re: [ANET] NPC Global Registered [Re: Rasch] #321534
04/30/10 00:20
04/30/10 00:20
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
There is an open source code from Schokokeks available somewhere in the forum Resources. You can learn from that.

The server should only send the position and probably the state, animation and such can be generated on the client's pc.

Re: [ANET] NPC Global Registered [Re: Pappenheimer] #321552
04/30/10 08:16
04/30/10 08:16
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Nothing is done automatically here. enet_ent_create() only calls the normal ent_create() function on every connected host. It has nothing to do with animations or other stuff. If you want to start an animation, you could set a skill to 1 and send the new value. On the client you check if the skill is 1 and start the according animation.

If you haven't read the 3d chat tutorial yet, I would advice you to do so. I guess this will clear up some problems.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version

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