Option 1: Make a copy and trim it
- Copy the project
- Remove the unneeded parts
- Compile the demo
Option 2: The demo is hidden in the full game
- Set a demo boolean to true
- Modify the game so it takes that boolean into account
- Compile the demo
Option 3: Automatically trim the code before compilation
Even without modifying ZGameEditor, there could be a way to mark parts of the code as needed for the demo. Then I could run a bat script (or add that option to ZgeSublime) to automatically copy the project and remove the unneeded code before compiling the demo. It’s not the simplest option, but once it's set up, I would be able to update the full game and generate a new demo in seconds.
So I'm looking for a way to mark the necessary parts (or mark the unneeded parts instead).
Here's a template code:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
<OnLoaded>
<ZExpression Name="code" Comment="code intro" DesignDisable="255" Expression="trace("Hello");"/>
</OnLoaded>
</ZApplication>
That leaves me two options:
Using Comment
The first character of the element’s Comment could be used to mark whether it’s needed for the full game or the demo. My program would recognize that without touching ZGameEditor sourcecode.
Using DesignDisable
When checked, this option sets the value 255 for the element’s DesignDisable. Maybe I could use this. The problem is that once it’s set, the component is disabled in preview mode.
I tried changing the 255 to another value directly in the XML, say 1. This value is not deleted or converted back to 255 when returning to ZGameEditor, which is nice, but the component is still considered disabled in preview mode. I could use that, but it would require modifying ZGameEditor so that components are disabled only when the value is exactly 255, leaving 254 other possible values for custom use
All the components has the Comment and DesignDisable options so it could be quite handy.
What do you think? Or are there other, better, methods to do this?
