1. Hey! Guest! The 31st GMC Jam will take place between Nov 16th, 12:00 UTC (Friday noon) and Nov 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Seabass's Scripting Engine

Discussion in 'Marketplace' started by Seabass (The Human), Feb 26, 2018.

  1. Seabass (The Human)

    Seabass (The Human) Member

    Joined:
    Jun 20, 2016
    Posts:
    330
    Marketplace
    https://marketplace.yoyogames.com/assets/6565/seabass-s-scripting-engine


    Features

    As of now I've implemented a few key features that I feel really make this mini-engine stand out.
    • Live reloading of cutscenes upon file edits, this means you don't have to restart your game to make changes to a scene
    • Sprites are referred to through the Game Maker project instead of loaded externally
    • The ability to pause a scripts execution via wait()
    • Executing user created GML scripts and passing in arguments to said scripts
    • Error reporting that doesn’t stop the game
    • No DLLs means that the engine can be used on any platform
    • Modify and read global variables from GML
    • Built-in text functions including string splitting
    • Proper documentation of all provided functions and the framework (only partially done but here's a link to it: https://goo.gl/RJ7d3B

    Here's an example of a script created for the engine:
    https://pastebin.com/RZQkqd9c

    Why would I use this instead of GML for animations/cutscenes?
    It supports any GM game and provides an easy way to create cutscenes on the fly. With live reloading there is no need to restart your game to make changes. It can even be used alongside normal gameplay. For example you may want a character to shake and then swing a weapon, produces an attack object. Using the script_execute() function in the external scripts you can absolutely do that. This prevents you from having to spend hours on a simple scene or animation.

    [​IMG]

    [​IMG]

    Scripting Syntax, click below for a peek at it.
    The syntax for scripting within this system is very simple and follows a very basic layout.

    Part
    {
    function(argument)
    function("string")
    }

    Scripts are split up into parts. Each part contains a set of functions that are executed top to bottom. While this may seem very limited at face value it does allow for fast and simple code with little to no knowledge of programming.

    Here’s an example of a script that creates a character, moves them to the screen, waits two seconds, and then fades the character away.


    Example_Part
    {
    actor_create ( seabass, 0, 320, spr_character_seabass )
    actor_move ( seabass, 360, 320, 4 )
    wait ( 2 )
    actor_fade ( seabass, 0.05, 1 )
    }

    Brackets [ ]
    You should keep an eye out for [ ]. These indicate that a function as optional arguments. An optional argument means you do NOT have to include those arguments for the function to work.
    Generally functions that include these have been done this way because you can still set these values later with other functions. This helps to prevent lines of code becoming too long.

    Quotation Marks “ “
    Quotation marks are parsed as strings meaning if you do, “I am a dog”, the compiler will see it as I am a dog. Without the quotation marks the compiler would read it as Iamadog. This is extremely important when working with text boxes.

    Speed comparison
    Non-YYC
    actor_create(jisselle, -100, 720, spr_character_jisselle_idle) --> 126
    actor_move_lerp(jisselle, 280, 720, 0.2) --> 67
    wait(1) --> 20
    actor_flash(jisselle,255,0,0,1,1,0.0125) --> 72
    actor_sprite_change(jisselle,spr_character_jisselle_angry) --> 76
    actor_shake(jisselle, 5, -1) --> 43
    wait(0.1) --> 68
    actor_shake(jisselle, 4, -1) --> 37
    wait(0.1) --> 21
    actor_shake(jisselle, 3, -1) --> 37
    wait(0.1) --> 15
    actor_shake(jisselle, 2, -1) --> 38

    YYC
    actor_create(jisselle, -100, 720, spr_character_jisselle_idle) --> 95
    actor_move_lerp(jisselle, 280, 720, 0.2) --> 54
    wait(1) --> 14
    actor_flash(jisselle,255,0,0,1,1,0.0125) --> 55
    actor_sprite_change(jisselle,spr_character_jisselle_angry) --> 44
    actor_shake(jisselle, 5, -1) --> 36
    wait(0.1) --> 13
    actor_shake(jisselle, 4, -1) --> 28
    wait(0.1) --> 10
    actor_shake(jisselle, 3, -1) --> 28
    wait(0.1) --> 10
    actor_shake(jisselle, 2, -1) --> 27

    Non-YYC YYC
    126 95
    67 54
    20 14
    72 55
    76 44
    43 36
    68 13
    37 28
    21 10
    37 28
    15 10
    38 27

    Average function time (Non-YYC)
    51.66 microseconds or 0.05 milliseconds

    Average function time (YYC)
    34.50 microseconds or 0.03 milliseconds

    In a 60 fps game, you could call approximately 333 of these script functions per frame in non-YYC (VM) and up to 555 in YYC. These benchmarks were done on my system which may not be a fair comparison to the average user but should be within a 50% margin of accuracy for most users.

    Of course you shouldn't need to call more than 50 functions per step and I'll slowly be optimizing this system as time goes by.

    If you'd like to take part in testing this engine out prior to it becoming more publicly available, you can find more here: https://discord.gg/YQX4SFF

    *Update an hour or so later*, just made the whole system 25%~ faster.
     
    Last edited: Mar 1, 2018
  2. Seabass (The Human)

    Seabass (The Human) Member

    Joined:
    Jun 20, 2016
    Posts:
    330
    I've updated the post to include syntax information and I've updated the feature list.

    I hope to get a public demo/asset out in the next week. So far the system is very capable but lacking a handful of useful functions. Here's what there is so far.

    actor_create ( name, x, y, sprite )
    actor_move_lerp ( name, x, y, speed )
    actor_move ( name, x, y, speed )
    actor_fade ( name, fade_speed, fade_alpha )
    actor_alpha ( name, alpha )
    actor_scale ( name, x_scale, y_scale )
    actor_shake ( name, shake_strength, shake_time )
    actor_sprite_change ( name, sprite )
    actor_flash ( name, color_red, color_green, color_blue, alpha, time, speed )
    actor_color ( name, color_red, color_green, color_blue, alpha )
    actor_delete ( name )
    text_create ( name, x, y, sprite, font, [fill_type], [width_limit], [horizontal alignment], [vertical alignment], [vertical separation], [text] )
    text_offset ( name, text_x, text_y )
    wait ( seconds )
    jump_to ( part )
    global_variable_set ( name, value )
    if_global_variable_= ( name, value, part )
    if_global_variable_! ( name, value, part )
    if_global_variable_< ( name, value, part )
    !if_global_variable_> ( name, value, part )
    if_global_variable_<= ( name, value, part )
    !if_global_variable_>= ( name, value, part )
    script_execute ( script, arguments )

    While you could definitely use the system in its current state, I'd like to make it more robust first and provide a larger framework for early users.
     
    Last edited: Feb 27, 2018
  3. Seabass (The Human)

    Seabass (The Human) Member

    Joined:
    Jun 20, 2016
    Posts:
    330
    This tool has received a few additional improvements including scene changing functions!
     
  4. Felixsg

    Felixsg Member

    Joined:
    Aug 3, 2017
    Posts:
    2
    Where is?
     
  5. Seabass (The Human)

    Seabass (The Human) Member

    Joined:
    Jun 20, 2016
    Posts:
    330
    I took it down from the store. But I sell it privately!
     
  6. Samuel Venable

    Samuel Venable Time Killer

    Joined:
    Sep 13, 2016
    Posts:
    918
    Why do you sell it privately? Isn't that a little odd since it will effect your number of sales? :p
     
  7. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,132
    You'll need to fix the link otherwise I'll have to remove the topic. This is the Marketplace forum, and so only assets on the Marketplace can go here... Nothing to stop you posting (or having the topic moved) into the "Made With GameMaker" section of the forum though.
     
  8. Seabass (The Human)

    Seabass (The Human) Member

    Joined:
    Jun 20, 2016
    Posts:
    330
    @Samuel Venable You're hilarious if you think people purchase tools like this from the marketplace. xD It certainly does not affect my sales because over the course of the engines life-time it got one sale. However it is something I'm more or less licensing now.
    @Nocturne You can remove it.
     
  9. Samuel Venable

    Samuel Venable Time Killer

    Joined:
    Sep 13, 2016
    Posts:
    918
    Honestly, you're hilarious if you think selling it privately is any better than publically. I don't understand how anyone could agree with you on this, and I seriously doubt anyone actually does.

    What does "more or less licensing" mean?
     
  10. Seabass (The Human)

    Seabass (The Human) Member

    Joined:
    Jun 20, 2016
    Posts:
    330
    I mean that currently it is being used in an engine valued at $1,000 (so far) and that myself/partner are planning to allow various people to use it. It's fair to assume I'm full of crap but I clearly have a resume to provide as evidence that I know what I'm talking about. Now $1,000 isn't great, it's complete ****. But $1,000 is better than $5 or $10. haha
     
  11. Samuel Venable

    Samuel Venable Time Killer

    Joined:
    Sep 13, 2016
    Posts:
    918
    I think you are missing the point. How does selling this privately all of a sudden make it worth more than $5?
     
  12. Seabass (The Human)

    Seabass (The Human) Member

    Joined:
    Jun 20, 2016
    Posts:
    330
    Because this engine isn't available else where, and especially not for $5. Due to this it's valued at whatever I determine it's worth. Example, if you want it I could sell you it for $250. That $250 is worth far more than $5. Especially considering the amount of time it takes to one on one with someone who needs help.
     
  13. Samuel Venable

    Samuel Venable Time Killer

    Joined:
    Sep 13, 2016
    Posts:
    918
    $250 for what appears to be very basic GML... maybe this is targeting more at people who are extreme beginners and have money falling out of their ears?

    idk I need to go to bed my head hurts.
     
  14. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,953
    Since when is writing a custom scripted language considered "very basic GML"? Are you overlooking a big chunk of the first post per chance?

    I would generally agree that past a certain degree of complexity and specialization it becomes no longer viable to sell something as an asset - if it's specific enough that you can't have large enough volume of sales, and it's complex enough that you cannot expect everyone to never have any issues with it, you cannot possibly pick an appealing price point without loosing time~money on supporting it or getting your share of "how dare you" type of public outrage.
     
  15. Samuel Venable

    Samuel Venable Time Killer

    Joined:
    Sep 13, 2016
    Posts:
    918
    Yeah, I didn't quite understand what it did at first. But now I think I got it and that makes more sense.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice