Cross platform C++ engine (with Cocos2DX as graphics engine)

For discussion and support of other visual novel engines.
Message
Author
User avatar
bunny.jessican
Regular
Posts: 47
Joined: Fri May 09, 2014 2:39 pm
Completed: Invisible Apartment
Projects: Angels & Demigods, Invisible Apartment
Location: Slovakia
Contact:

Cross platform C++ engine (with Cocos2DX as graphics engine)

#1 Post by bunny.jessican » Sat Jun 21, 2014 10:50 am

Hi All,

In a separate thread I've mentioned that I've been working on an iOS visual novel engine. The core was actually cross platform done in C++, so now I'm attaching Cocos2DX onto it to go cross platform.

- the sample is at http://codeviewer.org/view/code:411e

I'm attaching a part of the script / the xml which is parsed to create the game. Currently the Invisible Apartment runs on this engine http://invisibleapartment.com

The format is quite flexible in that the pages and scenes are self contained which means that each scene has all the data (parameters) in itself to present it and each page too together with all the effects. I also believe that it's quite simple to understand.

I didn't like the idea of breaking the script down to labels and "e's" and defining all the objects at the beginning as is the way things are done in Ren'py so I made each object in the XML contain all the needed info.

Another advantage is that it's XML and it can be parsed easily by anyone.

On screen choices and jumping inside of the script is done in this way:
- you can jump to any position in the script as long as you label it (you can jump to scopes or scenes) whereas a scope is a collection of scenes, a scene is a collection of pages (each page can have overlays, text, effects, etc.)

Code: Select all

      <choices title="What should the girl do?" default="NO">
                    <choice message="Slowly exit the cafe through the main entrance." action="sco01.00"/>
                    <choice message="Stay where you are." action="sco01.01"/>
                    <choice message="Flee through the kitchen and the back door." action="sco01.02"/>
                </choices>
                
                <scopes>
                    
                    <scope id="sco01.00"> <!-- after this continue with main scope - the sce04 is partially here -->
                        <scenes>
                            <scene id="sco01.00.sce01">
                                <musiclist>
                                    <music filename="">
                                    </music>
                                </musiclist>
                                <widgets>
                                    <image filename="IA_PreWork_Cafe_ver2.jpg"/>
                                    <layer filename="IA_PreWork_Cafe_ver2.jpg" id="l01"/>
                                    <textarea posx="5%" posy="80%" width="90%" height="20%">
                                        <pages>
                                            <page text="She takes a deep breath, slowly stands up from her table and heads to the exit.">
                                                <overlays>
                                                    <overlay filename="IA_CharaPortrait_Kacey_Formal_prev2_glasses.png" posx="0.52" posy="0.2" w="0.45" h="0.80"/>
                                                </overlays>
                                                <actions>
                                                    <action type="layerMove" layerid="l01" mov="-20:+20"/>
                                                </actions>
                                                <musiceffects>
                                                    <musiceffect>
                                                        <music filename="Chair On Wood-SoundBible_com-1968083548.mp3"/>
                                                    </musiceffect>
                                                </musiceffects>
                                            </page>
                                        </pages>
                                    </textarea>
                                </widgets>
                                <onfinish goto="sco01:sce04"/>
                            </scene>
                        </scenes>
                    </scope>
                    
                    <scope id="sco01.01"> <!-- she stays sitting at her table - bad choice, she overestimates herself blending in -->
                        <scenes>
                            <scene id="sce01.01.01">
-

You can define what to do at the end of each scene using

Code: Select all

<onfinish goto="sco01:sce04"/>
whereas the sco01:sce04 is the ID of the place in the script where you'd like to jump to - you can jump anywhere (backwards, forwards)

-

Here's an extract from the Invisible Apartment script:

-

Code: Select all

<script>
    
    <scope id="sco01">
        <scenes>
            <scene id="sce01">
                <musiclist>
        
                    <music filename="_TK_gymnopedie2-2.mp3"/>
                </musiclist>
                <widgets>
                    <layers>
                        
                        <layer filename="IA_PreWork_Cafe_ver2.jpg" id="l01">
                            <effects>
                                <!-- <effect type="endlessScroll"/> -->
                                <effect type="boundaryScroll"/>
                                <!-- <effect type="brightnessFluctuationNO"/> -->
                            </effects>
                        </layer>
                    </layers>
                    <textarea posx="5%" posy="80%" width="90%" height="20%">
                        <pages>
                            <page  text="We find ourselves in one of the business districts of New Jessica.">
                                <actions>
                                </actions>
                                <!--
                                <videoeffects>
                                    <videoeffect>
                                        <video filename="IA5v3mute.mp4"/>
                                    </videoeffect>
                                </videoeffects>
                                -->
                            </page>
                            <page text="Business as usual. Customers are coming in during their lunch break.">
                                <actions>
                                    <action type="layerMove" layerid="l01" mov="-20:+20"/>
                                    <action type="alpha" layerid="l01" alpha="1.0"/>
                                    
                                </actions>
                                <musiceffects>
                                    <musiceffect>
                                        <music filename="Chair On Wood-SoundBible_com-1968083548.mp3"/>
                                    </musiceffect>
                                </musiceffects>
                            </page>
                            <page text="A well dressed girl wearing sunglasses sits in the center of the cafe.">
                                <overlays>
                                    <overlay filename="IA_CharaPortrait_Kacey_Formal_prev3_glasses.png" posx="0.5" posy="0.2" w="0.45" h="0.80"/>
                                </overlays>
                            </page>
                            <!--  who come here during their break -->
                            <page text="She blends in perfectly with the crowd of office workers. With a both confident and sneaky smile on her face she touches her coffee cup with her lips, barely reducing it by a drop.">
                                <overlays>
                                    <overlay filename="IA_CharaPortrait_Kacey_Formal_prev3_glasses.png" posx="0.5" posy="0.2" w="0.45" h="0.80"/>
                                </overlays>
                            </page>
                            <page character="Girl" text="Are we in yet?!
She whispers to herself barely moving her lips.">
                                <overlays>
                                    <overlay filename="IA_CharaPortrait_Kacey_Formal_prev2_glasses.png" posx="0.52" posy="0.2" w="0.45" h="0.80"/>
                                </overlays>
                                <actions>
                                    <action type="layerMove" layerid="l01" mov="+40:-40"/>
                                </actions>
                            </page>
                        </pages>
                    </textarea>
                </widgets>
            </scene>
So you end up with a nice little 'tree' of objects, which you can then parse, edit in many editors. You can position each overlay on each page independently and, you can attach actions to each page to simulate effects like the background shifting position. You can define a scene-wide effect of one layer of the background to be moving from left to right (the scenery behind the window to endlessly scroll).

Multiple layers compose the background:
- this example lets the layer behind the window move (the window layer has an alfa channel)

Code: Select all

<scene id="sce21">
                <musiclist>
                    <music filename="Bad Space.mp3">
                    </music>
                </musiclist>
                <widgets>
                    <image filename="IA_BG_Apartment_All.jpg"/>
                    
                    <layers>
                        <layer filename="Skyline.jpg" id="l01">
                            <effects>
                                <effect type="boundaryScroll"/>
                            </effects>
                        </layer>
                        <layer filename="IA_BG_Apartment_Trans.png" id="l02">
                        </layer>
                    </layers>
I guess that this format I designed + the parser would let anyone do custom visual engines, it would make it easy to port to HTML5 and such. It would also make it easy to do visual editors.

To make a port of the whole thing you should simply be able to know how to position layers on a screen which hold images that have an alfa channel (png images), you should be able to dynamically position text on the screen, play audio and video.

-

You see that the overlays (sprites) are positioned relatively (0.1, 0.9, etc.)
<overlay filename="IA_CharaPortrait_Kacey_Formal_prev3_glasses.png" posx="0.5" posy="0.2" w="0.45" h="0.80"/>
- that would position the sprite at 0.5*width & 0.2*height and the width would be 0.45*width & height would be 0.8*height.

To make sprites in Cocos2DX position according to these attributes I did this:

Code: Select all

struct CMPFRAME {
    CCPoint origin;
    CCSize scale;
};

/**
 0.1 = parent*0.1
 */
struct CMPRELATIVEFRAME {
    CCPoint origin;
    CCSize size;
};

bool setFrameForDynamicSprite( CCSprite *sprite, CMPRELATIVEFRAME relframe )
{
    printf("setFrameForDynamicSprite\n");
    if (!sprite)
        return false;
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();
    
    relframe.origin.y = 1.0f-(relframe.size.height+relframe.origin.y);
    
    // set scale
    
    float scale = 1.0f;
    
    float boxwidth     = s.width*relframe.size.width;
    float spritewidth  = sprite->getContentSize().width;
    float boxheight     = s.height*relframe.size.height;
    float spriteheight  = sprite->getContentSize().height;
    
    // we try to figure out which sides relations to take in account when scaling - we always scale to fit, not fill
    if (
        sprite->getContentSize().height > sprite->getContentSize().width
        )
    {
        printf("    boxheight(%f) spriteheight(%f)\n",boxheight,spriteheight);
        
        if (relframe.size.height/relframe.size.width < sprite->getContentSize().height/sprite->getContentSize().width)
            scale = boxheight / spriteheight;
        else
            scale = boxwidth / spritewidth;
    }
    else
    {
        printf("    boxwidth(%f) spritewidth(%f)\n",boxwidth,spritewidth);
        
        if (relframe.size.height/relframe.size.width > sprite->getContentSize().height/sprite->getContentSize().width)
            scale = boxwidth / spritewidth;
        else
            scale = boxheight / spriteheight;
    }
    
    sprite->setScaleX(scale);
    sprite->setScaleY(scale);
    
    // set position
    
    CCPoint cp = CCPointMake(
                             (s.width*relframe.origin.x)+((s.width*relframe.size.width)/2.0f),
                             (s.height*relframe.origin.y)+((s.height*relframe.size.height)/2.0f)
                             );
    sprite->setPosition(cp);
    
    printf("    position(%fx%f) spriteSize(%fx%f)\n",
           cp.x,cp.y,
           sprite->getContentSize().width*scale,sprite->getContentSize().height*scale);
    
    return true;
}
- this keeps the aspect ratio & positions the sprite based on the attributes from the sprite
Last edited by bunny.jessican on Sat Jun 21, 2014 1:27 pm, edited 2 times in total.

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#2 Post by AxemRed » Sat Jun 21, 2014 12:05 pm

XML is indeed easy to parse, but it's a nightmare to write by hand. If you insist on XML scripts, they can be made far, far less verbose than what you have here.

User avatar
bunny.jessican
Regular
Posts: 47
Joined: Fri May 09, 2014 2:39 pm
Completed: Invisible Apartment
Projects: Angels & Demigods, Invisible Apartment
Location: Slovakia
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#3 Post by bunny.jessican » Sat Jun 21, 2014 12:25 pm

XML is indeed easy to parse, but it's a nightmare to write by hand. If you insist on XML scripts, they can be made far, far less verbose than what you have here.
Yes, the attributes could be defined at the beginning of the script, but actually that's what I didn't like about Ren'py (depends on the person) - I want to be able to have the objects that the script is made of be self-defined. I like when data is like a tree rather than a custom format.

If you browse to any part of the script you know what's going on - you don't need to go to the beginning and check some definitions there. That's what I needed when doing a script.

I learned this approach when doing AFP parsers - each page has all the data in itself to make it render on the screen.

In general there are much much more visual editors & parsers of XML out in the wild.

I agree that you could do a much less verbose XML script, but I don't want to remember that <t> is <textarea> - I rather have 'textarea' and I don't want to remember that <p is 'page' so I rather define <page - again this makes you understand any part of the script without having knowledge of some former definitions. It's self-explanatory. I mean - what's an '<e' ? You wouldn't know without reading some documentation. But if you read <musiceffects> than you know... hey... that's a music effects definition :)

It's not any simpler or human readable to define your own format, than to use something that's already been used a million times like XML - there are endless parsers and processors for it. Also - again - it's better to use real life words for defining objects in a script than just tags.

-

Visual XML editors example:

Image

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#4 Post by AxemRed » Sat Jun 21, 2014 5:30 pm

Keeping definitions local and understandable tag names aren't what's making your XML verbose.

Currently, you have syntax like this:

Code: Select all

<page text="Lorem ipsum dolor sit amet, consectetur adipiscing elit." />
<page text="Praesent convallis nisl sit amet velit ultricies, at placerat lorem cursus.">
  <overlays>
    <overlay filename="IA_CharaPortrait_Kacey_Formal_prev2_glasses.png" posx="0.52" posy="0.2" w="0.45" h="0.80"/>
  </overlays>
  <actions>
    <action type="layerMove" layerid="l01" mov="-20:+20"/>
  </actions>
  <musiceffects>
    <musiceffect>
      <music filename="Chair On Wood-SoundBible_com-1968083548.mp3"/>
    </musiceffect>
  </musiceffects>
</page>
<page text="Proin et nibh ac augue rhoncus auctor ut at tellus." />
<page text="Nullam quis hendrerit dolor."/>
<page text="Nullam laoreet nulla mi, et rutrum odio sodales quis." />
<page text="Proin tincidunt tincidunt sapien, vitae ornare ipsum feugiat nec." />
<page text="Vivamus eu risus pharetra, tempus dolor ac, molestie mauris." />
<page text="Phasellus bibendum urna ligula, eget venenatis metus hendrerit non." />
Also XML:

Code: Select all

<scene>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<img bounds="0.52, 0.2, 0.45, 0.80">IA_CharaPortrait_Kacey_Formal_prev2_glasses.png</img>
<layerMove id="l01" dx="-20" dy="20" />
<music>Chair On Wood-SoundBible_com-1968083548.mp3</music>
Praesent convallis nisl sit amet velit ultricies, at placerat lorem cursus.
Proin et nibh ac augue rhoncus auctor ut at tellus.
Nullam quis hendrerit dolor.
Nullam laoreet nulla mi, et rutrum odio sodales quis.
Proin tincidunt tincidunt sapien, vitae ornare ipsum feugiat nec.
Vivamus eu risus pharetra, tempus dolor ac, molestie mauris.
Phasellus bibendum urna ligula, eget venenatis metus hendrerit non.
</scene>

User avatar
bunny.jessican
Regular
Posts: 47
Joined: Fri May 09, 2014 2:39 pm
Completed: Invisible Apartment
Projects: Angels & Demigods, Invisible Apartment
Location: Slovakia
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#5 Post by bunny.jessican » Sat Jun 21, 2014 5:43 pm

What you've written couldn't be used because each page has also a character definition - a page isn't a line, so you can't separate them in a <scene> just by a newline - because you can have a newline in a <page too>.

You can't just put all page text in a large blob of text and separate them by newline.

By saving a few characters and doing:

Code: Select all

<img bounds="0.52, 0.2, 0.45, 0.80">IA_CharaPortrait_Kacey_Formal_prev2_glasses.png</img>
One must again parse the text of the 'bounds' and not just find them by the name of the attribute.

So in the code I would need to parse the characters of the 'bounds' with the content being static (x is on the first place, y on the second) - that's not a good design decision at all.

Mixing text & attributes is I believe a wrong design decision. You basically break the logic of using XML, because you don't use attributes in XML nodes, but obfuscate them as another format inside of other attributes.

You end up with a mix of XML and a lot of custom formats disguised as node attributes which all need to get parsed.

Code: Select all

<scene>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<img bounds="0.52, 0.2, 0.45, 0.80">IA_CharaPortrait_Kacey_Formal_prev2_glasses.png</img>
<layerMove id="l01" dx="-20" dy="20" />
<music>Chair On Wood-SoundBible_com-1968083548.mp3</music>
Praesent convallis nisl sit amet velit ultricies, at placerat lorem cursus.
Proin et nibh ac augue rhoncus auctor ut at tellus.
Nullam quis hendrerit dolor.
Nullam laoreet nulla mi, et rutrum odio sodales quis.
Proin tincidunt tincidunt sapien, vitae ornare ipsum feugiat nec.
Vivamus eu risus pharetra, tempus dolor ac, molestie mauris.
Phasellus bibendum urna ligula, eget venenatis metus hendrerit non.
</scene>
In this case the parser would need to understand that each page is a line and that all the attributes are mixed up with the text.

You save some space, some characters, but then you make the editor, the script writer mine the attributes in large blobs of text.

I also do that on some places like the movement of layers (+20etc.), but I don't use it everywhere. I actually should do the dx= & dy= you written. Good point. Why define the dx and dy separately while keeping the bounds in a custom format?

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#6 Post by AxemRed » Sat Jun 21, 2014 6:33 pm

>What you've written couldn't be used because each page has also a character definition - a page isn't a line, so you can't separate them in a <scene> just by a newline - because you can have a newline in a <page too>.
You can also encode newlines in text with "\n" or with a <br/> tag. I don't understand why each page of text needs to have a character definition, and I also don't see any character definitions inside the pages in your example code.

