Jump to content


Photo
* * * * * 2 votes

Last Stop For Multiplayer Learning


  • Please log in to reply
151 replies to this topic

#21 mastersem

mastersem

    GMC Member

  • New Member
  • 236 posts

Posted 02 September 2009 - 07:55 PM

Really a good tutorial, it goes deep into how a package works, what a connection is etc.

Also, gotta say it, love your programming style. Alot of people tend to abuse the game maker fix thingy, where you don't have to use brackets and double = etc.

Hope to see anything more from this tutorial :3. I give it a 10/10

P.S.: Please people, this is so you can learn how to create online games, Don't ask for a whole engine, with this you can easily see how to create like a bullet shooting engine. (just send the x and y of the bullet, then send it to everyone, and let them create a bullet -.-).
  • 0

#22 commander of games

commander of games

    Kaos Kreator

  • GMC Member
  • 2841 posts
  • Version:GM:Studio

Posted 02 September 2009 - 08:13 PM

None is asking for a whole engine, it would just be nice to have a tutorial for a 39dll shooter game.
  • 0

#23 walkingbush

walkingbush

    GMC Member

  • New Member
  • 447 posts

Posted 03 September 2009 - 04:59 AM

Hey, not sure if this is a dumb question or not, but I got an error, something about
FATAL ERROR in
action number 1
of Begin Step Event
for object obj_dll:

COMPILATION ERROR in code action
Error in code at line 14:
iod = scr_translate_client(readint());

at position 28: Unknown function or script: scr_translate_client
  • 0

#24 sabriath

sabriath

    12013

  • GMC Member
  • 3147 posts

Posted 03 September 2009 - 05:22 AM

Ok, before I finish this tutorial, I read some of your comments, time for me to recap:

Then perhaps you can give some tips on organization techniques.

Maybe after my Part 2 and Part 3 of multiplayer learning I'll get into organization techniques for project creation. I'm bad when it comes to organization though, so I'll have to really think about how to write it.

One thing I can never(and probobly other people too)is shooting. For some reason the bullet doesnt show up on the other players screen. Perhaps you could make a tutorial for shooting bullets with 39dll?

This will be covered in either Part 2 or Part 3 of this series, it is more an optimization technique rather then sending destructive objects through the net. I'm only one man, got lots to do, including job and wife lol.

Hi I think you made a mistake. In the end step event of the obj_dll on te server you used instance_count which is a variable that equals the total amount of instances in the room. You can't put (obj_player) infront of it it will cause an error and it would count obj_dll as 1 so I think you may want to use ic = instance_number(obj_player); instead.

You are absolutely right, and I thank you for finding this error, it is "instance_number" that I wanted. I will fix it in my next update.

Really a good tutorial, it goes deep into how a package works, what a connection is etc.

Also, gotta say it, love your programming style. Alot of people tend to abuse the game maker fix thingy, where you don't have to use brackets and double = etc.

Hope to see anything more from this tutorial :3. I give it a 10/10

P.S.: Please people, this is so you can learn how to create online games, Don't ask for a whole engine, with this you can easily see how to create like a bullet shooting engine. (just send the x and y of the bullet, then send it to everyone, and let them create a bullet -.-).

In order: Thanks, Definate Thanks, More coming soon/Thank you, (p.s.) I might create an engine, but bullets are destructive objects and a waste of bandwidth, they will be covered in optimization techniques.

None is asking for a whole engine, it would just be nice to have a tutorial for a 39dll shooter game.

Patience young grasshoppa, patience. It's one of the requirements.

{} FATAL ERROR in {} at position 28: Unknown function or script: scr_translate_client

You need to reread the tutorial where I said "client.gmk script 'scr_translate_client'". The script needs to be created, the code is in the tutorial.

To everyone: As I said, I'm only one man, I appreciate any errors you bring forth so I can bring a flawless piece of code to you, and I will try and be as quick as possible getting these chapters out for you.
  • 0

#25 walkingbush

walkingbush

    GMC Member

  • New Member
  • 447 posts

Posted 03 September 2009 - 05:43 AM

Oh, man, I knew it was a dumb thing to post. Anyway, a really great tutorial, I have to say. Coding is one thing, explaining it is another whole (was about to type whole nother) thing, and you, my friend, have it down. For one man that is :) Good luck with it, my friend was right to suggest your tutorial. Really helpful.
  • 0

#26 True Valhalla

True Valhalla

    ಠ_ಠ

  • Retired Staff
  • 4880 posts
  • Version:GM:Studio

Posted 03 September 2009 - 06:23 AM

Thought I'd give this a read through to see how it compares to my tutorial (which I should really redo considering how old it is now).

I must admit, this is very well written. I believe you should incorporate constants as a substitute for writebyte(1), etc., and that the first section of the tutorial (with the IP and port parts of the packet) was a bit unnecessary and more suited towards advanced users who are interested in the details (I actually did find this section useful, but a new user would not).

Depending on how far you intend to take this, the addition of an efficient movement system would be useful (I take it this will come with your optimisation section).

Overall, good tut, very well written, and another great starting point for new users.

-Tv
  • 0

#27 general sirhc

general sirhc

    YW Creator

  • New Member
  • 1651 posts

Posted 03 September 2009 - 07:04 AM

I must ask why you would use an int for a message id....Unless I miss read

Writes a 4 byte integer to the internal buffer. The value can be between
-2147483648 and +2147483647


Normally for message ID's a single byte will be fine since its not like your gunna be sending 255 different types of messages

Write 1 byte. The value can be between 0 and 255


PS:
When/If this tutorial include how to do non jump/laggy movement I will be downloading and using :)

Edited by general sirhc, 03 September 2009 - 07:08 AM.

  • 0

#28 sabriath

sabriath

    12013

  • GMC Member
  • 3147 posts

Posted 03 September 2009 - 10:29 AM

Oh, man, I knew it was a dumb thing to post. Anyway, a really great tutorial, I have to say. Coding is one thing, explaining it is another whole (was about to type whole nother) thing, and you, my friend, have it down. For one man that is Good luck with it, my friend was right to suggest your tutorial. Really helpful

It wasn't dumb, any replies helps keep this post up top and more viewed. I'd like to know my nights of staying up weren't in vain. And thank you for the compliment.

Thought I'd give this a read through to see how it compares to my tutorial (which I should really redo considering how old it is now).

I must admit, this is very well written. I believe you should incorporate constants as a substitute for writebyte(1), etc., and that the first section of the tutorial (with the IP and port parts of the packet) was a bit unnecessary and more suited towards advanced users who are interested in the details (I actually did find this section useful, but a new user would not).

Depending on how far you intend to take this, the addition of an efficient movement system would be useful (I take it this will come with your optimisation section).

Overall, good tut, very well written, and another great starting point for new users.

-Tv

I do prefer constants as well, but digits in GM are actually stores in a less planar system making it faster than defining a constant (blah). I haven't looked into making it a resource constant yet though, I'll think about it in the next set of tutorials. The reason for all the babble in the beginning is to let people know how complicated a connection is, and that the code presented in 39dll is nowhere near as complicated, it also gives them a basic foundation for internet workings and will help them move into more advanced topics later (which I can refer back to). If a new user cannot get through a few chapters of pseudonetworking, then I don't think they'd be able to make it through actual multiplayer creation...right? Plus I stated "this isn't going to be a test" and people can skip chapters :whistle: .

Yes, right now the code is not optimized for network transmissions other than no transmission is sent if the player doesn't move, and I will be touching on this in a later tut....thank you for the compliment!

Normally for message ID's a single byte will be fine since its not like your gunna be sending 255 different types of messages

This is true, except when you are dealing with encrypting code markers and in a game as massive as world of warcraft, you will need at least 30,000 codes. I could've used "writeshort" as a 2 byte code, but I'm use to "int" from my days in C++ so I used it.

Everyone: This tutorial is finished for the scope of knowledge I created it for. When I get some time to get my webpage working, I'll link in the gmk files that are in this tutorial for you.

Edited by sabriath, 03 September 2009 - 10:31 AM.

  • 0

#29 mastersem

mastersem

    GMC Member

  • New Member
  • 236 posts

Posted 03 September 2009 - 12:25 PM

I can really see that there is alot of time put into this. and that time is well used, really great to see the rest of the chapters, hope to see those gmk files :3

maybe if there is more to come I will surely check it out :whistle:
  • 0

#30 commander of games

commander of games

    Kaos Kreator

  • GMC Member
  • 2841 posts
  • Version:GM:Studio

Posted 03 September 2009 - 01:46 PM

The finished product is very good and helpfull, whats the next tutorial going to be about?

Edited by commander of games, 03 September 2009 - 01:48 PM.

  • 0

#31 sabriath

sabriath

    12013

  • GMC Member
  • 3147 posts

Posted 04 September 2009 - 01:28 AM

I can really see that there is alot of time put into this. and that time is well used, really great to see the rest of the chapters, hope to see those gmk files :3

The files have been put up in the header, they follow along with the chapters laid out in this tutorial. I have tested the code and fixed all the errors I could find. The files automatically contain the "127.0.0.1" IP pointer, so it works right out of the box for testing purposes (the IP is pointing to yourself).

Instructions in order:
run chapter14_server.gmk
run chapter14_client.gmk
use up/down/left/right to move around a bit
run another chapter14_client.gmk
move the windows so you can see all 3
move around on either client and watch the other client move you
right click any of the player's images in the server screen and it will disconnect that player

