Jump to content


Photo

Help Please Mutliplayer


  • Please log in to reply
7 replies to this topic

#1 Neged

Neged

    GMC Member

  • New Member
  • 141 posts

Posted 23 May 2009 - 08:58 PM

Okay, this is the end of the line...
i give up...
Can someone make it able to have more than 2 players??
Here:
http://willhostforfo...ad&fileid=67314
If you fix it ill do ANYTHING for you, except illegal stuff and paying.
I'll even make a userbar that says i worship ( the guys name who fixes it )

Edited by Neged, 23 May 2009 - 09:00 PM.

  • 0

#2 Charney

Charney

    GMC Member

  • New Member
  • 26 posts

Posted 23 May 2009 - 09:09 PM

Try looking at some tutorials.
If you're using mplay (GM's built in multiplayer functions):
http://www.yoyogames...multiplayer.zip <- Official tutorial by Mark Overmars.
http://gmc.yoyogames...howtopic=190490 <- Mplay platform tutorial.
http://gamemaker.wik...nfo/multiplayer <- Summary of Mplay scripts and usage.
Google.com <- Your friend.

If you're using 39dll (A dll that allows you to access windows sockets in gamemaker):
http://gmlkb.wikidot...ayer-with-39dll <- Summary of 39dll scripts and their usage.
http://gmc.yoyogames...showtopic=90437 <- 39dll topic..there are a few examples in the posts.
http://gmc.yoyogames...opic=351397&hl= <- 39dll tutorials by Blaxun

If you're using winsock or something...
Google.com

Edited by Charney, 23 May 2009 - 09:11 PM.

  • 0

#3 Neged

Neged

    GMC Member

  • New Member
  • 141 posts

Posted 23 May 2009 - 09:25 PM

Try downloading and looking at the code?
my account system buggs something...
but i cant find what does it bugg...
  • 0

#4 Neged

Neged

    GMC Member

  • New Member
  • 141 posts

Posted 24 May 2009 - 09:21 AM

could anyone try today??
sorry for doublepost...
  • 0

#5 FoxInABox

FoxInABox

    GMC Member

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

Posted 24 May 2009 - 01:37 PM

The game was pretty mutch configured to be multiplayer from the current code .. but there is a few problems:

mplay_message_send(0,5,global.username)
and the:
if mplay_message_id()=5
	{
	  ini_open('Accounts.ini')//open accounts
	  if ini_section_exists(mplay_message_value())
	  {
		username = mplay_message_value()
	  }
	}
section can be removed .. because you can find the username that you send to server when you joined the session by mplay_message_name()

and close the ini files after opeing them:

ini_close()

And take a look at this part, here you are looking for section username, key 0 or 1
if ini_key_exists(username,'Password' = mplay_message_value())
.. I highly doubt that you would find that key..

maybe try:
if ini_key_exists(mplay_message_name(),'Password') {
  if ini_read_string(mplay_message_name(),'Password','')=mplay_message_value()
  // password is correct
  else
  // password is wrong;
} else {

// profile doesn't exist .. then create it
ini_write ...
}


in the start it can be good to know that the correct things get triggered, so I use to make a code that when I send something to server/player .. then I can get notified when that happends:

for object controll:
create event:
for(i=0;i<10;i+=1) log[i]="";

draw event:
for(i=0;i<10;i+=1) draw_text(x,y+i*15,log[i]);

// this is a list of all players that is connected
n=mplay_player_find(); i=0;
while(i<n) { draw_text(200,y+15*i,mplay_player_name(i)); i+=1; }

make a new script and call it: log_add
for(i=9;i>0;i-=1;) log[i]=log[i-1];
log[0]=argument0;

this is meant to be put after a id check

if mplay_message_id()=4//create bullet
{
log_add(mplay_message_name()+" created a bullet")
...

but that one might happen ofen .. so it would get a bit annoying ..

.. funny, I had to learn mplay to fix this .. I'm used to work with 39dll only x3 .. will upload it later (because you learn more if you manage to fix it on your own)
  • 0

#6 Neged

Neged

    GMC Member

  • New Member
  • 141 posts

Posted 25 May 2009 - 08:47 PM

Could you please upload, cause i REALLY dont understand a part of what you said...
for the username check thing...
pm the link...

Edited by Neged, 25 May 2009 - 08:48 PM.

  • 0

#7 MonopolyKing

MonopolyKing

    GMC Member

  • New Member
  • 938 posts

Posted 25 May 2009 - 09:49 PM

The game was pretty mutch configured to be multiplayer from the current code .. but there is a few problems:

mplay_message_send(0,5,global.username)
and the:
if mplay_message_id()=5
	{
	  ini_open('Accounts.ini')//open accounts
	  if ini_section_exists(mplay_message_value())
	  {
		username = mplay_message_value()
	  }
	}
section can be removed .. because you can find the username that you send to server when you joined the session by mplay_message_name()

and close the ini files after opeing them:

ini_close()

And take a look at this part, here you are looking for section username, key 0 or 1
if ini_key_exists(username,'Password' = mplay_message_value())
.. I highly doubt that you would find that key..

maybe try:
if ini_key_exists(mplay_message_name(),'Password') {
  if ini_read_string(mplay_message_name(),'Password','')=mplay_message_value()
  // password is correct
  else
  // password is wrong;
} else {

// profile doesn't exist .. then create it
ini_write ...
}


FoxInABox correct me if I am wrong:

What he's saying is that it's no reason to create a variable (global.username) and use it because you can automatically find a name sent to the server by using the built-in mplay function.

As for the second part, it checks for the keys existence, then it checks to see if the password acquitted to it is correct. If it is, most likely the player is allowed to join the world, if it isnt, return a negative (password is incorrect). And lastly, as I said before, it checks the key's existence; if it doesnt exist however, create it.

Hope that helps Neged.
  • 0

#8 FoxInABox

FoxInABox

    GMC Member

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

Posted 26 May 2009 - 09:20 AM

nah.. it might be nice to have the name stored when you got a chat ..

but yeah .. unnessesary to send it to the server 2 times ^^

anyway .. I'll PM the file over to him

Edited by FoxInABox, 26 May 2009 - 09:21 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users