Mirage Source
http://miragesource.net/forums/

MSCPP Beta 0.1
http://miragesource.net/forums/viewtopic.php?f=123&t=3985
Page 2 of 41

Author:  Dragoons Master [ Wed Aug 13, 2008 6:58 am ]
Post subject:  Re: MSCPP Beta 0.1

I think this is more like a good way for people who wants to learn C++, to learn it. If they know the code in VB6, they'll surely understand it in this conversion. The only "complicated" things here are the inheritances, but they just make the code cleaner simpler. I think you have to agree with me at this point xD

Author:  DarkX [ Tue Sep 02, 2008 3:37 pm ]
Post subject:  Re: MSCPP Beta 0.1

Hey Dragoon, when you get this more thoroughly working in full 2d I will send you my code, from a scraped engine I was writting in C++ I made 2 different versions, one with 2d characters on 3d backgrounds and the other one was like FF7 - 9 prerendered 2d backgrounds with 3d characters, but it is not MS based at all so there would be some major conversion needed.

Author:  rydinophor [ Sun Feb 01, 2009 10:08 pm ]
Post subject:  Re: MSCPP Beta 0.1

i tested it and i get an error on the player id after i login.

Author:  DarkC [ Mon Feb 09, 2009 3:12 am ]
Post subject:  Re: MSCPP Beta 0.1

Whenever I try logging in with my character I created, VB6 just gives me an error on the client. :shock: Anyone know why? I'd like to try to get the C++ version of this to work...

Author:  Dragoons Master [ Sun Feb 15, 2009 9:10 pm ]
Post subject:  Re: MSCPP Beta 0.1

Quote:
WARNING: This is NOT a release yet, it is just a preview, since I have the code and it compiles, but does NOT work yet.

¬¬
I said this is not a working version.
I will re-make the hole networking when I have the time.

Author:  Dragoons Master [ Fri Feb 27, 2009 8:21 pm ]
Post subject:  Re: MSCPP Beta 0.1

I'm re-developing the network :D
It's going great.
I'm on a little doubt about how I'll handle more than 64 connections xD but it's going great.
I think I'll have a releasable version soon ^^

Author:  Doomy [ Fri Feb 27, 2009 8:47 pm ]
Post subject:  Re: MSCPP Beta 0.1

awesome

Author:  Dragoons Master [ Mon Mar 02, 2009 1:07 pm ]
Post subject:  Re: MSCPP Beta 0.1

It's going great! I just need to make a better client side buffer to handle the almost 3kbs of the mapdata packet xD
Then I'll test a few things more and release beta 0.2, SEMI-WORKING version ^^

Author:  Pbcrazy [ Mon Mar 02, 2009 10:25 pm ]
Post subject:  Re: MSCPP Beta 0.1

sweet! im trying to learn C++ at the moment, i'm curious as to how this would work.

Author:  Dragoons Master [ Tue Mar 03, 2009 12:41 am ]
Post subject:  Re: MSCPP Beta 0.1

It is almost working. I can send/receive data, but not when the packets are too large. MapData is fucking things up xD But I'll fix it soon.

Author:  Tony [ Tue Mar 03, 2009 5:56 am ]
Post subject:  Re: MSCPP Beta 0.1

What are you using for network communication?

Author:  Lea [ Tue Mar 03, 2009 6:00 am ]
Post subject:  Re: MSCPP Beta 0.1

pull the maps over ftp/http

Author:  Dragoons Master [ Tue Mar 03, 2009 12:17 pm ]
Post subject:  Re: MSCPP Beta 0.1

Tony wrote:
What are you using for network communication?

WinSocket2.2, tcp
Lea wrote:
pull the maps over ftp/http
Not a bad idea, but I'm trying to make it simple. If you don't have a web site then I'll be totally screwed. MS is supposed to be simple(no offense). All it's needed it a better buffering system xD.

Author:  Dragoons Master [ Tue Mar 03, 2009 2:13 pm ]
Post subject:  Re: MSCPP Beta 0.1

FIXEEEEEED!!!!!!!
IT'S ALIVE!!!!!!!!!!!!!!!
DAMN YOU VERRIGAN xD
Pay attention when you code!!!(jk)
AddToBuffer function is the bitch!
It was:
Call CopyMemory(tBytes(aLen(Buffer)), Additional(0), aLen(Additional))
and should be:
Call CopyMemory(tBytes(aLen(Buffer)), Additional(0), ByteLen)

AAAAAAAAAAA, I'M YELLING OF HAPPINESS!
Image
Not a verry nice photo, but it passes the idea...

Author:  Robin [ Tue Mar 03, 2009 2:17 pm ]
Post subject:  Re: MSCPP Beta 0.1

Dragoons Master wrote:
FIXEEEEEED!!!!!!!
IT'S ALIVE!!!!!!!!!!!!!!!
DAMN YOU VERRIGAN xD
Pay attention when you code!!!(jk)
AddToBuffer function is the bitch!
It was:
Call CopyMemory(tBytes(aLen(Buffer)), Additional(0), aLen(Additional))
and should be:
Call CopyMemory(tBytes(aLen(Buffer)), Additional(0), ByteLen)

AAAAAAAAAAA, I'M YELLING OF HAPPINESS!
Image
Not a verry nice photo, but it passes the idea...


Fuuuuck. This explains why my code kept on fucking up at AddtoBuffer. Fuck. Ah, christ.

I'll just use Dugor's buffer class instead. Verrigan's system was far too confusing.

Glad you got it working though. I spent ages trying to found out why my aLen function kept erroring there.

