Valhalla Legends Forums Archive | C/C++ Programming | Constructing a Descent Packetbuffer

AuthorMessageTime
TheNewOne
Ok first off ive just finished reading a few tutorials on win32 socket programming. And ive gotten my bot to just connect. Now im wanting to send packets ect.  Ive read up on send() and ect. but how would i go about sending just a single byte, an array of bytes, words and dwords. Thanks for any suggestions, help and refrences.
March 7, 2005, 2:45 AM
Kp
send() can send any of the types you describe.  I have to ask, what is your Descent bot going to do?  Deathmatch is probably easier than coop, but even that's going to need to do quite a lot of wall modeling I think.  Also, which Descent are you building for?
March 7, 2005, 5:08 AM
TheNewOne
Hmm ive tried using send() but since im posting this I obviously dont know how to use it for such things.
March 7, 2005, 3:18 PM
LordVader
DarkMinnions DynBuffer probably would give you some good idea's on how to model/create your own Packet buffer.

If you have specific questions about DynBuffer feel free to PM me.
March 7, 2005, 4:57 PM
Mephisto
[quote author=Kp link=topic=10842.msg102728#msg102728 date=1110172081]
send() can send any of the types you describe.  I have to ask, what is your Descent bot going to do?  Deathmatch is probably easier than coop, but even that's going to need to do quite a lot of wall modeling I think.  Also, which Descent are you building for?
[/quote]

You shouldn't mock clueless "newbies" like that, Kp.  :)

To whoever this is again: After you connect you're going to have to create a set of functions which can copy data (DWORDs, WORDs, QWORDs, BYTEs, CONST CHARs, etc.) into a persistant buffer (preferably through a class) and after copying the data into the buffer you then call send() to send that buffer (packet) on the connected associated socket.  Then you wait until the server sends back a reseponse which you catch with recv() (assuming you're using blocking sockets).  There are dozens of examples on the public WWW so go on Google or MSN and fill in a search and you're bound to find one.  On a side note though, it's highly recommended that you learn to write your own packet buffer as it's an essential thing to know in C++ as it helps you understand buffers and how to handle/manipulate them.  :)  Also, in addition to a packet buffer you may want to consider creating a packet reader so you don't have to manually read from a buffer, you can just call functions.  :)
March 8, 2005, 4:57 AM
Kp
[quote author=SoR-Mephisto link=topic=10842.msg102812#msg102812 date=1110257870][quote author=Kp link=topic=10842.msg102728#msg102728 date=1110172081]
send() can send any of the types you describe.  I have to ask, what is your Descent bot going to do?  Deathmatch is probably easier than coop, but even that's going to need to do quite a lot of wall modeling I think.  Also, which Descent are you building for?[/quote]You shouldn't mock clueless "newbies" like that, Kp.  :)[/quote]

He said it was a Descent packetbuffer!  The Descent series were good games, so I took an interest. :)
March 8, 2005, 3:27 PM
Soul Taker
Oh man, first I didn't even notice it said Descent and I thought it said decent.  I read Kp's response and got confused.  Then I re-read the subject and, after reading Kp's reply, thought he really did mean Descent.  I'm so confused!
March 10, 2005, 7:28 PM
Kp
[quote author=Soul Taker link=topic=10842.msg103211#msg103211 date=1110482922]Oh man, first I didn't even notice it said Descent and I thought it said decent.  I read Kp's response and got confused.  Then I re-read the subject and, after reading Kp's reply, thought he really did mean Descent.  I'm so confused![/quote]

I meant Descent.  I think the original poster may have meant "decent", but it's much more fun to answer what's asked, not what was probably intended.  It teaches them to ask better questions.
March 10, 2005, 11:49 PM
Adron
Besides, putting an interesting subject like that, and then asking a boring question is just like what spammers do...
March 11, 2005, 1:54 PM

Search