Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 622 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
player creation #90506
09/17/06 17:14
09/17/06 17:14
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline 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] #90507
09/19/06 12:48
09/19/06 12:48
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
PLEEEASE!!!

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 Offline
Senior Expert
Michael_Schwarz  Offline
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: Michael_Schwarz] #90509
09/19/06 16:00
09/19/06 16:00
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
I want to create a player on each client, and it does not interfear with any other client. It's for my RTS, so I need in singleplayer, you to be the player but in multiplayer each client is a player.

BTW, by player I mean the "player" pointer.

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 Offline
Senior Expert
Michael_Schwarz  Offline
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: Michael_Schwarz] #90511
09/19/06 16:42
09/19/06 16:42
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Can I create all players and handle them to an global array? So I can use 'ptr_for_handle' to retreave their data? How can I make an array be the same on all clients and the server?

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 Offline
Senior Expert
Michael_Schwarz  Offline
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 Offline OP
User
sheefo  Offline 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 Offline
Senior Expert
Michael_Schwarz  Offline
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
Re: player creation [Re: Michael_Schwarz] #90515
09/20/06 10:53
09/20/06 10:53
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Thanks a lot, but how I can display the players points on a score board when a player presses TAB. It shall only display locally, like on Age of Empires when you click the button and all players scores are displayed in the corner.

Also, how can my units be formatted? After I initialize every skill do I have to send_skill it? These question are really, how and when do I use send_skill and send_var?

Page 1 of 2 1 2

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