Very large map ideas

0 favourites
  • 7 posts
From the Asset Store
Create your own adventure map with this easy to use asset pack.
  • (Curious if anyone has done something similar or has an idea to simplify this)

    I'm looking to display a large (9,961 map square sprites) or so, scrollable map that shows the position of user locations (icons with x,y coordinates and user information). The graphics don't have to be awesome, but the info will need to be updated when changed. The map can change but is usually static.

    Things I've done:

    1. Pin map square sprites (60x40) to a background sprite (3500x3500). The background has the drag/drop behavior. The Pin behavior calls were eating up 34% of memory, so changed pin on start to on touch start/end, pin/unpin. Pin must be an every tick behavior and changing it to touch dropped cpu behavior calls to 5% of memory. (Amazingly, this doesn't seem to be causing any display issues when doing preview on mobile and is very smooth scrolling.)

    2. Changed the layer scale to 3 (graphics are meh, but scrolls smoothly).

    3 Used save as json (array) for the locations of user sprites (about 300kb max size) and have a variable used to check the server for changes. (Everyone uses the same .json map file, but there is a cell in a mysql database call changed. If changed = 1, then users update their maps else use the previously downloaded map.

    Anyway, just looking for ideas. Thanks in advance!


  • Is there any reason why you are using a grid of sprites and not a tilemap? Tilemap would be massively better for performance, easier to update and save, the save file will be much smaller etc.

    If you must to use the sprites, try hierarchy instead of Pin behavior. It may be faster and you won't have to pin/unpin all the time. Another option is to scroll a layer with the sprites, this way you won't have to pin anything at all.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Never needed to use a tilemap and was trying to avoid learning.

    Would you happen to know how to set a variable for each tile by it's grid location?

    I can do it manually with On touch set var1 = Tilemap.PositionToTileX(Touch.X)/Y

    But can't figure out how to do it at the start of layout. It returns the x,y of the map itself an not each tile.

  • Not sure what you mean. Touch.x/y will return 0 if you are not touching the screen.

    Expressions Tilemap.PositionToTileX/Y convert layout coordinates to tile number. There are a few other useful expressions, check out the documentation.

  • I read it, and just can't figure out a way to do what I want.

    I have 2 variables on the tilemap CurrentX, and CurrentY. They are set using

    CX = Tilemap.PositionToTileX(Touch.X)

    CY = Tilemap.PositionToTileY(Touch.Y)

    This gives a grid location to all of the sprites that I can read in the debugger (also to use for other things).

    I would like to add

    AT START, for each tile set CX2 and CY2 based on the x,y value of each tile.

    My question is if this is possible or does it require input (touch, click, etc)

    (Kind of a check to make sure things are matching, but also to use in another array)

  • AT START, for each tile set CX2 and CY2 based on the x,y value of each tile.

    Tilemap is a single object, you can't set different variable values for individual tiles, only to the entire tilemap.

    If you need to store some values per each tile, this is usually done with a 2D or 3D array.

  • An example: using touch I clicked on the top row, second tile from left shows x,y of 0,1

    I'll see if I can't just do a loop and set everything up a different way (need an array anyway for ajax stuff).

    I'm not familiar with the ins/outs of tilemaps, but appreciate the input.

    So far it's only at about 3% cpu (vs 30%+) and I've increased the map size from 10k sprites to a tilemap of 120k tiles.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)