Forum rules - please read before posting.

Level generation in AC

edited March 2016 in Technical Q&A
Hello guys!
I have no experience in Adventure Creator but I'm considering it for my next project. It's gonna be a 2D side-scroller adventure with autogenerated levels, that consist of randomly arranged rooms. This means that there'll be a step on start of every game session, when I have to instantiate those rooms from prefabs. Each room will have a set of navigation grids, cutscenes, triggers, hotspots and all of these things that are usually sorted by different folders in Adventure Creator hierarchy. So I have two noobie questions:
1) Is it neccessary to keep the AC game hierarchy? Can't I just have a number of folders, such as _Room1, _Room2, _Room3 each with the full hierarchy of AC subfolders inside?
If it's not possible, I think, I'll be able to create a script, that will put different parts of the room into the main hierarchy tree. But there is another question:
2) In my game I'll have to instantiate some AC objects on Start of the scene, or maybe during other steps of the game. Won't it brake the AC logic? Will it work? 

Comments

  • edited March 2016
    I forgot to tell you that all of these rooms will be present on a single scene. Like on a picture.
    image
  • 1) Folders are entirely optional.  There's additionally an option in the Scene Manager to avoid the creation of the folder objects in the first place.

    2) For performance, AC keeps an internal record of all scene objects that need updating/referencing during gameplay in the StateHandler script.  This is done automatically when the scene begins, however you will need to run this function manually if you add objects through script.  It's a simple matter of calling:

    AC.KickStarter.stateHandler.GatherObjects ();

    Also, You might encounter issues with save file restoring unless you load in the objects before AC's SaveSystem script's OnLevelWasLoaded function gets called - which I'd imagine you can remedy by altering your script's Script Execution Order.
  • Thank you, Chris!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.