>You can't just put all page text in a large blob of text and separate them by newline.
Why not? If you really hate the idea of treating newline as a special character, just add <w/> tags after each line.
One must again parse the text of the 'bounds' and not just find them by the name of the attribute.

So in the code I would need to parse the characters of the 'bounds' with the content being static (x is on the first place, y on the second) - that's not a good design decision at all.

Mixing text & attributes is I believe a wrong design decision. You basically break the logic of using XML, because you don't use attributes in XML nodes, but obfuscate them as another format inside of other attributes.

You end up with a mix of XML and a lot of custom formats disguised as node attributes which all need to get parsed.
You make a really big deal out of a comma-separated list in an attribute. Something you yourself also do in your example code (the layerMove action). Just pretend I wrote it with separate x/y/w/h attributes, it makes no difference to my main argument.

What's wrong with something like this?

Code: Select all

<scene>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.<w/>
<img x="0.52" y="0.2" w="0.45" h="0.80">IA_CharaPortrait_Kacey_Formal_prev2_glasses.png</img>
<layerMove id="l01" dx="-20" dy="20" />
<music>Chair On Wood-SoundBible_com-1968083548.mp3</music>
Praesent convallis nisl sit amet velit ultricies, at placerat lorem cursus.<w/>
Proin et nibh ac augue rhoncus auctor ut at tellus.<w/>
Nullam quis hendrerit dolor.<w/>
Nullam laoreet nulla mi, et rutrum odio sodales quis.<w/>
Proin tincidunt tincidunt sapien, vitae ornare ipsum feugiat nec.<w/>
Vivamus eu risus pharetra, tempus dolor ac, molestie mauris.<w/>
Phasellus bibendum urna ligula, eget venenatis metus hendrerit non.<w/>
</scene>

User avatar
bunny.jessican
Regular
Posts: 47
Joined: Fri May 09, 2014 2:39 pm
Completed: Invisible Apartment
Projects: Angels & Demigods, Invisible Apartment
Location: Slovakia
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#7 Post by bunny.jessican » Sat Jun 21, 2014 6:44 pm

The fact that there are no newlines in the part of the script I posted online doesn't mean that there are non in the rest of the script :) In any case.

There is something like overlays in pages:

Code: Select all

<page text="A well dressed girl wearing sunglasses sits in the center of the cafe.">
                                <overlays>
                                    <overlay filename="IA_CharaPortrait_Kacey_Formal_prev3_glasses.png" posx="0.5" posy="0.2" w="0.45" h="0.80"/>
                                </overlays>
                            </page>
and there are sound effects in pages, etc. A page isn't just the text, so you can't make a page a line of text in a scene.

Yes - I also use at some parts of the script things like "+20:-20" etc. and I said in my last reply that you're right at that part and I should actually change that.

But your example ignores some things. You're defining a page as just text and separating it with a newline.

So you propose adding '\n' and <br>, but then separating the text inside of the xml nodes with a real newline in the text itself? That's not good.

Ignoring parts of the script I posted by proposing something which doesn't take in account half of the XML nodes and attributes that are in the example is an excuse to make your own proposal. If you would take them into account than you couldn't propose the format you did.

Code: Select all

<scene>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.<w/>
<img x="0.52" y="0.2" w="0.45" h="0.80">IA_CharaPortrait_Kacey_Formal_prev2_glasses.png</img>
<layerMove id="l01" dx="-20" dy="20" />
<music>Chair On Wood-SoundBible_com-1968083548.mp3</music>
Praesent convallis nisl sit amet velit ultricies, at placerat lorem cursus.<w/>
Proin et nibh ac augue rhoncus auctor ut at tellus.<w/>
Nullam quis hendrerit dolor.<w/>
Nullam laoreet nulla mi, et rutrum odio sodales quis.<w/>
Proin tincidunt tincidunt sapien, vitae ornare ipsum feugiat nec.<w/>
Vivamus eu risus pharetra, tempus dolor ac, molestie mauris.<w/>
Phasellus bibendum urna ligula, eget venenatis metus hendrerit non.<w/>
</scene>

If each line is representing one of my <page> nodes, than how would you define different overlays for each page? Or effects per page? In the text lines? So the parser would take in account the lines of text and check what attributes are right after them? That breaks the way how XML should be designed.

