Well, I'm producing my first multiplayer game, and it's coming along quite nicely. With what I've done so far, it's working perfectly if I connect to myself(whether it be on the same computer or just another in the network), however when I trying testing with a friend, it wouldn't. I use the ip that shows up on whatismyip.com and whatismyip.org if that helps.
I was wondering if there was any situation anyone would know of that this would be the case and if anyone knows what to look at to fix this.
Both me and my friend have routers, and I believe I've seen that it messes things up. I heard you need to "port forward" but I've had difficulty trying to find what that is or how to do it. I've set up an open port on both my friends and my computer, and I use: tcpconnect(ip,*port number*,1) but is there anything else you would need to do? I've tried adding ":port" to the ip to connect to to see if that would change anything, but no luck.
This is another question I'm fairly certain anyone with multiplayer experience ought to know pretty much right off, but if you'd like some code, I'll provide it, regardless of how horribly maimed it is.
- Game Maker Community
- → Viewing Profile: Topics: Kajio
Kajio
Member Since 24 May 2007Offline Last Active Mar 17 2013 04:52 AM
Community Stats
- Group GMC Member
- Active Posts 2520
- Profile Views 2194
- Member Title GMC Member
- Age 26 years old
- Birthday January 27, 1987
-
Gender
Male
-1
none
Latest Visitors
Topics I've Started
More Multiplayer
09 July 2009 - 02:22 AM
Multiplayer (oh Boy)
05 July 2009 - 06:33 AM
Well, I've decided to peek my head into the realm of multiplayer games. I've been starting off real slow and getting some basic tutorials and such, but it seems I've hit a problem already. I'm using 39DLL, as the industry standard, and I've just been trying to get an incredibly simple engine going, where all you do is click on the screen and your little circle jumps to that point. That is sent to the other player who then puts the little object representing you, in the correct place.
The only real code in the game is that of the obj_player. Here, I've commented it to what I think it's supposed to do:
So, I start up one copy of the game, and select host. It acts like it should, just staying idle waiting for an incoming connection, so I start up another copy of the game and select join. It asks for the IP, and I just put in my own (which has worked for all the examples/tutorials I've seen) and it waits (with that black screen) like it's trying to connect. It then shows the room like everything's good, but it won't let me click to move the player (host or client side).
It seems like the variable "started" is never changed to 1 (which now that I think of it, there's nothing to set it to 1 client-side... but it still ought to work on the host-side). It should be changed to 1 when the host receives the connection for the client, which it never seems to.
Anyone with any decent experience with 39DLL will probably find this pretty simple. I modeled this off of an example included with the DLL, so it's not exactly revolutionary.
If it'll help, you can get the exact file I have and try it out yourself: Download online.gmk
If you need any more information or whatever, just ask. I'd like to get into some multiplayer functionality, so this'll definitely help
The only real code in the game is that of the obj_player. Here, I've commented it to what I think it's supposed to do:
//GAME START EVENT
dllinit(0,1,1) //Kick off 39DLL
if show_message_ext("Host or join?","Host","Join","")=2 //Let the player pick to host or join a match
{
hostip=get_string("Host IP","") //Get the ip of the desired host
global.otherplayer=tcpconnect(hostip,23033,1) //Connect to the desired host
if global.otherplayer=0 show_message("Unable to connect to server") //Bug check
x=500 obj_otherplayer.x=80 //Switch places so you are at the joining position
started=-1 //Remain idle
}
else
{
started=0 //Remain idle, but check for incoming connections
listen = tcplisten(23033, 2, 1); //Socket for monitering incoming connections
}//STEP EVENT
if started=0 //If checking for connections
{
sock = tcpaccept(listen, 1); //Accept connections
if(sock) //If there is an accepted connection
{
closesocket(listen); //Stop checking for new connections
global.otherplayer = sock; //Assign the new connection a variable
started=1 //Let the good times roll
}
}
if started=1 //If the good times are rolling
{
if mouse_check_button_pressed(mb_left) //Click
{
x=mouse_x //Move to
y=mouse_y //the mouse
clearbuffer(); //clean slate
writebyte(0); //Message type
writeshort(x); //x position
writeshort(y); //y position
sendmessage(global.otherplayer); //Send to other player
}
while(1) //repeat until broken
{
size = receivemessage(global.otherplayer); //recieve a message
if(size < 0)break; //if there was no message, stop
if(size == 0) //if the message was blank
{
show_message("Other player left the game"); //the player disconnected
game_restart(); //Try again
break;
}
mid = readbyte(); //What type of message was it?
switch(mid)
{
case 0: obj_otherplayer.x = readshort(); obj_otherplayer.y = readshort(); break; //Move the other player to the right spot
}
}
}So, I start up one copy of the game, and select host. It acts like it should, just staying idle waiting for an incoming connection, so I start up another copy of the game and select join. It asks for the IP, and I just put in my own (which has worked for all the examples/tutorials I've seen) and it waits (with that black screen) like it's trying to connect. It then shows the room like everything's good, but it won't let me click to move the player (host or client side).
It seems like the variable "started" is never changed to 1 (which now that I think of it, there's nothing to set it to 1 client-side... but it still ought to work on the host-side). It should be changed to 1 when the host receives the connection for the client, which it never seems to.
Anyone with any decent experience with 39DLL will probably find this pretty simple. I modeled this off of an example included with the DLL, so it's not exactly revolutionary.
If it'll help, you can get the exact file I have and try it out yourself: Download online.gmk
If you need any more information or whatever, just ask. I'd like to get into some multiplayer functionality, so this'll definitely help
Black Hole
04 July 2009 - 01:55 AM
Black Hole
Download Here
Black Hole is a simple game, but fun all the same. Dodge the incoming asteroids/debris as you flee from the huge black hole. The game gives you a score based on how well you dodged all the hazardous obstacles.
Download Here
YoyoGames (may be virus scanning)
The game features two songs, both of which are very nice, and can be heard in full length here:
|The Staring Sun| by MashedByMachines
ShuffleDub by td6d

Screenshot doesn't do the graphics justice.
Nodes
24 May 2009 - 12:50 PM

Yoyogames: http://www.yoyogames...ames/show/82822 (May be awaiting virus scan)
WillHostForFood: http://willhostforfo...hp?fileid=67412 (Must extract to save)
Nodes is a simple strategy/puzzle game, and is near completion. I need more levels, and if anyone is interested, please speak up. I need a level designer, and he will get credit.
Nodes is turn-based. The player gets two moves, with which he can either move or shoot. Then, the enemies get two moves each. The player has a an advantage over the enemies, however, as he can take three hits, and enemies can only take one. Tutorial and additional instructions is in game.
Please comment and leave reviews.
Balancing Creatures
19 January 2009 - 12:33 AM
Well, like all good ideas, this one came to me during a shower. I'm trying to think of a game where you balance out little ecosystems of strange creatures. I figured it be a sort of puzzle game, where you'd have an environment to place a set number of creatures in, in order to make them as happy as possible. You'd have to deal with all the interactions the creatures would have with each other in order to get the happiness of all the creatures to a certain point to pass the level.
I'm thinking about a bunch of different creatures, and how they would act. I figure trying to find out how all the creatures react to each other would be part of the experience... I was kinda thinking of a few creatures like:
An amphibious creature, it'd like to be close to water, and far from predators
A fast-running hunter, it'd like to be in a small pack and close to prey. Being alone would make food hard to get, but being with too many would make food scarce
A slimy guy, who, although doesn't require much, makes other creatures unhappy because of the slime and smell. You'd want him isolated if you could :P
I'm kinda looking for ideas on how to make this idea a bit more... exciting. I mean, I'd like to make charming graphics that would be interesting, but I think it would take more. If you boil it right down to the basics, you're just placing pieces on a map. Would the intrigue of the puzzle be enough to make it fun?
I'm also open to ideas about different creatures :P
----------------------------------
At the same time here, I'm thinking about a simple story to frame this with. I was tossing some ideas around, and this is what seemed like the best:
The player is a zookeeper, but was fired for spending too much time playing with the animals, and not enough time shoveling their dung. On the search for a new job, he finds a local zoo he's never heard of. Turns out that it's getting ready to open soon, but the animals are unhappy. The employer then shows the player to the animals, and it seems they are all weird creatures you've never seen before. The player freaks for a bit, but soon realizes they aren't all that different than normal animals. Then, the player gets crackin' trying to get all the creatures happily balanced.
How's that for a story? Comments? suggestions? I'm not exactly a professional writer, and that was the first draft :P
I'm thinking about a bunch of different creatures, and how they would act. I figure trying to find out how all the creatures react to each other would be part of the experience... I was kinda thinking of a few creatures like:
An amphibious creature, it'd like to be close to water, and far from predators
A fast-running hunter, it'd like to be in a small pack and close to prey. Being alone would make food hard to get, but being with too many would make food scarce
A slimy guy, who, although doesn't require much, makes other creatures unhappy because of the slime and smell. You'd want him isolated if you could :P
I'm kinda looking for ideas on how to make this idea a bit more... exciting. I mean, I'd like to make charming graphics that would be interesting, but I think it would take more. If you boil it right down to the basics, you're just placing pieces on a map. Would the intrigue of the puzzle be enough to make it fun?
I'm also open to ideas about different creatures :P
----------------------------------
At the same time here, I'm thinking about a simple story to frame this with. I was tossing some ideas around, and this is what seemed like the best:
The player is a zookeeper, but was fired for spending too much time playing with the animals, and not enough time shoveling their dung. On the search for a new job, he finds a local zoo he's never heard of. Turns out that it's getting ready to open soon, but the animals are unhappy. The employer then shows the player to the animals, and it seems they are all weird creatures you've never seen before. The player freaks for a bit, but soon realizes they aren't all that different than normal animals. Then, the player gets crackin' trying to get all the creatures happily balanced.
How's that for a story? Comments? suggestions? I'm not exactly a professional writer, and that was the first draft :P
- Game Maker Community
- → Viewing Profile: Topics: Kajio
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content
