How do I optimize a Zelda-style engine for mobile? w/ exampl

0 favourites
  • 15 posts
From the Asset Store
Sheeky's Racing Sounds
$4.20 USD
30% off
75 vehicle sound effects, from real looping car engines to jet aircraft and sci-fi engines.
  • Hello everyone -

    I've definitely read and seen some good stuff on this forum pertaining to open world style games, metroidvanias, etc. I've played around quite a bit and I've seen some level of success using the rexrainbow TMX plugins, namely their ability to read tile data, load layers, etc. I guess it gives you a good amount of freedom and abilities that the built in TMX parser just can't give you.

    For example, with a single layout you can essentially explore an entire world with zelda style level scrolling, permanently destructible features, enemies that can just be placed through some simple values in Tiled, keys, doors that open under certain conditions set in Tiled, placing animated tiles, etc. All the fun Zelda 1 type things that guys born in the 80's are pretty into.

    To that end though, because you're essentially placing multiple sprite instances based on your TMX grid, that's probably not the best practice for mobile development. While my engine seems to run great (of course) on my machine, my tablet and phone (both androids) naturally take a big hit.

    I don't know if this is quite 'best practice' (because I'm a forum n00b still...) but here's the web version:

    http://threesevenhosting.com/builds/adventure/

    (arrow keys and space - feel free to try it on your mobiles. might have to hit refresh a second time if level loading doesn't work. simple graphics with reused palettes at this point to mimic game boy color)

    I guess my question then is this: is there a way to accomplish these sorts of gameplay features without killing the system memory? From what I read, maybe not - at least not yet. But maybe there is?

    It seems like, if you could say, load a level and the surrounding levels using the built in tile map features, you could get the same scroll effect by actually scrolling to that part of the layout instead of moving the entire level, destroying the tile sprites when they're too far from the layout, while moving in the next level piece by piece - but then when it comes to actually placing and loading enemies using the built in features you would be at a loss. Is that correct to assume that?

    Also - does it even matter that I have 1 layout that is dedicated simply to the main game engine, as opposed to having multiple layouts? Is there an advantage to that? I've always thought that there would be, but maybe not?

    Thanks guys. Learned a lot from the forum.

  • I am sure you would be wanting to add type writer text effects for the rpg in your game eventually...

  • Bump - would love some constructive input.

  • Well first off, if you use one single layout, then your entire game will be loaded into memory and running. Which can be a problem on mobile devices with RAM and CPU resources being so limited.

    I would suggest one layout for each tileset theme. This way only one set of tiles needs to be loaded into memory. For all of your caves you could use one layout and all of your forested areas could use another layout.

    As for the transition effect between layouts, I am not sure how that would even be possible with this engine. But, I am no expert.

  • Tekniko - thanks man, that's really good input.

  • Tekniko - sorry for the double post, but I was thinking about what you mentioned. It only loads one level at a time, and destroys everything from previous levels. I don't know if that would effect the memory issue, or if that's what you were referring to.

  • Well, if there are things you want to save... like if a door has been unlocked or locations of moved items, or something along those lines, you could make them Global items or give your objects the Persistent behaviour.

    As for the memory issue. Think of the Alphabet. Currently you need to load A, B, C, D, E, all the way to Z. But, if you make smaller layouts, as I suggested, you only need to load A, B and C. Then when you go to another layout you load E, F, G and so on.

    I know it might sound a little confusing, but if your target device is mobile, then this will really help in the performance area and the sooner you use this method the less work you will have later in development.

  • Well, if there are things you want to save... like if a door has been unlocked or locations of moved items, or something along those lines, you could make them Global items or give your objects the Persistent behaviour.

    As for the memory issue. Think of the Alphabet. Currently you need to load A, B, C, D, E, all the way to Z. But, if you make smaller layouts, as I suggested, you only need to load A, B and C. Then when you go to another layout you load E, F, G and so on.

    I know it might sound a little confusing, but if your target device is mobile, then this will really help in the performance area and the sooner you use this method the less work you will have later in development.

    Thanks Tekniko! I appreciate the input and feedback. I also appreciate your tutorials. Good stuff.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Loading an entire world in a single layout wouldn't be that drastic, but loading every NPC/monster/interactive object most certainly is. Since you mimic Zelda 1 style of exploration (screen per screen scrolling), it shouldn't that hard to populate only the current screen with its active content.

  • Thanks Magistross

    Just to clarify, only 1 screen is populated at a time. When you move around, all of the elements of that original level are destroyed.

  • I was actually giving this some thought based on what Magistross mentioned. You could actually load the entire layout itself at the beginning including all NPC's/Monsters/etc then have them all destroyed unless the player is on the corresponding layout.

    So, basically, you could keep your map in one big layout and your transition effect wouldn't have to be changed at all. The only thing you'd have to add is a Destroy Objects when player leaves area and a Spawn Objects when a player enters an area. Which should be easy to do. Just add triggers at each doorway.

  • Geez sorry i was only suggesting that you might want to add that persaid feature...

  • Geez sorry i was only suggesting that you might want to add that persaid feature...

    Huh?

  • the type writer dialogue boxes... for the rpg...

  • I was actually giving this some thought based on what Magistross mentioned. You could actually load the entire layout itself at the beginning including all NPC's/Monsters/etc then have them all destroyed unless the player is on the corresponding layout.

    So, basically, you could keep your map in one big layout and your transition effect wouldn't have to be changed at all. The only thing you'd have to add is a Destroy Objects when player leaves area and a Spawn Objects when a player enters an area. Which should be easy to do. Just add triggers at each doorway.

    Thanks Tekniko

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