Well, I am now writing a simple prototype of such converter. It utilyzes lots of my knowledge of stealing data from running RenPy games and decompyling RPYC from RenPy runtime ( see
http://cf.ichan.ru/games/hacks/ ). Noone can parse *.rpy better then RenPy itself, so I have decided to convert RenPy inner structures to WSE, not source code to WSE.
In this thread I am going to post about troubles during convertation.
issue 1 - solved by adding 'z' attribute to each
Color backgrounds, mostly black (aka "#000") are commonly used at RenPy to do scenes like this:
Code:
image bg black = "#000"
...
scene bg black
"I was all alone in the darkness"
At WSE the only colored asset is
, which seems to be always drawn above all the other elements, including
. It would be supergood to find a way to show
above
or support color-based
or something else.
issue 2 - workaround by creating
flag for each asset
Current
and
semantics is different from semantics of RenPy's hide and show: WSE plays show animation each time
is called, even is asset is already shown, and
plays hide animation, even is asset is not shown. RenPy's show and hide does not do this.
There is also no built-in mechanism in WSE to check if image is shown or not. All together it causes some difficulties in fully automated converting complex RenPy games. Even "The Question" sample code with 3 assets only is not too easy.
It would be good to have some less agressive
and
versions. Something like this:
Code:
<show forced="false">
issue 3 - workaround by creating
flag for each asset
Previous problem is strongly related to one more issue: RenPy 'scene' command is similar to 'show', but before that it hides all the other assets. It is hard to support automated conversion of 'scene' commands if there is no built-in way to check, which assets are shown.
A command like
would be a perfect solution to this problem.
I guess there is a workaround for issue 2 and issue 3 by defining
for each asset. Then it is possible to convert every RenPy 'show bg street' line to a group of commands like this:
Code:
<set asset="bg" image="street" />
<show asset="bg" ifvar="is_bg_shown" ifvalue="false" />
<var name="is_bg_shown" value="true" />
Same goes to 'hide bg' line:
Code:
<hide asset="bg" ifvar="is_bg_shown" ifvalue="true" />
<var name="is_bg_shown" value="false" />
I think this is kind of ugly, code becomes less readable. Still, it is possible to live with it.
P.S. The same workaround can be used for converting 'scene' lines. 'scene' = 'hide' for each of all the known assets, then one 'show'. This means that resulting XML can contain really lots of tags if there are lots of assets.
Code:
<hide asset="sprite1" ifvar="is_sprite1_shown" ifvalue="true" />
<var name="is_sprite1_shown" value="false" />
<hide asset="sprite2" ifvar="is_sprite1_shown" ifvalue="true" />
<var name="is_sprite2_shown" value="false" />
...
<hide asset="spriteN" ifvar="is_sprite1_shown" ifvalue="true" />
<var name="is_spriteN_shown" value="false" />
<set asset="bg" image="street" />
<show asset="bg" ifvar="is_bg_shown" ifvalue="false" />
<var name="is_bg_shown" value="true" />
issue 4 - FIXED in 0.3.3
Looks like
Code:
<set ... duration="0">
does not work as expected.
http://rghost.ru/49300249 - here is current work-in-progress version of converted "The question". Right now, i do not convert any effects, so expected behaviour is just to change pictures instantly.
However, commands like
Code:
<set asset="bg" image="lecturehall" />
or
Code:
<set asset="bg" image="lecturehall" duration="0" />
does not work instantly: old image instantly disappears, new image appears slowly.
If i do something like
Code:
<set asset="bg" image="lecturehall" duration="500" />
, i get proper fade animation, old image slowly disappears, new image appears slowly, but that is not what i want right now.
You are right, it's a bug in the function that is responsible for effects, I just fixed it and released a new version:
https://github.com/jsteinbeck/WebStory-E.../tag/0.3.3
As for the hideall command you proposed, I guess that's a good idea. I'll probably add it to version 0.4.
For issue 1: i guess it can be solved using
Code:
<curtain name="white" color="rgba(255,255,255,1.00)" z="0"/>
instead of
Code:
<curtain name="white" color="rgba(255,255,255,1.00)"/>
.
Is it acceptable?
Thanks for releasing 0.3.3 and fixing
Code:
<set ... duration="0">
problem.
As for
, it would be useful only with issue 2, by supporting something like
Code:
<show forced="false">
, because right now they share the same workaround by generating
for each asset. This looks kind of ugly, but works perfectly.
Using the curtain for that is certainly acceptable. It might be a good idea to allow colored background assets, nevertheless.
In the future, there should definitely be a way to check an asset's properties and change them inside of scenes.