Does ANYONE know how...
Does anyone know how to retrieve wether or not someone is in a Group in DX8''s Direct play? I have the users PlayerID and the group ID but I have no clue how to get a true/false on wether the player is in the group or not....
-Wuzzbent
There is no built-in mechanism in DirectPlay 8 to determine whether or not player A is in Group B. However, there are a few ways around it.
Option A)
Modify your player context value to track a list of group id''s of which your player is a member. Then, when you receive a DPNMSG_ADD_PLAYER_TO_GROUP message, add the group id to this list of ids. Conversely, when you receive a DPNMSG_REMOVE_PLAYER_FROM_GROUP message, remove the group id from the list.
Option B) very similar to option A, except use the group context value to track the player id''s.
Of course, be sure to protect everthing with Critical Sections to avoid multithreading issues.
Hope that helps.
Jonathan Hildebrandt
Software Engineer
Microsoft DirectPlay / DirectPlay Voice
Option A)
Modify your player context value to track a list of group id''s of which your player is a member. Then, when you receive a DPNMSG_ADD_PLAYER_TO_GROUP message, add the group id to this list of ids. Conversely, when you receive a DPNMSG_REMOVE_PLAYER_FROM_GROUP message, remove the group id from the list.
Option B) very similar to option A, except use the group context value to track the player id''s.
Of course, be sure to protect everthing with Critical Sections to avoid multithreading issues.
Hope that helps.
Jonathan Hildebrandt
Software Engineer
Microsoft DirectPlay / DirectPlay Voice
Cricical section?
www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>
It''s so that one part of memory is not accessed at the same time by multiple threads, because inconsistency and errors could occur.
Example:
Thread #1 needs 100ms to write 1000 bytes of data to memory starting at address A000:B000h
Thread #2 needs 50ms to read 1000 bytes from the same memory address.
If a timeslice of less than 100ms is given to thread 1, then thread 2 will end up reading incorrect or incomplete data from the memory address. At that point, anything could happen.
Mutexes prevent this from happening... kind of like locking a DirectDraw surface and copying to/from it, then unlocking ... to prevent incorrect accesses.
MatrixCubed
http://MatrixCubed.org
Example:
Thread #1 needs 100ms to write 1000 bytes of data to memory starting at address A000:B000h
Thread #2 needs 50ms to read 1000 bytes from the same memory address.
If a timeslice of less than 100ms is given to thread 1, then thread 2 will end up reading incorrect or incomplete data from the memory address. At that point, anything could happen.
Mutexes prevent this from happening... kind of like locking a DirectDraw surface and copying to/from it, then unlocking ... to prevent incorrect accesses.
MatrixCubed
http://MatrixCubed.org
[ Odyssey Project ]
Ok, thanks. I''ve ran intor that problem before, I believe
www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement