Fern
Member
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.
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.
Scripting Syntax, click below for a peek at it.
Speed comparison
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.
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.
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.
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
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: