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

Get help using Construct 2

Post » Fri Sep 26, 2014 3:13 am

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.
B
69
S
17
G
9
Posts: 376
Reputation: 8,931

Post » Fri Sep 26, 2014 3:32 am

I am sure you would be wanting to add type writer text effects for the rpg in your game eventually...
B
8
S
2
Posts: 134
Reputation: 1,001

Post » Sun Sep 28, 2014 8:07 pm

Bump - would love some constructive input.
B
69
S
17
G
9
Posts: 376
Reputation: 8,931

Post » Mon Sep 29, 2014 5:40 am

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.
B
56
S
15
G
13
Posts: 825
Reputation: 17,643

Post » Mon Sep 29, 2014 10:20 pm

@Tekniko - thanks man, that's really good input.
B
69
S
17
G
9
Posts: 376
Reputation: 8,931

Post » Mon Sep 29, 2014 10:29 pm

@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.
B
69
S
17
G
9
Posts: 376
Reputation: 8,931

Post » Tue Sep 30, 2014 12:56 am

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.
B
56
S
15
G
13
Posts: 825
Reputation: 17,643

Post » Thu Oct 02, 2014 6:47 pm

Tekniko wrote: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.
B
69
S
17
G
9
Posts: 376
Reputation: 8,931

Post » Thu Oct 02, 2014 7:43 pm

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.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Thu Oct 02, 2014 11:13 pm

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.
B
69
S
17
G
9
Posts: 376
Reputation: 8,931

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests