How do I make a cylindrical world map?

0 favourites
From the Asset Store
A simple Map Editor that where you can edit a map with restriction or totally. You can save and load the map created.
  • Is it possible to use the tilemap object and create a "cylindrical" world map in a layout? Think Final Fantasy 1 where if you sail your boat too far north, you end up on the other side of the map?

    The player object "wrap" doesn't help, as it "jumps" to the other side of the layout, where it should not jump at all, but just smoothly transition.

  • With unbounded scrolling on, make a duplicate of the tile map and put it right above the layout and another right below. The jump from moving the player from the top to bottom should be mostly undetectable. The wrap behavior is likely not sufficient so you’ll have to do:

    Player.y<0

    —-set y to self.y+layoutheight

    Player.y>layoutheight

    —- set y to self.y-layoutheight

    So basically you’re just duplicating everything to make it look seamless. You can probably get away with one deplicate instead of two if you position the duplicate depending if the player is close to the bottom or top. Moving objects can be trickier but the duplicate is always at the same offset from the original, a y difference of layoutheight.

    I’ve also used the paster object instead so that you draw the bottom part of the layout to it and move it above the layout when the player is near the top. The bottom is handled in the same way. Tile maps won’t work as is with paster because only the tiles onscreen will be drawn as an optimization. The trick to make it work is to move the paster and tile map objects onscreen first before drawing.

    Either of those will make it look like it’s seamless. Next thing to deal with is making stuff work across this seam. They’d have to be handled on a case by case basis.

  • With unbounded scrolling on, make a duplicate of the tile map and put it right above the layout and another right below. The jump from moving the player from the top to bottom should be mostly undetectable. The wrap behavior is likely not sufficient so you’ll have to do:

    Player.y<0

    —-set y to self.y+layoutheight

    Player.y>layoutheight

    —- set y to self.y-layoutheight

    So basically you’re just duplicating everything to make it look seamless. You can probably get away with one deplicate instead of two if you position the duplicate depending if the player is close to the bottom or top. Moving objects can be trickier but the duplicate is always at the same offset from the original, a y difference of layoutheight.

    I’ve also used the paster object instead so that you draw the bottom part of the layout to it and move it above the layout when the player is near the top. The bottom is handled in the same way. Tile maps won’t work as is with paster because only the tiles onscreen will be drawn as an optimization. The trick to make it work is to move the paster and tile map objects onscreen first before drawing.

    Either of those will make it look like it’s seamless. Next thing to deal with is making stuff work across this seam. They’d have to be handled on a case by case basis.

    Could you provide an example? I see what you're saying here but I'm not sure I completely comprehend. Something small is all I need, I just do better looking at what I'm doing than being explained to. lol

  • R0J0hound

    Do you know whether it is possible in principle to develop a plugin that would allow you to define a cylindrical or toroid layout/layer or are there limitations to how the layout system works that would prevent this?

  • A plugin probably could be made. The objective is to draw objects twice. So it could be done by replacing the draw function with two calls to the old draw function with two set positions in between. It’s not something I’m interested in doing.

  • That's cool, just wanted to know if it was achievable

  • Know anyone interested in creating this plugin? It could have have other options like MegaMan/SOTN scrolling (variables operate scroll speed), or even Zelda 1 or Zelda 3 type of scrolling.

    Edit: This could also be good for game or interactive slideshow transitions.

  • R0J0hound

    Is it possible to achieve smooth transitions like you have demonstrated if the player character has physics applied to it?

    I'm working on a different approach to cylindrical world maps where if the players goes beyond X:5000 their X is set to 100. It works perfectly except obviously when this happens they loose their X.Y and Angular Velocities.

    I have it setup so that these velocities are recorded when they hit X:5000 and reapplied when they hit X:100 but there is a "hiccup" where the player character is froze for 0.1-0.2 seconds. I figured it must be a time related thing, so then I added in that time would be speed up by 100x for 1 second after they hit X:100, but now matter how I play with these numbers it never has any significant impact on the "hiccup".

  • mekonbekon

    I got a wild hair and tried an attempt. Only works if the object is onscreen because C2 doesn't draw off screen stuff. So the next step would to try something complicated to trick C2 to always draw in the cases we want. But that's ugly and hacky, plus that leads to an ever increasing number of side effects that would have to be handled. Baw I say, I like the event version better.

    roracle

    Those things are scrolling related, that's different than visually wrapping the layout from one side to the other.

    Ajbael

    The physics behavior doesn't work well when you set positions like that. I think the solution is what you're doing, except you need to wait till the next tick to restore the velocities. Anyways it's not something I want to re-figure out, instead you could use another physics behavior such as chipmunk, which works fine if you move objects like that.

  • R0J0hound

    Perfect, thanks!

  • R0J0hound - thanks for trying! I'm only asking out of curiosity and haven't got a project specifically in mind for it.

    I'm guessing then that there's no low level way to treat the layout coordinates system in such a way that 0 and layout.width or height are equivalent, like you might with 0 and 360 when dealing with angles? Essentially saying, "topologically this layout doesn't exist on a flat plane, it's actually wrapped around a cylinder/donut".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • roracle you can do all these types of scrolling in two ways

    1. give everything a bullet and a specific speed while its disabled initially make sure it all has the same speed (this can get real laggy here if you are talking world maps so option 2 is probably best) once player reaches the edge of the x,y that will always be the same locations you freeze frame enemies and player animations and turn all bullets on until they either reach a bullet distance reached or a dummy object on each side of the screen reaches the other and then resets x,y/distance youd also need to set the angle of motion for each direction

    2.put dummy bars at the edges of your area and one in the center then update their location each scroll which will happen when colliding with unit say northscrollbar collides with link center object-scroll Y-33 north bar scroll Y-33 (and the other 3) wait .2 seconds repeat until you reach the size of your canvas making sure you have scroll to on the center and do the final scroll to be exact to canvas

    should be 1/4th the work for sotn/megaman

  • I experimented with this a few years back. I did it the way R0j0hound did with repositioning the tile maps, but rather than having 2 duplicate objects i instead used just the one object that moved with the tilemap position it was currently overlapping.

    I lost much of the work but still have one file left, if you can decipher whats going on. I'm also a bit better at coding now so some of the events might be a bit wtf.

    https://www.dropbox.com/s/w1tur97a8rzyxfo/worldmap.capx?raw=1

  • Okay now that I have my monitor back I can get back to work, SO I'm resurrecting some old threads from where I left off. What am I doing wrong in this here? I implemented the vertical scrolling and duplicated it for horizontal as well, but now the map is all over the place. Just run it and move the character around, you'll see what I'm talking about.

    https://drive.google.com/open?id=1mRiw- ... -ThWU1xC3h

    EDIT: I had to change the "ScrollingY" sections PICK to instance 2, and it seems to work, except the items themselves jump around.

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