Author Topic: vibeo game???  (Read 62223 times)

vgperson

  • Cutest
  • ****
  • Posts: 258
  • Cutes: 110
  • guess i'll have to... make them fall.
    • View Profile
    • vgperson.com
Re: vibeo game???
« Reply #60 on: February 03, 2017, 07:02:24 AM »
Libretta's text system isn't too complex, but some of the scripts (like dynamic movement that depends on your position going into a scene) got complicated - though the main cause of that was I was too lazy to make convenient functions for things. Loverinth is using more a streamlined version (partly by necessity, since I can't just use execute_string anymore).

In Libretta, checkable objects (objReadable) have a "text" variable (but I'll call it myScript to be less confusing) defined in their creation code, which is the script that's run when they get checked. Specifically, Libra tries to run User Event 0 for whatever's in front of her; User Event 0 in objReadable creates an objTextbox and sends over myScript and some other things. (The same applies for stepping onto a new tile and User Event 1, utilized by objTriggers.)

Each line of a script is either a message, or it's an action. Messages are plain, actions start with a \ or /. ("\" executes code in the context of objTextbox, "/" executes it in the context of the objReadable. objTextbox also has a "parent" variable to refer to that object when necessary.) Messages cause the textbox itself to appear and type that message, and when you advance the message, the next line of myScript gets read (it just keeps removing the first line until it's empty). Actions just execute_string() whatever you put, then continue to the next line unless they ran something that told them to wait. There's wait() which sets an alarm for when to advance the script, and external objects (like a few which display choices) that tell objTextbox to advance when they're done.

There were two big weird things I could do with this system: insert variables into text just by going "myScript = string_replace(myScript, "REPLACE", variable)", and handle branching by doing stuff like "\if global.choice == 1 { myScript = parent.anotherScript }". Most objects not only define myScript in their creation code, but also a myScript2, myScript3, etcetera, which can be switched between by updating "myScript", since that's effectively just the active script. (Since the myScript variable gets copied over to objTextbox at the start, the objReadable's original definitions don't get altered.) Oh yeah, and for the midway closing thing, it basically just backs up the current variables in the objReadable to resume from later.

Anyway, that was a bit messy, so Loverinth instead reads external text files which are broken up into "pages" (labeled by <Header>s) that can be jumped between, storing the script contents in a proper data structure (a Script which contains ScriptPages which contain lines as strings). It also has to be able to actually parse actions, including conditionals. And the textbox drawing function supports simple tags in text (pretty much BBcode style) for things like partial color and wavy text, rather than only having "textbox options" that affect the whole message like Libretta. (There are still some options, like for centered text.)

EDIT: And for posterity: Nakko-Bazookie only supports passing a series of messages to a textbox ("Nakko: Rockets!" ": I'm the narrator."), and all actions in-between are done using cutscene objects with counters that wait for the current textbox to finish. So yeah.
« Last Edit: February 03, 2017, 07:19:53 AM by vgperson »

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: vibeo game???
« Reply #61 on: February 03, 2017, 07:29:56 AM »
ohh so in libretta u managed to avoid actually storing your text in a tree-like data structure using execute_string shenanigans....

i ran into a silly problem where originally each npcs text was just stored in a list, then when i tried to add conditionals i realized that if i want to have dialogue trees, the text probably needs to actually be stored.... in tree format....

so i worked out this complicated bullshit system where you type something like (in the instance creation code)
Code: [Select]
txt("hello....")
t_if(condition)
  txt("the condition is true")
t_else();
  txt("the condition is false")
t_fi();
and all those function calls somehow set up this awful message tree structure made of a billion nested ds_lists by using two or three stacks to shunt nodes around and i have no idea how it works. then when you talk to the npc it triggers a user event that traverses the tree until it reaches a branch, dumps all the messages it passed into a textbox, waits for the textbox to close to evaluate the branch condition, and repeats until it hits a leaf...... its probably worse than it sounds
~Without love, the truth cannot be seen~

this is watermelon :watermelon: put her in your signature so she can achieve world domination

vgperson

  • Cutest
  • ****
  • Posts: 258
  • Cutes: 110
  • guess i'll have to... make them fall.
    • View Profile
    • vgperson.com
Re: vibeo game???
« Reply #62 on: February 03, 2017, 07:41:32 AM »
Yeah, going super-recursive isn't necessary the way I got Loverinth's conditionals working. It just reads linearly in the current page and uses this logic:

- Reading \if [condition]? Check condition. If true, continue on; if false, skip ahead to corresponding \else.
- Reading \else? Must have been in a true block, so skip to corresponding \end.
- \end does nothing when read.

Nesting is possible by using a counter when doing the skipping - added to for each \if encountered, subtracted from for each \end - that must be at 0 before it stops.

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: vibeo game???
« Reply #63 on: February 03, 2017, 07:44:03 AM »
actually i guess technically its just some kind of graph and not always a tree...... yeha storing things in "pages" that u jump between is a cool idea & seems much simpler..... my text system is too working currently to try to redo it tho
~Without love, the truth cannot be seen~

this is watermelon :watermelon: put her in your signature so she can achieve world domination

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: vibeo game???
« Reply #64 on: February 03, 2017, 07:50:58 AM »
or maybe.... because i dont even understand my own text system very well that means i should replace it with a better one asap.... hmm
~Without love, the truth cannot be seen~

this is watermelon :watermelon: put her in your signature so she can achieve world domination

SquareWheel

  • Administrator
  • Cutester
  • *****
  • Posts: 802
  • Cutes: 139
    • View Profile
Re: vibeo game???
« Reply #65 on: February 03, 2017, 07:53:52 AM »
Is it Good Enough?

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: vibeo game???
« Reply #66 on: February 03, 2017, 08:02:15 AM »
vg how did u do actions without execute_string? my method is like, when a textbox reads the tag <act:action_id>, it calls this function thats just a huge switch statement which implements the action for each id..... idk if theres a better way

conditionals work in a similar way, i pass in a condition_id to the if function, and theres a big ass switch statement where all the condition checking codes are implemented
~Without love, the truth cannot be seen~

this is watermelon :watermelon: put her in your signature so she can achieve world domination

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: vibeo game???
« Reply #67 on: February 03, 2017, 08:07:47 AM »
Is it Good Enough?
well its currently functional.... but im worried that if i decide to replace it eventually, i will have to reformat all the text in the game, & that will be really annoying unless i do it early when there isnt much text....
~Without love, the truth cannot be seen~

this is watermelon :watermelon: put her in your signature so she can achieve world domination

vgperson

  • Cutest
  • ****
  • Posts: 258
  • Cutes: 110
  • guess i'll have to... make them fall.
    • View Profile
    • vgperson.com
Re: vibeo game???
« Reply #68 on: February 03, 2017, 08:24:21 AM »
It reads in an action line like "\wait(30)", parses that string to get the command "wait" and the argument "30," and then passes the command and arguments to a doAction function which does the action for the given command. (The arguments are an array, since there can be multiple, like "\anim(Fayre, Nod)".) So it basically just implements all the functions I could need so as to approximate executing strings. I was basically thinking "well, I want to do it the same way as when I could execute strings freely, so I'd better make a parser that lets me basically do that," and I feel it's the best way in the long run.

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: vibeo game???
« Reply #69 on: February 03, 2017, 08:32:56 AM »
yeha that sounds sort of like a more elegant version of what im doing (actions dont support arguments yet but conditionals do)..... cool :honeydew:
~Without love, the truth cannot be seen~

this is watermelon :watermelon: put her in your signature so she can achieve world domination

hubol

  • Cutesterest
  • ******
  • Posts: 1135
  • Cutes: 630
    • View Profile
    • hubolhubolhubol
Re: vibeo game???
« Reply #70 on: February 03, 2017, 10:38:42 PM »
this all sounds like the least amount of fun......

if gm has unlimited user_events now then i would just make a new object for each conversation and the user_events can be text display/action.....

in java i just make a stupid Queue of Runnable (lambda functions) and enqueue more things as appropriate and dequeue things whenever an action ends or a message has been read

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: vibeo game???
« Reply #71 on: February 04, 2017, 06:54:30 AM »
theres still only 16 or whatever user events..... if i did a new object for each conversation id have to just have a folder of a billion objects & i would get them confused probably, i think its better to have a generic npc parent object that u can pass conversation scripts into somehow
~Without love, the truth cannot be seen~

this is watermelon :watermelon: put her in your signature so she can achieve world domination

LOC

  • Cutey
  • **
  • Posts: 7
  • Cutes: 2
    • View Profile
Re: vibeo game???
« Reply #72 on: February 04, 2017, 07:42:30 AM »
hi-TA! how do i do a physics in gamemaker?? specifically gradually increasing momentum as long as no block is hit or the direction isnt let go? i want to make a masterpiece but i dont know how to do !  T H A N K S  L U V S! <3

Qua!

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: vibeo game???
« Reply #73 on: February 04, 2017, 08:12:19 AM »
basic idea is to do something like this
Code: (create event) [Select]
acceleration=0.3;
Code: (step event) [Select]
if keyboard_check(vk_left) {
   hspeed -= acceleration;
}
if keyboard_check(vk_right) {
   hspeed += acceleration;
}
that will make your momentum gradually increase but it doesnt handle stopping when you hit a block. there are many ways to handle collision and it can be simple or very complex depending on your needs
~Without love, the truth cannot be seen~

this is watermelon :watermelon: put her in your signature so she can achieve world domination

LOC

  • Cutey
  • **
  • Posts: 7
  • Cutes: 2
    • View Profile
Re: vibeo game???
« Reply #74 on: February 05, 2017, 07:10:47 PM »
wow thats a miracle    :watermelon: thanks a million  :apple: :orange: :strawberry: :pineapple: :pear: :lemon: :raspberry: :clementine: :grape: :mango: :tomato: :broccoli: :carrot: :cucumber: :rutabaga: :chili: