- Home /
Creating modular 2d platforming levels?
I'm making a platformer, but I've started considering making the levels modular.
I'd like to make 10 sections of a 2d platforming level, pick 5 of the sections and place them in random order to create a seamless level.
Any suggestions on where to get started? How to store the level/section data? ScriptableObjects? Prefabs? I haven't been able to find any good resources on the topic.
Answer by EXZ_EXZ · Jun 05, 2018 at 01:35 PM
Just a Student myself, but i'd like to give it a try: - You could store level informations (like object/environment positions) in a scriptable object and call them upon building the level -> furthermore you could randomize these information for even more diversity - You could build entire sections by hand and store them as a prefab - Or you could just build the entire level based on an algorythm ... this would make sections obsolete but requires a hell of inspection
I'm considering something like that. $$anonymous$$y general idea is to make each section into a single prefab, and store it in a ScriptableObject together with a StartNode, EndNode, etc. It seems much quicker than storing each single GameObject as a SO.
Can't tell if it's a good idea or not though..
seems like overkill to me ... why not craft your sections, store them as prefabs - in Resources for example - and attach something to it that stores information about compatibility with the other sections. then you write something that "builds" the world but checks for compatibility first?! something like "last ground height was x" -> add next section at this height
there is a unity tutorial about dungeon generation (2D) maybe this gives you some insight about modular generation :) https://unity3d.com/de/learn/tutorials/topics/scripting/basic-2d-dungeon-generation