[W.I.P] VN3DS Visual Novel Interpreter for 3DS Homebrew

Discussion in '3DS - Homebrew Development and Emulators' started by dfsa3fdvc1, Sep 4, 2015.

  1. dfsa3fdvc1
    OP

    dfsa3fdvc1 GBAtemp Regular

    Member
    215
    94
    Jan 3, 2015
    Albania
    VNDS is a syntax created for the purpose of playing visual novel games on multiple devices. Dozens of popular visual novels such as Fate Stay Night, Ever 17, Saya no Uta have been converted to be VNDS compatible and thus, when this is completed, will be 3DS compatible.

    Here's a GIF of the interpreter fast forwarding though Saya no Uta
    CitraDemo.gif

    What's done:
    Text, cleartext, label/goto, delay, jump, setvar, gsetvar, save/load, "CPU bgload" "CPU setimg", choice selection, IF/FI, random

    what's not done
    Music/sound (ogg loading in LPP is a W.I.P. Crashes quite often right now and been disabled)
    Fadetime
    Start/End colored text

    This is what if/fi conditionals look like in a very conditional heavy scene of Ever 17. Can't even imagine how someone managed to do this in VNDS. Looks like nonsense.
    Future plans.
    Automatic unzipping of .novel and .zip assets
    Clean up all the awful programming.
    GPU rendering to allow imagescaling. VNDS has been widely adopted on Android and other devices with higher res screens than the DS's 256x192. What this means is that newer VNDS ports in some cases aren't actually compatible with DS. This would fix that. This is actually a feature of later LPP commites, only problem is that LPP has problems with GPU rendering JPGs currently. Thinking of on the fly converting the JPGs via CPU into BMP and then GPU rendering and storing the newly converted BMP version. Wonder if that would work... Or just wait for LPP to support GPU JPGS.

    Attached ZIP of latest build of LPP 3ds/3dsx/elf, and the index.lua script which goes on the root of the SD. Obviously I can't distribute the VNs with it so you'd need one of those and it's hardcoded to open /vnds/Saya/script.s02.txt so you'd need to change that. Because there's no GPU scaling you'd need to batch resize all the assets down to 3DS size (mine are at 320x24)
    IDK. Maybe someone smart could help me with the IF/FI thing. This really isn't meant to be playable. Without if/fi support it actually can't get past the main menu. It can display pretty much the whole game, just not make it through the main menu and conditionally move through the script.
     

    Attached Files:

    Last edited by dfsa3fdvc1, Sep 6, 2015
  2. Jwiz33

    Jwiz33

    Banned
    2,654
    1,523
    Jun 5, 2014
    United States
    in the illuminati headquar—I have said too much!
    Glad to see a release for this! Great work
     
  3. TheCruel

    TheCruel Developer

    Banned
    1,351
    2,884
    Dec 6, 2013
    United States
    There will be a loli eroge in 3D. Mark my words!
     
    Zyteus, Seriel, Naked_Snake and 9 others like this.
  4. Konno Ryo

    Konno Ryo gbatemp's clueless butler?

    Member
    158
    162
    Aug 5, 2015
    Canada
    Somewhere?
    Good job:yay:, and keep up the good work, I remember playing Ballad of an Evening Butterfly on my DSTwo, doing it in 3ds mode will be much easer (and less glitchy) than the original NDS version. Btw did you try and use any of the code from the VNDS git?
     
  5. dfsa3fdvc1
    OP

    dfsa3fdvc1 GBAtemp Regular

    Member
    215
    94
    Jan 3, 2015
    Albania
    I did take a peek at the source contained in 1.50 of VNDS for DS.
    But really, the core of VNDS is so simple that I didn't really see much point in reading it. It was just a matter of understand the end result of the few built-in commands and accomplishing that end result.
    I may read up on it for SAV compatibility. Currently my sav format is totally incompatible with other versions.

    Actually reading up on it again definitely helps with IF/FI. I had pretty much the same idea where IF condition evaluated to be false would add +1 to a variable and while that variable was greater than 0, all lines would be not processed but every encounter of FI would subtract -1, which would eventually hit 0 again, signaling the end of nested conditionals. For some reason I thought I'd have to do some sort of recursion as well if the condition was positive but it looks like I can just process as normal which makes a lot more sense. So, this might work :3
     
  6. Arras

    Arras GBAtemp Guru

    Member
    5,878
    2,711
    Sep 14, 2010
    Netherlands
    if you do the false = +1, fi = -1 method, how will you handle something like this?
    if false
    if true
    do something
    fi
    do something else
    fi

    If you just do a naive -1 on every fi (except if value is already 0, obviously), you'd decrease the counter before the "do something else". The easiest solution I can think of right now (there's probably better ones, but hey) is to keep a stack of false/true (0/1) for each respective if, and remove the top one for every fi. As long as there's a false somewhere in the stack, don't execute anything. If you already know a way from reading the VNDS source, you can just ignore this :P
     
  7. dfsa3fdvc1
    OP

    dfsa3fdvc1 GBAtemp Regular

    Member
    215
    94
    Jan 3, 2015
    Albania
    I may have worded my explanation poorly but here's how I think it would work with your example
    line 1: if false (a false condition) nesting += 1
    line 2: would be irrelevant because nesting>0 but since it's IF, nesting += 1
    line 3: Irrelevant because nesting > 0
    line 4: would be irrelevant because nesting>0 but since it's FI, nesting -= 1
    line 5: Irrelevant because nesting > 0
    line 6: would be irrelevant because nesting>0 but since it's FI, nesting -= 1. Nesting is now 0 again, script processing returns to normal.

    and if the initial condition were true it would processes the nesting condition normally and something else line normally as well.

    I'll keep your suggestion in mind but the source of VNDS for DS seems to confirm that it would work.
     
    Last edited by dfsa3fdvc1, Sep 4, 2015
  8. Arras

    Arras GBAtemp Guru

    Member
    5,878
    2,711
    Sep 14, 2010
    Netherlands
    Oh, I see what you meant now. I didn't realize you would increment the counter for every if after a false, even the ones that evaluated to true. You're right, that works just fine.
     
  9. pdapanda

    pdapanda GBAtemp Advanced Fan

    Member
    713
    253
    Nov 19, 2014
    Switzerland
    it seems to be based on ONScripter
     
  10. ravihpa

    ravihpa GBAtemp Advanced Fan

    Member
    605
    242
    Apr 11, 2007
    India
    Aww....I thought Visual Novel Interpreter equaled Hentai Doujin Reader :P
     
    Ammako likes this.
  11. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!

    Member
    3,127
    3,271
    Nov 24, 2014
    Italy
    Bologna
    Nice to see some new project developed using lpp-3ds.

    OGG loading is not a W.i.P. in lpp-3ds.
    Don't know why you get crashes (maybe you try to allocate too big files, remember that 3DS has only 64MB RAM available for homebrews).
    If you need to use big files, you have to use streaming feature but currently if you need loop feature or you write your own loop feature (something which kills the song when it ends and reload it) or you have to temporary use WAV/AIFF files.
    I'm working to fix looping streaming issues with OGG cause is a big issue and also i need to fix it for my projects (TriaAl and RPG Maker for example).
     
  12. dfsa3fdvc1
    OP

    dfsa3fdvc1 GBAtemp Regular

    Member
    215
    94
    Jan 3, 2015
    Albania
    Ah, it might be just user error. It's weird because I've actually gotten some OGGs to play and other OGGs that will totally crash it.

    So here's what I've got.
    It worked with "blood.ogg" which a 3 minute song 2MB in size
    Crashes with "blood2.ogg" which is a 1 second 22kb audio clip

    You're right, I probably am doing something but I'm just not sure what. Attached the 2 Oggs in zip
     

    Attached Files:

  13. jurassicplayer

    jurassicplayer Completionist Themer

    Member
    4,361
    505
    Mar 7, 2009
    United States
    Pantsuland
    Well...I mean the actually dev might make the project himself...
    As for if/fi conditionals it's kind of just doing shit one line at a time. There really isn't much to them. If statement works, continue, otherwise just skip everything until you hit if/fi. Then keep a variable somewhere for the number of fi you still need to skip. The syntax was made to be deadbeat stupid though which is why if/fi conditionals look so funny.

    - Edit -
    From the dev of VNDS:
    Congrats. All my efforts of keeping up with the 3DS scene is now wasted.
     
    Last edited by jurassicplayer, Sep 5, 2015
  14. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!

    Member
    3,127
    3,271
    Nov 24, 2014
    Italy
    Bologna
    Are your audio files both mono files?
     
  15. xXDungeon_CrawlerXx

    xXDungeon_CrawlerXx GBAtemp Maniac

    Member
    1,275
    591
    Jul 29, 2015
    Liverpool
    SEXY!
     
  16. dfsa3fdvc1
    OP

    dfsa3fdvc1 GBAtemp Regular

    Member
    215
    94
    Jan 3, 2015
    Albania
    Here's all the info on them. Also attached them in my previous post if you want to replicate the problem I'm having.
     
  17. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!

    Member
    3,127
    3,271
    Nov 24, 2014
    Italy
    Bologna
    They are both stereo files and you give only one channel :/
    You have to use double channels (like 0x08, 0x09) for stereo files.

    Code:
    void Sound.play(wav_id wav_file, int loop, u32 channel, [u32 channel2]) - Play a loaded sound.
    PS for very little file DON'T use streaming feature (like 1s audio files).
     
    dfsa3fdvc1 likes this.
  18. dfsa3fdvc1
    OP

    dfsa3fdvc1 GBAtemp Regular

    Member
    215
    94
    Jan 3, 2015
    Albania
    Oh wow missed that. Lol. Appreciate the help.
    The other stereo file worked fine so I totally glossed over the documentation thinking it'd work.
     
  19. dfsa3fdvc1
    OP

    dfsa3fdvc1 GBAtemp Regular

    Member
    215
    94
    Jan 3, 2015
    Albania
    I finally got it working. Cleaned up a bunch of problems with earlier stuff that was hindering the very basic solution.
    Working_IFFI.png
    And built some menus which accommodate as many choices as are present
    menus.png

    So I tried changing it and I still get crashes when playing that blood2.ogg
     
    Last edited by dfsa3fdvc1, Sep 5, 2015
  20. BurningDesire

    BurningDesire GBAtemp Psycho!

    Member
    4,964
    5,822
    Jan 27, 2015
    United States
    Behind a screen reading news
    Will Steins gate work with this? As well as Minecraft a true love story