December 07, 2021, 03:16:08 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Due to a rise in bot activity, new posters need to be approved before posting.

Join the community Discord server!

Pages: [1] 2 3 4

Author Topic: Inability to dowload maps.  (Read 13327 times)

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16769
  • Yeah so now I have an idea
Inability to dowload maps.
« on: May 18, 2010, 04:50:07 pm »

Here, I'm going to attempt to pinpoint the problem.

It maybe related to latency or something, so tell me what the errors and the circumstances that cause custom maps being unable to be played please.
Logged

Psychopath

  • Developer In Training
  • ******
  • Karma: 167
  • Offline Offline
  • Posts: 6696
  • Stop telling me to do things
Re: Inability to dowload maps.
« Reply #1 on: May 18, 2010, 04:53:20 pm »

Go nuts.
Code: [Select]
{
  var animation_timer, downloadTimeout, downloadHandle, content_type, download_string, i;
  animation_timer = 61;
  downloadTimeout = 30 * room_speed;
  downloading = false;
 
  // we already have the map, so do a validity check and launch the map
  // check if it matches the server's copy
  if(file_exists("Maps/" + global.currentMap + ".png")) {
    if(CustomMapGetMapMD5(global.currentMap) == global.currentMapMD5) {
        room_goto_fix(CustomMapRoom);
        exit;
    } else {
    // our map isn't the same ask if you want to delete map
        if(show_question("The server's copy of the map (" + global.currentMap + ") differs from ours.#Would you like to download this server's version of the map?")){
            file_delete("Maps/" + global.currentMap + ".png");
            file_delete("Maps/" + global.currentMap + ".locator");
        }
        else {
            game_end();
            exit;
        }
    }
  }
 
  if(!file_exists("Maps/" + global.currentMap + ".png")) {
    // we don't have the map, so download it
    if(global.currentMapURL == "") {
      show_message("Server went to custom map " + global.currentMap + ".#We don't have that map, and the server didn't tell us where to download it.#Exiting");
      game_end();
      exit;
    }
    downloadHandle = DM_CreateDownload(global.currentMapURL, "Maps/" + global.currentMap + ".png");
    DM_StartDownload(downloadHandle);
    while(DM_DownloadStatus(downloadHandle) != 3) { // while download isn't finished
      sleep(floor(1000/30)); // sleep for the equivalent of one frame
      io_handle(); // this prevents GameMaker from appearing locked-up
 
      // check if the user cancelled the download with the esc key
      if(keyboard_check(vk_escape)) {
        show_message("Download cancelled.#Exiting");
        game_end();
        exit;
      }
 
      downloadTimeout = downloadTimeout - 1;
      if(downloadTimeout <= 0 && DM_DownloadStatus(downloadHandle) < 2) {
        show_message("Timed out while attempting to download map " + global.currentMap + ".#Exiting");
        game_end();
        exit;
      }
     
      // draw event here
      if(room == Lobby || room = Menu) {
        draw_background_stretched(MenuBackgroundB, 0, 0, 600, 600);
      } else {
        draw_background_stretched(MenuBackgroundB, 0, -100, 800, 800);
      }
 
      animation_timer = animation_timer + 1;
      if(animation_timer >= 90) animation_timer = 0;
      display_string = "Loading.";
      for(i = 0; i < (animation_timer div 30); i += 1) display_string += ".";
 
      draw_set_alpha(1);
      draw_set_color(c_black);
      draw_set_halign(fa_left);
      draw_text_transformed(30, 550, display_string, 3, 3, 0);
 
      screen_refresh();
    }
    // verify that this is, in fact, a png (and not html, or an exe, or whatever
    // NOTE: this is a security measure, but probably a very weak one
    content_type = DM_GetContentType(downloadHandle);
    if(content_type != "image/png") {
      show_message("Invalid download data.#Exiting");
      DM_StopDownload(downloadHandle);
      DM_CloseDownload(downloadHandle);
      file_delete("Maps/" + global.currentMap + ".png");
      game_end();
      exit;
    }
    DM_StopDownload(downloadHandle);
    DM_CloseDownload(downloadHandle);
   
    // save the locator so that we can host with this map in the future
    var locatorFile;
    locatorFile = file_text_open_write("Maps/" + global.currentMap + ".locator");
    file_text_write_string(locatorFile, global.currentMapURL);
    file_text_close(locatorFile);
  }
 //now we have the map check if its the same as the servers map
  if(CustomMapGetMapMD5(global.currentMap) == global.currentMapMD5) {
  room_goto_fix(CustomMapRoom);
  exit;
  }else{
  // our map isn't the same, locator points to diffrent map
  show_message("The server's locator for " +global.currentMap+ " points to a different map");
game_end();
exit;
}
}
Logged
Quote from: IRC
(8:01:46 PM) Psychopath: I'm just wondering what the next hot thing to fall on my lap will be
(8:01:57 PM) Lynn1: a girl maybe?
(8:02:01 PM) Psychopath: :o

