r/libgdx•
SantidCode

Level screen map

Hello guys, I'm trying to develop a level screen map, something like the one on Candy Crush (see in the bottom).

How do you guys think I should load the level after choosing it from the level map? Having a json and load it from there? Something like {"level":"1", "moves":"20", "goal":"3000"}.

Has anyone developed this or is there any tutorial I could have a look?

https://preview.redd.it/kx0gz3lzcxh51.png?width=466&format=png&auto=webp&s=362186f10a4ae521f2c95ff89f48def6b9d7d564

Posted Aug 19, 2020, 9:06 AM UTC

44
denverdave23•

It comes down to the size of the level data and the performance needs of the application. For the example you gave, you can load hundreds of levels in little time and keep it all in memory. But, if each level requires a lot more storage, and you have a lot of levels, loading them all up front might be prohibitively slow or take too much memory. It really comes down to the circumstances.

2
SantidCodeOP•

What would be the best solution if I wanted to load more storage?

1
denverdave23•

"Best" depends on your game. Most likely, you can just load them all into memory. Try it and see. However, if you want to get fancy..

Have 1 file that defines just the info you need for the map screen. Load that at startup. Then, keep separate files for each level with the details. When you enter a level, load the detail file.

All the files can still be json. Your basic structure still works, just split the files up and load them when needed.

2
madmenyo•

Completely depends how you are creating the levels. If you are creating the levels using your own level editor then you probably want to export as binary. The goals might be seperated and as JSON like you suggested.

How this kinda map works is having a nodes connected by a spline/curve and let the player select the connected nodes. When accepting you load the game screen and load the level (and perhaps assets too) from disk. Look into Kryo for binary (de)serialization, it's pretty fast. If you want/need to keep things readable and text editable go for something like JSON.

1