Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Whelzorn

RPGQuest help (lost logic's book example)

This topic is 5319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey, I know lostlogic''s book is a little old to be worrying about, but i''m new to this. anyway, the book was awesome. No problems, save this one: the RPGQuest (both client and server) compile fine, (except the client leaves me a warning [LINK : warning LNK4089: all references to "ADVAPI32.dll" discarded by /OPT:REF] whick shouldnt bee much to worry about). Heres the real problem. When i run the client, it connects to the server, updates time of day, everything works great. But when i connect a second client, the first one is invisible to the second one to move around. it also scrolls thousands of "arrogant god enters zone" messages at the bottom left corner. I was hoping to build off this example, but it is unuseable like this. thanks for reading, hope someone can help.

Share this post


Link to post
Share on other sites
Advertisement
ok, I''ve run into the same problem. It seems like a huge error to me. It took me hours of hunting through code, and I eventually fixed it, but I can''t believe an error like this could get through. I''ve been to the forums at lostlogic.com, and i''ve seen no mention of this error. So I don''t know what the deal is, but here is how I got it to work. In the vSendPlayerInformation() function on the server, the variables are mixed up. It should read,

void vSendPlayerInformation(int ireceive, int iplayer)

instead of the other way around.

I hope this works for you.

Share this post


Link to post
Share on other sites
Here''s the lesson you can learn from this:

ALWAYS use a specific typedef for each identifier.

In your public header, put something like this:


typedef struct _player_t * player_t;
typedef struct _receive_t * receive_t;

player_t new_player( char const * name ); // or whatever
void function( player_t player, receive_t receive );


Then, when you actually create a player, you don''t necessarily need to use something called _player_t; you can use a void*, or a CComPtr, or an int internally; at the beginning of each function you cast from player_t to your real type, and when returning players to the user, cast back to player_t. This doesn''t actually generate any extra instructions in machine code, but it provides TYPE SAFETY.


struct PlayerStruct {
std::string name;
int generation;
};
player_t new_player( char const * name ) {
PlayerStruct * ps = new PlayerStruct;
ps->name = std::string( name );
ps->generation = 0;
return (player_t)ps;
}

void function( player_t player, receive_t receive ) {
PlayerStruct * pl = (PlayerStruct *)player;
ReceiveStruct * rc = (ReceiveStruct *)receive;
...
}


Share this post


Link to post
Share on other sites
yeah, that definitely would have solved this problem. My big error was assuming the code in the book was accurate, I suppose.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!