User avatar
2dt
Regular
Posts: 110
Joined: Wed Jan 08, 2014 12:43 am
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#8 Post by 2dt » Sat Jun 21, 2014 9:11 pm

AxemRed, pages describe all the animation/changes that are supposed to happen, not just the text. What you're proposing is trying to force it to behave more like Ren'py, which isn't bad in and of itself, problem is it ASSUMES that's the kind of behavior the developer wants, which isn't always true. Of course, the result of this is that there's quite a bit of verbosity added, but it's important to adhere to the predefined XML structure, to guarantee that it can be parsed intuitively and accurately.

bunny.jessican, I understand the desire to make every scene/page self-defining and readable (definitely makes life easier as the engine writer, and easier to debug thanks to that "purity"), but I find that comes at a cost of making a lot of the code very redundant and inflexible. A lot of the sample XML code is just you redefining "<overlay filename="IA_CharaPortrait_Kacey_Formal_prev3_glasses.png" posx="0.5" posy="0.2" w="0.45" h="0.80"/>" over and over again. This is fine for simple visual novels, but you can imagine that with complex scenes with many elements and animations this would get old real quick. An even bigger issue, as far as I can tell (please correct me if I'm wrong), is that if for example you want to modify the position of a character in a given scene, you'd have to go back and change every single one of those overlay definitions.

Also, is there a way to define/access custom variables (like scores or points? character names?) or manipulate control logic? I realize XML is not a programming language, but in my research it is possible to make data languages describe programming logic (I managed to do it with JSON, so I'm betting it would be a cakewalk with XML)

User avatar
AxemRed
Veteran
Posts: 482
Joined: Sun Jan 09, 2011 7:10 am
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#9 Post by AxemRed » Sun Jun 22, 2014 2:19 am

2dt wrote:AxemRed, pages describe all the animation/changes that are supposed to happen, not just the text. What you're proposing is trying to force it to behave more like Ren'py, which isn't bad in and of itself, problem is it ASSUMES that's the kind of behavior the developer wants, which isn't always true. Of course, the result of this is that there's quite a bit of verbosity added, but it's important to adhere to the predefined XML structure, to guarantee that it can be parsed intuitively and accurately.
The same information is expressed in my version, there's no change in behavior. The big difference is writing a list as [a,b,c] instead of [((a)())((b)())((c)())]. You can programmatically transform back and forth between the different styles of representation.

User avatar
Shiz
Newbie
Posts: 18
Joined: Tue Jun 05, 2012 8:35 pm
Projects: Twofold
Organization: Salty Salty Studios
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#10 Post by Shiz » Sun Jun 22, 2014 10:30 am

Can we like, as a community, decide to not use bullshit like XML as an end-user script format?

No, I'm not fucking writing your parse tree for you, I'm not gonna write in 20 lines with tags everywhere that could be done in 5, it's not more readable, and last time I checked I'm not a computer so parsing it easily programatically is not my concern as a script writer.
My concern is concisely writing a script that is as natural for me to write as possible, where I don't feel the format gets in my way, and XML is everything except that.

Code: Select all

Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17)
>>> 'Code' > 'Drama'
False

User avatar
bunny.jessican
Regular
Posts: 47
Joined: Fri May 09, 2014 2:39 pm
Completed: Invisible Apartment
Projects: Angels & Demigods, Invisible Apartment
Location: Slovakia
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#11 Post by bunny.jessican » Sun Jun 22, 2014 11:26 am

Ok, then lets just create custom formats which aren't understood by any text editor. Ok. Good point.

Again - there are a million editors that understand XML.

User avatar
Shiz
Newbie
Posts: 18
Joined: Tue Jun 05, 2012 8:35 pm
Projects: Twofold
Organization: Salty Salty Studios
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#12 Post by Shiz » Sun Jun 22, 2014 11:43 am

I'm not a text editor, I'm a person that writes a story. I'd argue my understanding of a script is way more important than a text editor's.
Having text editor supports just changes XML from a turd to a turd with syntax highlighting.

Code: Select all

Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17)
>>> 'Code' > 'Drama'
False

User avatar
bunny.jessican
Regular
Posts: 47
Joined: Fri May 09, 2014 2:39 pm
Completed: Invisible Apartment
Projects: Angels & Demigods, Invisible Apartment
Location: Slovakia
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#13 Post by bunny.jessican » Sun Jun 22, 2014 11:56 am