Author:  Dragoons Master [ Tue Mar 03, 2009 2:32 pm ]
Post subject:  Re: MSCPP Beta 0.1

The real error is the CopyMemory. It tried to copy too much memory to tBytes, but tBytes is defined as tBytes(tLen - 1), so we don't have that much memory allocated, and then VB6 just bugs like hell.

Author:  Robin [ Tue Mar 03, 2009 2:46 pm ]
Post subject:  Re: MSCPP Beta 0.1

Dragoons Master wrote:
The real error is the CopyMemory. It tried to copy too much memory to tBytes, but tBytes is defined as tBytes(tLen - 1), so we don't have that much memory allocated, and then VB6 just bugs like hell.


xD

Ah well, Dugor's code is so much easier to understand.

Author:  Tony [ Tue Mar 03, 2009 10:26 pm ]
Post subject:  Re: MSCPP Beta 0.1

Doesn't Winsock handle one request at a time?

and UGH byte arrays.. looks so confusing.

Author:  Robin [ Tue Mar 03, 2009 10:31 pm ]
Post subject:  Re: MSCPP Beta 0.1

Tony wrote:
Doesn't Winsock handle one request at a time?

and UGH byte arrays.. looks so confusing.


It's really not.

You use the functions to add bytes, integers, strings etc. to the array, then peel them off in the opposite order in the server.

Easy shit.

Author:  Tony [ Tue Mar 03, 2009 10:44 pm ]
Post subject:  Re: MSCPP Beta 0.1

Robin wrote:
Tony wrote:
Doesn't Winsock handle one request at a time?

and UGH byte arrays.. looks so confusing.


It's really not.

You use the functions to add bytes, integers, strings etc. to the array, then peel them off in the opposite order in the server.

Easy shit.


Yeah I understood a bit of that part by reading up on Verrigan's tutorial but took a peek at his code and his functions
I did not understand one bit of it.

Okay his code here

Code:
nLen = GetIntegerFromBuffer(Buffer, True)
    nBytes = GetFromBuffer(Buffer, nLen, True)
    Sex = GetByteFromBuffer(Buffer, True)
    Class = GetByteFromBuffer(Buffer, True)
    CharNum = GetByteFromBuffer(Buffer, True)


If there types of bytes in order, and it took that byte from the order, how does it know what's what?

Author:  Robin [ Tue Mar 03, 2009 10:54 pm ]
Post subject:  Re: MSCPP Beta 0.1

Tony wrote:
Robin wrote:
Tony wrote:
Doesn't Winsock handle one request at a time?

and UGH byte arrays.. looks so confusing.


It's really not.

You use the functions to add bytes, integers, strings etc. to the array, then peel them off in the opposite order in the server.

Easy shit.


Yeah I understood a bit of that part by reading up on Verrigan's tutorial but took a peek at his code and his functions
I did not understand one bit of it.

Okay his code here

Code:
nLen = GetIntegerFromBuffer(Buffer, True)
    nBytes = GetFromBuffer(Buffer, nLen, True)
    Sex = GetByteFromBuffer(Buffer, True)
    Class = GetByteFromBuffer(Buffer, True)
    CharNum = GetByteFromBuffer(Buffer, True)


If there types of bytes in order, and it took that byte from the order, how does it know what's what?


The first line calculates the length of the buffer, then it gets the Sex by reading the first byte in the buffer, and removes it. Then, when it get's the class, it'll be the first byte in the buffer.

"It" doesn't know what's what, but the person who programs the packet knows what order the data is in.

Author:  Dragoons Master [ Tue Mar 03, 2009 11:16 pm ]
Post subject:  Re: MSCPP Beta 0.1

Robin wrote:
"It" doesn't know what's what, but the person who programs the packet knows what order the data is in.

Just like you where doing with Parse().

Author:  Tony [ Tue Mar 03, 2009 11:19 pm ]
Post subject:  Re: MSCPP Beta 0.1

Oh shit. For some reason I was thinking the packets would look all crambed together..

Then I remembered they look like 2 3 45 32 or something.

[edit] Wait now I'm confused.. so basically doing byte arrays, we receive all the data as bytes
then we change them accordingly when we receive them?

Author:  Robin [ Tue Mar 03, 2009 11:58 pm ]
Post subject:  Re: MSCPP Beta 0.1

Tony wrote:
Oh shit. For some reason I was thinking the packets would look all crambed together..

Then I remembered they look like 2 3 45 32 or something.

[edit] Wait now I'm confused.. so basically doing byte arrays, we receive all the data as bytes
then we change them accordingly when we receive them?


The data is stored in an array of bytes.

The packet sends the entire array. When the server recieves the array, it reads the start of the array to find out how long the packet is, then it takes the data you put into the array, out of the array, piece by piece. 'AddIntegerToBuffer' lets you place an 'Integer' variable into the byte array. 'GetIntegerFromBuffer' reads the integer you put in.

Author:  Dragoons Master [ Wed Mar 04, 2009 1:58 am ]
Post subject:  Re: MSCPP Beta 0.1

There are two headers I'm using. The packet length and the packet id(playerhp, attacknpc, etc(enum)). So a valid packet would be(IN DEC):
5 2 3 'h' 'i' '!'
That can be interpreted as a packet with 5 bytes, with the id = 2(can be a msg of anything) and a string with 3 bytes(" 3 'h' 'i' '!' " can indicate a string of 3 characters). The number 3 means that the next 3 bytes are the string I want to read. So strings have variable sizes. 2+lenght(string) bytes.

Page 2 of 41 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/