🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DP:Creating two local players

Started by
3 comments, last by Edu Garcia 23 years, 10 months ago
Hi, In DirectPlay, is there a way of creating two (or more) local players in the same computer without creating two DirectPlay objects?
Eduardo García SacristánProgrammer. UbiSoft Spainegarcia@ubisoft.es
Advertisement
/*
.-Muy buenas, ya parecía yo un perro verde!

.-De dónde eres, yo soy de Majadahonda, Madrid...

.- Escríbeme a grugnorr@yahoo.com para intercambiar información, etc,etc...


SPANISH */

.-I don´t know anything about DPlay yet, but you can have two or more players in just one computer using different keys for each one. Create as many structs/classes where you save player´s info as players and program it to response to them...
This is very especific so I can´t go further, just an example:
In a Tetris game, with two players:

Each loop iteration, just do the play twice:
.-Check each player´s input...
.-Look for collision´s for each player´s piece...
.......
.- If line, move down the matrix.....
........

.-Just do the one player game twice....

.-Of course, this is a simple example where players cannot interact with themselves... In a more complicated one you have add some especifical code for multiplayer..

.-I wish you can learn DPlay as soon as possible, I´d liked to, so you could help me?

.-Are you reading some book about DPlay? I have(well, a friend of mine has) Inside DX?(DX a fondo) that has some DPlay chapters... I also have a big tutorial found somewhere, is it from here? Don´t know...

.-Hope to help...

.-Ya hablamos...

What the hells!
What the hells!
Well. The problem is not to manage the players, but to create a server player and a non server player from the same DP object.
I heard about this question in another developer forum and I thought that maybe here somebody would know the answer. Let''s say we want a Multiplayer game with a couple of players in the same computer (server + one or more client players). Direct Play returns a DPERR_ACCESSDENIED value, wich is not even one of the expected returning values for CreatelPlayer. If you create a second DP object, you can create there another player (and maybe a few of them), but the point is about having a server player and one or more non server players in THE SAME DP OBJECT.

For learning DP I have done through Inside DirectX and mostly with DirectX SDK Help.

Eduardo García SacristánProgrammer. UbiSoft Spainegarcia@ubisoft.es
Sorry dude.
There is no posible way to create more then one player per DP object.

What you can do if you want to manage more then one player is create an array of DP objects then check the upper bound of the array. As for C++ I don''t remember enough to help on that front. But I know that it works very well in VB. If C++ doesn''t have an find upper bound call (I think I does) then just your a counter.

Again. Me not knowing C very well anymore i"m not sure if you can dynamicly create more arrays. That could also be a problem. However you can allocate a say 20 DP objects with a null size and posible set the mem size larger just before you set that array segment to a DP object.

VB, I can help.. C++ I just plain old forget.

Have fun,
CoolAcid
quote: Original post by CoolAcid

Sorry dude.
There is no posible way to create more then one player per DP object.


I think you may be wrong there..

From the DirectPlay docs
"A single process can have multiple local players that communicate through a DirectPlay object with other players on the same computer or players on remote computers. "

But for a server and multiple locals, I''m not sure if there is a limitation there..

This topic is closed to new replies.

Advertisement