Jump to content


Member Since 24 May 2007
Offline Last Active Nov 06 2013 10:43 AM

Topics I've Started

Background_Replace() Not Wanting To Work *Solved*

21 August 2013 - 02:40 AM

Trying to make a pause menu with the newest version of GM:S, so I've got the following object:

Information about object: obj_c
Solid: false
Visible: true
Depth: -200
Persistent: false

Create Event:

execute code:

globalvar bg_pause, paused;

Draw Event:

execute code:

if (paused==1) {draw_background(bg_pause,view_xview,view_yview);}

Key Press Event for Key:

execute code:

if (paused==1)

screen_save() works, it creates the file fine, but background_replace() seems to do nothing; the original bg_pause remains unchanged.  I tried using background_delete() and background_add() to do the same thing, but that didn't work either (and started passing errors)


SOLVED: My solution being that I'm downgrading to a previous version of GM:S for my game that is too large at this point to copy over to GM8, and then using GM8 for future development until I hear that GM:S has been improved significantly.

Fullscreen/Windowed Causing Problems With Surfaces

20 August 2013 - 09:47 PM

So switching between fullscreen and windowed mode destroys any surfaces you have, I got that.  When I switch between the two modes, or make a change to the window, I get this error:



action number 1
of Draw Event
for object obj_lightcon:
Trying to use non-existing surface.
 at gml_Object_obj_lightcon_Draw_0 (line 6) - draw_surface(light,view_xview[0],view_yview[0]);


However, I check to make sure that the surface exists before drawing it:

if (!surface_exists("light")) 
    light = surface_create(641,401);

Any ideas as to why this is happening?  Thanks for any help!

[Unsolved] Controls Not Working On Other Computers

23 June 2013 - 10:21 PM

TL;DR: Controls don't work on some computers, but work perfectly fine on others.



I've released a demo for my recent game and for some people, it would appear that the controls don't work.  I upgraded to GMStudio to see if it would help, but it seems to have caused more people to encounter the same problems.


The problems seem all over the place, with some people having their momentum killed when they try to jump, others can't get walljumping to work properly, and others just have a lot of lag between pressing a key and actually doing something.  Half the time people are telling me that the controls work unless they do something completely unrelated (Like if they kill a monster, the controls stop working until they leave the room and come back).  This should obviously have no effect on the controls at all, but it does.  Other players don't report any problems with the controls at all.


The worst part about it is that I can't seem to replicate these problems on any of the computers I have access to, and googling doesn't yield anyone having the same problem!


I have used both "keyboard_check" and "keyboard_check_direct" but the results are the same.

More Multiplayer

09 July 2009 - 02:22 AM

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.

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:
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
 started=0  //Remain idle, but check for incoming connections
 listen = tcplisten(23033, 2, 1); //Socket for monitering incoming connections

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
  mid = readbyte();  //What type of message was it?
   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 :)