maybe if there is more to come I will surely check it out

The finished product is very good and helpfull, whats the next tutorial going to be about?

There will be more, and the next product will be dealing somewhat with a chat program (xshortguy is currently running a project on it, but I will be running one separate for tutorial purposes). I plan to impliment not only a lobby to chat in, but private messages and file transferring (to show how to set up double connections). This will be more intricate so I'm having to write the working product first, then I'll write the tutorial on it.
  • 0

#32 commander of games

commander of games

    Kaos Kreator

  • GMC Member
  • 2841 posts
  • Version:GM:Studio

Posted 04 September 2009 - 01:59 AM

A chat program is something I would like to see. Hey, maybe the chat example could enclude sending URL links to everyone else?

Edited by commander of games, 04 September 2009 - 01:59 AM.

  • 0

#33 the_recruiting

the_recruiting

    GMC Member

  • New Member
  • 800 posts

Posted 04 September 2009 - 09:18 AM

  • 39ster {1} for the 39dll so I didn't have to write it myself
  • xshortguy for approving this tutorial before I was done
  • the_recruiting for giving me a reason to make this tutorial

I am honored to inspire a human being like yourself :whistle: By the way awesome tut.
  • 0

#34 randomazin

randomazin

    GMC Member

  • New Member
  • 84 posts

Posted 09 September 2009 - 12:08 AM

wow this is a good basic tutorial, really helped alot. thanks for making it
  • 0

#35 Zeddy

Zeddy

    Totally Radical Dude

  • GMC Member
  • 1789 posts
  • Version:GM8

Posted 09 September 2009 - 08:03 AM

So, in summary:

- Start with dllinit(0, true, false);
- servers listen with tcplisten()
- clients connect with tcpconnect(ip, port, 2 or 1)
- send stuff with clearbuffer(), writeint(x), sendmessage(recipent)
- receive stuff with clearbuffer(), recievemessage(), readint()
- Keep ids for freaking everything.

This guide was helpful, thanks for writing it!
  • 0

#36 lefty97

lefty97

    GMC Member

  • New Member
  • 49 posts

Posted 09 September 2009 - 10:58 PM

I was starting a game a while ago with another tutorial, and it didnt tell me which port to open. This covers all of that right?
  • 0

#37 shadowman465

shadowman465

    GMC Member

  • New Member
  • 244 posts

Posted 16 September 2009 - 12:51 AM

I really liked this tutorial it gives the basics really well but i was wondering if you could show how to like speed it up cause the movement is like delayed a couple seconds

-Thank you
  • 0

#38 sabriath

sabriath

    12013

  • GMC Member
  • 3147 posts

Posted 16 September 2009 - 01:22 AM

A chat program is something I would like to see. Hey, maybe the chat example could enclude sending URL links to everyone else?

There is a chat program in my projects list, I'll get to it eventually, thanks for the suggestion.

the_recruiting: I am honored to inspire a human being like yourself By the way awesome tut.

randomazin: wow this is a good basic tutorial, really helped alot. thanks for making it

zeddidragon:
So, in summary:

- Start with dllinit(0, true, false);
- servers listen with tcplisten()
- clients connect with tcpconnect(ip, port, 2 or 1)
- send stuff with clearbuffer(), writeint(x), sendmessage(recipent)
- receive stuff with clearbuffer(), recievemessage(), readint()
- Keep ids for freaking everything.

This guide was helpful, thanks for writing it!

Thanks and no problem

I was starting a game a while ago with another tutorial, and it didnt tell me which port to open. This covers all of that right?

No, but my second part tutorial contains documentation on port usage, I will put the link to it in the original post.

I really liked this tutorial it gives the basics really well but i was wondering if you could show how to like speed it up cause the movement is like delayed a couple seconds

-Thank you

No, thank you for reading it. There is no way to "speed it up" because the lag you see is network lag, there is absolutely no way to speed this up aside from making the customer purchase a faster internet connection. It can however be compressed and the movement not sent in every step...but this was just a beginning tutorial, it will be covered in another part later. For now I'm working on a compiler and other projects.

Edited by sabriath, 16 September 2009 - 01:23 AM.

  • 0

#39 sabriath

sabriath

    12013

  • GMC Member
  • 3147 posts

Posted 23 November 2009 - 10:38 AM

[BUMP] I have updated my link for the example files. I hope there are still people out there interested in my work. ;)
  • 0

#40 itatind09

itatind09

    GMC Member

  • New Member
  • 5 posts

Posted 23 November 2009 - 04:38 PM

I enjoyed that video. How many light balls do you have and where do you use yours?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users