It's not only about syntax highlighting. With a visual editor you'd have each object as a separate 'bubble' let's say. By having the whole script be broken down into objects you'd have the flexibility of moving them around, experimenting with positioning rather than just copy-pasting text.

When I write a story I first write it into a simple file and then rewrite it into the script format - like many people I believe. I wouldn't want to write it into the end format directly. That's mental.

But I want to have more flexibility when working with the end format. I wanted to be able to parse it, process it, visualise it, etc. I have a million tools to help me with JSON, XML, etc. I don't want to just scroll through a large text file :)

It's not 1995

User avatar
Shiz
Newbie
Posts: 18
Joined: Tue Jun 05, 2012 8:35 pm
Projects: Twofold
Organization: Salty Salty Studios
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#14 Post by Shiz » Sun Jun 22, 2014 12:02 pm

bunny.jessican wrote:It's not only about syntax highlighting. With a visual editor you'd have each object as a separate 'bubble' let's say. By having the whole script be broken down into objects you'd have the flexibility of moving them around, experimenting with positioning rather than just copy-pasting text.
Any GUI editor that has any chance of succeeding as an effective tool would have to be custom for the engine anyway. What use is a graphical editor if you can't preview how it looks in-engine? How useful is it if it doesn't have a list of characters for auto-complete? How relevant is it if it doesn't provide help for creating GUIs? Writers like to primarily write, not fiddle around with GUI tools if they aren't even particularly effective.
bunny.jessican wrote:When I write a story I first write it into a simple file and then rewrite it into the script format - like many people I believe. I wouldn't want to write it into the end format directly. That's mental.
Only if your script format is mental. Like XML. You're basically admitting that here.
bunny.jessican wrote:But I want to have more flexibility when working with the end format. I wanted to be able to parse it, process it, visualise it, etc. I have a million tools to help me with JSON, XML, etc. I don't want to just scroll through a large text file :)
So you distribute a library along with your engine for parsing the file format. Like I said above, any kind of tool that does most likely already has to be customized for the engine anyway to be effective in any shape.
bunny.jessican wrote:It's not 1995
Then why are you advocating practices and formats directly from 1995?

Finally, even if these all were valid points, they still don't beat the convenience of writing in a natural script, without first writing in something else and then converting it to another format and hope it works, spending a lot of time and effort in the process. I'd wager less people care about non-engine script analysis than about just writing effectively. It is a visual novel engine, after all.

Code: Select all

Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17)
>>> 'Code' > 'Drama'
False

User avatar
bunny.jessican
Regular
Posts: 47
Joined: Fri May 09, 2014 2:39 pm
Completed: Invisible Apartment
Projects: Angels & Demigods, Invisible Apartment
Location: Slovakia
Contact:

Re: Cross platform C++ engine (with Cocos2DX as graphics eng

#15 Post by bunny.jessican » Sun Jun 22, 2014 12:08 pm

The format of Ren'py is a natural script? Ok, I'm writing that down.

The whole development should be heading towards creating visual tools which would parse the VN scripts. I'd appreciate some visual editors, not just editors, but software with which I could do more than just edit text.

If someone would provide these for me for the format of Ren'py than that would be awesome. I don't want to just have an editor with syntax highlighting to pop up.

That's the reason for a custom XML format. I want to use the tools that are already out there.

You again and again write that XML is not readable. It isn't. Once you load it or start working with it in one of the editors out there, some that are a bit better than the 'XML' part gets hidden.

Working around 'labels' and 'e:'s and such is more insane. That's not natural :)

Code: Select all

label features:

    $ save_name = "Features"

    e "By providing a range of useful features, we let game authors
       focus on writing their games."

    e "What are some of these features? Well, first of all, we take
       care of displaying the screen, as well as dialogue and menus."

    e "You can navigate through the game using the keyboard or the
       mouse. If you've gotten this far, you've probably figured that
       out already."

    e "If you press 'f', you can toggle fullscreen mode. Pressing 'm'
       will toggle music on and off."

    e "Right-clicking or pressing escape will bring you to the game
       menu."

    e "The game menu lets you save or load the game. Ren'Py doesn't
       limit the number of save slots available. You can create as
       many slots as you can stand."
making a 'label' a parent of the text paragraphs of your script is not natural. It breaks the MVC logic. You mix UI and data.

How is that format 'modern'.

Post Reply

Who is online

Users browsing this forum: No registered users