Teekytots [PC][OG]

  • Retired Big Man
  • Soldier of Fortune
  • ******
  • Karma: 142
  • Offline Offline
  • Posts: 6515
  • Fear is only a State of Mind
Re: Inability to dowload maps.
« Reply #2 on: May 18, 2010, 04:53:57 pm »

Uh, should I move this to bug reports? It'll reduce threads about this.
« Last Edit: May 18, 2010, 04:54:19 pm by Teekytots [PC:CWD] »
Logged
I have signatures turned off

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16769
  • Yeah so now I have an idea
Re: Inability to dowload maps.
« Reply #3 on: May 18, 2010, 04:54:37 pm »

I remember there being an error message from a sepreate event, if I'm not mistaken
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16769
  • Yeah so now I have an idea
Re: Inability to dowload maps.
« Reply #4 on: May 18, 2010, 04:55:04 pm »

Uh, should I move this to bug reports? It'll reduce threads about this.
sure sure
Logged

Teekytots [PC][OG]

  • Retired Big Man
  • Soldier of Fortune
  • ******
  • Karma: 142
  • Offline Offline
  • Posts: 6515
  • Fear is only a State of Mind
Re: Inability to dowload maps.
« Reply #5 on: May 18, 2010, 04:55:34 pm »

kk  8D
Logged
I have signatures turned off

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16769
  • Yeah so now I have an idea
Re: Inability to dowload maps.
« Reply #6 on: May 18, 2010, 07:09:01 pm »

Yeah we have a fix for it, thanks to L.

However, the problem is clientside, so us hosters can't do much about it.  D:
So what was the issue?
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16769
  • Yeah so now I have an idea
Re: Inability to dowload maps.
« Reply #7 on: May 18, 2010, 07:12:20 pm »

And that's also what causes the incompatible server protocall or whatever error message?
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16769
  • Yeah so now I have an idea
Re: Inability to dowload maps.
« Reply #8 on: May 18, 2010, 07:15:51 pm »

Yeah we have a fix for it, thanks to L.

However, the problem is clientside, so us hosters can't do much about it.  D:
So what was the issue?

The game doesn't load the map after it downloads it. :z9:

When you go to a custom map, the game checks if you have the map; if you do than you simply load it, if you don't you download it... but then it doesn't load it afterwards
hmmmmm...

it does bring you to the custom map, you see at the bottom?

 //now we have the map check if its the same as the servers map
  if(CustomMapGetMapMD5(global.currentMap) == global.currentMapMD5) {
  room_goto_fix(CustomMapRoom);
  exit;
  }else{
  // our map isn't the same, locator points to diffrent map
  show_message("The server's locator for " +global.currentMap+ " points to a different map");
game_end();
exit;
}
}

so I doubt that's it....?
Logged

NAGN

  • Developer
  • ******
  • Karma: 146
  • Offline Offline
  • Posts: 16769
  • Yeah so now I have an idea
Re: Inability to dowload maps.
« Reply #9 on: May 18, 2010, 07:23:59 pm »

If you copied that from psycho's post, I'm pretty sure he was posting the fix.

If not, I don't see that anywhere in the CustomMapDownload script.
Oh I did :drool:
Logged

Psychopath

  • Developer In Training
  • ******
  • Karma: 167
  • Offline Offline
  • Posts: 6696
  • Stop telling me to do things
Re: Inability to dowload maps.
« Reply #10 on: May 18, 2010, 07:40:36 pm »

If you copied that from psycho's post, I'm pretty sure he was posting the fix.

If not, I don't see that anywhere in the CustomMapDownload script.
Oh I did :drool:
Oh don't worry, I copied it from a pm that L sent me after I requested the script so I could fix it :drool:
Logged
Quote from: IRC
(8:01:46 PM) Psychopath: I'm just wondering what the next hot thing to fall on my lap will be
(8:01:57 PM) Lynn1: a girl maybe?
(8:02:01 PM) Psychopath: :o

Silent Boom

  • Lucky Member
  • *******
  • Karma: 17
  • Offline Offline
  • Posts: 1013
Re: Inability to dowload maps.
« Reply #11 on: May 22, 2010, 01:43:32 am »

So what now?

L

  • Guest
Re: Inability to dowload maps.
« Reply #12 on: May 22, 2010, 01:45:39 am »

Its been fixed just wait till next update
« Last Edit: May 22, 2010, 01:45:55 am by (゚ヮ゚) L »
Logged

Silent Boom

  • Lucky Member
  • *******
  • Karma: 17
  • Offline Offline
  • Posts: 1013
Re: Inability to dowload maps.
« Reply #13 on: May 22, 2010, 04:03:30 am »

Its been fixed just wait till next update
  :c1:

Dusty

  • 2012 Haxxy Award Winner
  • *
  • Karma: -78
  • Offline Offline
  • Posts: 11006
  • Dust in a box under a table
Re: Inability to dowload maps.
« Reply #14 on: May 25, 2010, 05:50:35 pm »

Its been fixed just wait till next update
when is the next update?
Pages: [1] 2 3 4
 

Page created in 0.033 seconds with 35 queries.