Author Topic: npc text scripting  (Read 12785 times)

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: npc text scripting
« Reply #15 on: August 28, 2018, 01:28:35 AM »
i think early versions of joogle had separate objects for every npc, which lets you use gml to describe the structure of conversations, but thats really unpleasant compared to a single configurable object
~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: npc text scripting
« Reply #16 on: August 28, 2018, 01:53:21 AM »
I thought that wasn't true, but it turns out you're right. (And those objects are still sitting in the final version for some reason?) That was Mitch's approach before I made it into the latter, which means they were also using show_message, which did... technically accomplish the "pausing until advancement" functionality.

My approach was also very messy. It had a "text" array containing the textbox messages, as well as an "act" array (except for some reason this one isn't an actual array: execute_string is used to find a variable named actX, where X is the line number??? Literally why could that not have been an array) which is executed by execute_string when each message box is shown. The latter could make branches happen by literally setting the "text" array to different messages. Libretta had a vaguely similar approach to branches, but like... a lot better than that.

Oh yeah, and Nakko-Bazookie did cutscenes in their own objects with an incrementing "stage" variable to accomplish actions between sets of messages (i.e. create text object with series of messages and set stage = 1; if object no longer exists && stage == 1, perform an action and set stage to 2...), but there were few enough that it wasn't so bad.

There were also Dabomstew's Pokemon fangame(s), which drew messages to the screen outside of the Draw function (which normally means it disappears in a frame or something)... then immediately "froze" the screen with a keyboard_wait loop before it would update again. Which is the true galaxy brain solution.
« Last Edit: August 28, 2018, 02:01:45 AM by vgperson »

hubol

  • Cutesterest
  • ******
  • Posts: 1135
  • Cutes: 630
    • View Profile
    • hubolhubolhubol
Re: npc text scripting
« Reply #17 on: August 28, 2018, 12:20:04 PM »
Also, didn't know you were the person leaving typo reports on raocow's JIGGLY ZONE LP. The Mystery is Solve'd

i really appreciated that person's efforts--still working on the patch

wilde32

  • Cuter
  • ***
  • Posts: 237
  • Cutes: 24
    • View Profile
  • Pronouns: Consider replacing your battery.
Re: npc text scripting
« Reply #18 on: August 29, 2018, 03:02:06 PM »
I thought that wasn't true, but it turns out you're right. (And those objects are still sitting in the final version for some reason?) That was Mitch's approach before I made it into the latter, which means they were also using show_message, which did... technically accomplish the "pausing until advancement" functionality.

My approach was also very messy. It had a "text" array containing the textbox messages, as well as an "act" array (except for some reason this one isn't an actual array: execute_string is used to find a variable named actX, where X is the line number??? Literally why could that not have been an array) which is executed by execute_string when each message box is shown. The latter could make branches happen by literally setting the "text" array to different messages. Libretta had a vaguely similar approach to branches, but like... a lot better than that.

Oh yeah, and Nakko-Bazookie did cutscenes in their own objects with an incrementing "stage" variable to accomplish actions between sets of messages (i.e. create text object with series of messages and set stage = 1; if object no longer exists && stage == 1, perform an action and set stage to 2...), but there were few enough that it wasn't so bad.

There were also Dabomstew's Pokemon fangame(s), which drew messages to the screen outside of the Draw function (which normally means it disappears in a frame or something)... then immediately "froze" the screen with a keyboard_wait loop before it would update again. Which is the true galaxy brain solution.

warning: show_message crashes the game on some computers if you're in fullscreen mode. thanks game maker.

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: npc text scripting
« Reply #19 on: August 30, 2018, 09:11:47 PM »
like, in studio or the older versions? i think they say not to use show_message in studio except for debugging purposes or something but i didnt know it was that bad
~Without love, the truth cannot be seen~

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

wilde32

  • Cuter
  • ***
  • Posts: 237
  • Cutes: 24
    • View Profile
  • Pronouns: Consider replacing your battery.
Re: npc text scripting
« Reply #20 on: September 01, 2018, 08:21:39 PM »
yeah, studio.


Maxwelltew

  • Lil' Cutey
  • *
  • Posts: 1
  • Cutes: 0
    • View Profile
    • sunburstshelties
  • Pronouns: sunburstshelties
npc text scripting
« Reply #21 on: September 28, 2018, 06:52:32 AM »
Are you sure that is how it is? I am not seeing that. And Searching the text I dont see it either. I just downloaded it from the patcher again and dont see it in that version either.

Ive attached the version from the patcher.

Silat

SquareWheel

  • Administrator
  • Cutester
  • *****
  • Posts: 802
  • Cutes: 139
    • View Profile
Re: npc text scripting
« Reply #22 on: September 28, 2018, 11:17:07 AM »
I'm pretty sure this is a spambot but I don't understand why it is.  Think I'll leave it.

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: npc text scripting
« Reply #23 on: October 01, 2018, 02:30:12 AM »
hey Maxwelltew did you hear about my new game dance of the flower princess? love-game.net/flowerprincess (windows version at love-game.net/flowerprincess.zip)
~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: npc text scripting
« Reply #24 on: October 01, 2018, 03:43:05 AM »


Hey I Love Touhou

I could definitely get a perfect score eventually, but I'm a busy hime, so I'll stop there for now... maybe.

juner

  • Cuter
  • ***
  • Posts: 172
  • Cutes: 101
    • View Profile
Re: npc text scripting
« Reply #25 on: October 01, 2018, 10:15:45 AM »
a good game with good patterns and good tunes!

i managed to get a perfect on each individual phase except for lava. found with flowers that sitting on the very bottom of the level and just watching out for diagonal petals worked p wel

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: npc text scripting
« Reply #26 on: October 03, 2018, 01:11:05 AM »
thank's for playing everone..... :honeydew:

i have an unrelated question for vg..... how do you make pixel art not look bad in unity? like no compression or filtering + no weird artifacts like a line appearing on the side of the sprite sometimes + everything scaled by integers..... i think i know some of the steps but not all of them. in particular its a complete mystery to me how you set up the camera
~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: npc text scripting
« Reply #27 on: October 03, 2018, 03:31:52 AM »
1. Set the orthographic size of your main camera based on the base screen height. I don't remember exactly what this code is supposed to signify... but it works!

Code: [Select]
camera.orthographicSize = SCREENHEIGHT / 2.0f;
Setting resolution with Screen.SetResolution should just scale up properly. You may also have to ensure the Z position of your camera object is right, considering that my camera code sets the position as "(x, y, -10)" while everything else is at Z = 0.

2. Have all textures use Point filter mode, and maybe some other things. You can add an class that inherits AssetPostprocessor to your project to automatically override texture settings on import.

Code: [Select]
public class TexturePostProcessor : AssetPostprocessor
{
    void OnPreprocessTexture()
    {
        TextureImporterSettings settings = new TextureImporterSettings();
        TextureImporter importer = assetImporter as TextureImporter;
       
        importer.ReadTextureSettings(settings);
        settings.spriteAlignment = (int)SpriteAlignment.TopLeft;
        importer.SetTextureSettings(settings);
       
        importer.textureType = TextureImporterType.Advanced;
        importer.isReadable = true;
        importer.spritePixelsPerUnit = 1;
        importer.spritePivot = new Vector2(0, 1);
        importer.mipmapEnabled = false;
        importer.filterMode = FilterMode.Point;
        importer.maxTextureSize = 4096;
        importer.textureFormat = TextureImporterFormat.RGBA32;
    }
}

Some of the other things may or may not be essential. The pivot is set to the top-left by spritePivot and spriteAlignment. "World units" are equated to "pixels" by way of spritePixelsPerUnit = 1. I think isReadable allows it to be "referenced" by functions like GetPixels, which I use to generate frames from strips. I believe maxTextureSize is there because if a texture exceeds the max in one dimension (which happens for me with large horizontal font strips), it'll get compressed or something else that messes it up.

I also had "importer.wrapMode = TextureWrapMode.Clamp;" in this, but commented it out?? I want to say that was another element to fixing things like weird artifacts, but I guess it must not be essential. I'm pretty sure it has to do with what happens when you draw a texture at anything other than its actual size.

3. Never let anything have a fractional coordinate. If something does, I think it'll have proper pixel size, but be misaligned? I do all my movement through functions that only move in integers, so yeah. You could also have it snap position to integers every frame, but that could get pretty bad for performance.
« Last Edit: October 03, 2018, 03:34:31 AM by vgperson »

aimaina

  • Administrator
  • Cutesterest
  • *****
  • Posts: 1320
  • Cutes: 211
    • View Profile
  • Pronouns: she/her
Re: npc text scripting
« Reply #28 on: October 03, 2018, 11:19:27 AM »
thanx very much this will be very useful to me if i am ever forced to use unitey again.....

i notice your code doesnt seem to change the "compression" setting for textures even though the default is "normal quality" compression for me.... maybe the compression is lossless for small enough textures or something?
~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: npc text scripting
« Reply #29 on: October 03, 2018, 06:24:20 PM »
I don't see any compression option on textures, but I'm on an older version of Unity. If there is a compression setting in newer versions, you might want to set that appropriately as well.

EDIT: Yeah, I guess there is, and you probably want High Quality or None. Also, it looks like there might be a built-in way of changing default import settings now too...?
« Last Edit: October 03, 2018, 06:28:36 PM by vgperson »