0 Favourites

Dynamic Menu Engine

  • I dislike creating static menus in my projects, so I worked up an engine that reads an XML file, and dynamically creates in-game menus containing components with various functions. So far, I've created components that allow the player to:

    • Open sub-menus
    • Change game settings
    • Re-Map keys
    • Go to a different Layouts
    • Restart the game
    • Go to an external file

    The engine is relatively modular, so other types of interfaces can be implemented without much difficulty. The engine could be extended for dialog boxes, shops, and other window-based system.

    Here is a demo.

    Edit: 4/29: Capx File

  • Nice. I usually just manually make my menus for the game this is quite promising.

  • That's a really nice idea. Would like to see this as a plugin more then a capx file

  • That's a really nice idea. Would like to see this as a plugin more then a capx file

    Agreed, but I'm not sure if/how a plug-in of this nature would fit in C2 editor's architecture.

  • Probably it wont unfortunately. To take all best bits from that kind of plugin it should have some kind of UI interface to let you choose and set all parameters like size/position/look/functionality of buttons and other controls... like a simple drag and drop editor.

    Other idea would be to make external app (should be easily possible to do even in C2) to set all your menus and export them as xml or json. And then plugin could only load that data and setup everything automatically. But still then, plugin should also import and set all graphic assets - very similar to how Spriter loads and sets all from scon files.

    but anyway. This kind of "menu plugin" is really great idea!

  • shinkan

    Agreed, on all points. It would certainly be a handy tool.

  • I still believe in this. C2 could really get some better sdk support. We can only wait for modularity i think.

    btw. how's the progress on capx file? Did you tried using json instead of xml, for me it's a bit more clearer to write and read json files then xmls.

  • shinkan

    Once modularity is implemented, I'm sure an event-based engine like this would become far more useful. I suppose all we can do is wait and see.

    The capx just needs to be cleaned up and commented a bit. I got distracted with Ludum Dare, but I'll post it soon. I don't have much experience with json, but if it's simpler, and can function similarly to XML when loading data, I'd be all for it. I'm not particularly a fan of XML either.

  • This will be a great help as someone who is currently working on menus for my game. I am not familiar with XML but it has to be easier than trying to make one out of events.

  • zatyka not sure how would I describe json so I'll give you two links instead

    http://www.jsoneditoronline.org/ - online json editor. There are two windows and by default, one on the left displays "how your text/json file looks like" and one on the right how it is interpreted.

    https://www.scirra.com/forum/viewtopic.php?f=183&t=100042 - Here's a wonderful plugin made by Yann for json files. You don't need to use this plugin in C2 (it's already supporting json data) but it's a great tool to create, modify and manage data structures

    and here's a little comparison

    XML

    <product>
         <id>15</id>
         <name>Widgets</name>
         <description>These widgets are the finest widgets ever made by anyone.</description>
         <options type="color">
              <item>Purple</item>
              <item>Green</item>
              <item>Orange</item>
         </options>
    </product>[/code:2uzghydi]
    
    and json
    [code:2uzghydi]"product" : {
         "id" : 15,
         "name" : "Widgets",
         "description" : "These widgets are the finest widgets ever made by anyone.",
         "options" : [
              {
                   "type" : "color",
                   "items" : [
                        "Purple",
                        "Green",
                        "Orange"
                   ]
              }
           ]
    }[/code:2uzghydi]
    
    I will not say it's better but for me personally is much easier to read, write and manipulate.
    And obviously you can add, remove, loop and do all kind of manipulations at runtime.
  • This looks so promising, I really hope this works out:)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Capx has been posted.

    shinkan

    Thanks for the links. I hadn't realized that Yann had made a full JSON plugin. It seems relatively straight forward, but would require some reworking of the engine. It's probably worth doing if only for the ability to write to JSON. It would simplify some elements of the engine, and allow menus to be changed at run-time.

  • zatyka

    I do agree that the plugin's interface is a bit clunky and I would have liked for it to be simpler and more straight forward. However, I wouldn't bet on a reworking of the engine anytime soon.

    Hopefully, I do think that with it, you can do everything you can do with a basic javascript object (well almost... you can't copy an object by reference... yet :3)

    In any case, the JSON plugin's topic is always opened for suggestion =)

  • Yann

    I was referring to the Menu engine in the capx I posted.

    I haven't played with your plugin enough to intelligently comment on it, but look forward to taking a closer look at it next time I use the menu engine in a project.

  • Nice one, a little suggestion, when you open options window then put your mouse pointer over the button then press arroy keys, it wont move to another button, it should force to move to another button agaisnt mouse over button.

    I dont know if you can fix.

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