1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

[SOLVED] Map Tiles not showing up

Discussion in 'Modding Help' started by Chaosed0, Dec 27, 2013.

  1. Chaosed0

    Chaosed0 Catapult Fodder

    Messages:
    15
    I'm creating a TTH map generator; the code is based very loosely on the "GenerateFromKAGGen.as" script. I'm hosting it on a test server on my laptop (which doesn't register to the master server) and connecting to it via local IP from my desktop.

    The map is generated and sent just fine; the map shows up in the minimap at the top on the client. However, when testing it on a local server, if the server is the first one joined by the client, no map tiles are displayed and collision is incredibly funky. The client and the server desync very badly, with the client attempting to fall through the ground and the server stopping it from doing so. Trees, bushes, and other blobs are still displayed, just no map tiles. Quite often, the client will simply crash on joining.

    If I join any other TTH server, or change my server to host a PNG TTH map, then come back to a generated map, the tiles show up just fine. Note that it must be a TTH map - not sure why. Another symptom of the problem might be that backgrounds never show up on my generated maps, despite SetupBackgrounds() being called on the map object.

    Here's a video of the problem.

    The mod can be found here, although I've noticed this behavior also occurs if I use a "kaggen.cfg" file. I've inspected the initialization/cleanup code of the BasePNGLoader, and they don't seem to differ too much from that of the generation code.
    --- Double Post Merged, Dec 27, 2013, Original Post Date: Dec 24, 2013 ---
    Fixed the issue, many thanks to Verra-chan:

    Code:
    15:51 < Verra-chan> lines 24 to 29 isn't happening
    15:52 < Verra-chan> aka the client part
    15:52 < chaosed0> OH filename == ""
    15:52 < chaosed0> man
    15:52 < Verra-chan>  mhm
    15:52 < Verra-chan> so yea
    15:52 < chaosed0> ok that makes sense uh
    15:52 < Verra-chan> just fix that and you should be good
    
    The issue is that the client needs to initialize the map too; it needs to load the correct sprite sheet and backgrounds. There's a big comment at the top of the kaggen.cfg file: "fileName is "" on client!" which... doesn't seem to be true. This, combined with the following "if" statement, creates badness:

    Code:
    if (!getNet().isServer() || filename == "") {
        SetupMap(map,0,0);
        SetupBackgrounds(map);
        return true;
    }
    So, all I did was take out the filename bit of the if statement, and everything works great.
    EDIT: Actually, after thinking about it, this doesn't make sense; even if the filename wasn't empty, the client still should have met the first condition. I changed "!getNet().isServer()" -> "getNet().isClient()"; maybe that's what fixed it.
    EDIT: Still not fixed. See this post for more information. It's much more involved than I thought.
     
    Last edited: Dec 29, 2013
    Aphelion likes this.
  2. Aphelion

    Aphelion Wunderkind Donator
    1. Aphelion's Roleplay

    Messages:
    180
    Same issues, preventing my new mod from getting anywhere. This needs to be fixed asap, or I have nothing to do.
    --- Double Post Merged, Jan 7, 2014, Original Post Date: Jan 6, 2014 ---
    It's very very strange, sometimes it works, sometimes it doesn't.