|
|
player creation
#90506
09/17/06 17:14
09/17/06 17:14
|
Joined: Jul 2006
Posts: 783 London, UK
sheefo
OP
User
|
OP
User
Joined: Jul 2006
Posts: 783
London, UK
|
I am getting fed up with myself for asking so many questions. I need some help with making my RTS game support multiple players. I need some advice on how to create in singleplayer, you as the "player" pointer and in multiplayer, every client has its own player and when the "player" pointer is used it only means that client. Basically, one client is not aware of another clients "player" existance. The player is an invisible entity (used as the centre of orbit for the camera) and it has skills to hold attributes. Like "player.money" and so on. Thanks for your time reading, but any idea? 
|
|
|
Re: player creation
[Re: sheefo]
#90508
09/19/06 14:14
09/19/06 14:14
|
Joined: Aug 2003
Posts: 7,439 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,439
Red Dwarf
|
i dont understand your request, could you say it a bit clearer so i can help you on this?
"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
|
|
|
Re: player creation
[Re: sheefo]
#90510
09/19/06 16:37
09/19/06 16:37
|
Joined: Aug 2003
Posts: 7,439 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,439
Red Dwarf
|
you would have to ent_create a "shell" for your player, by ent_create the entity is created on all clients. then you can set a pointer to it, like player2. On client side, you do ent_createlocal and update the position of your local cretaed player to the server wide created player->
vec_set(player2.x,player.x); send_skill(player2.x,send_vec);
"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
|
|
|
Re: player creation
[Re: sheefo]
#90512
09/19/06 21:26
09/19/06 21:26
|
Joined: Aug 2003
Posts: 7,439 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,439
Red Dwarf
|
you could, yes. The problem is that handles or pointers are (afaik) different on each PC, depending of the order an entity was created during the level loading and the action got assigned.
You can give each entity an ID in a skill, for example skill100, just make sure the skill100 is updated to the server when you create your entity
send_skill(my.skill100,null);
then you can cycle trhough all entities via ent_next(which is really fast) and set the you pointer, then you can retrieve all data you want, or even in the same instance
if(your.id==2) { target_hp=your.hp; target_shield=your.shield; } etc...
"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
|
|
|
Re: player creation
[Re: Michael_Schwarz]
#90513
09/19/06 21:35
09/19/06 21:35
|
Joined: Jul 2006
Posts: 783 London, UK
sheefo
OP
User
|
OP
User
Joined: Jul 2006
Posts: 783
London, UK
|
So I store the ID of the player in a skill and in the 'ent_next' loop I check each one for that ID then break the loop? No handles what so ever? Do I have to put "send_skill(my.skill100, null)" in a loop? Or shall I send it when I create the new player? EDIT: BTW, Thanks for having patients with me, and helping me 
|
|
|
Re: player creation
[Re: sheefo]
#90514
09/19/06 21:42
09/19/06 21:42
|
Joined: Aug 2003
Posts: 7,439 Red Dwarf
Michael_Schwarz
Senior Expert
|
Senior Expert
Joined: Aug 2003
Posts: 7,439
Red Dwarf
|
you have to do the send_skill only when you create your player and/or change his ID, keep in mind, you have to send that as the player who controls the character and not as the one who searches.
"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
|
|
|
|