itch.io Spring Selects Series A
On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Trying to make this work with GMLive

A topic by bitlather created Jan 30, 2020 Views: 1,256 Replies: 2
Viewing posts 1 to 2

Here's the steps I followed in a new project in GMS2. I'm having a hard time figuring out what to do.

1. Make sure the following is checked: Game Options > Windows > General > Disable file system sandbox

2. Import a sprite named sprite0

3. Create a shader named shader0. Change nothing.

4. Import most recently released gmlive. Drag obj_gmilve into room0.

5. Import shader_replace_simple

6. Create an object called TestObject with create code:

shader_set_live(shader0, true);
live_shader_updated = scr_shader_reloaded;

Step code:

var hlsl_vertex_code = @"C:\Users\bitla\Documents\GameMakerStudio2\TEMP\Shader Replace\shaders\shader0\shader0.vsh";
var hlsl_pixel_code = @"C:\Users\bitla\Documents\GameMakerStudio2\TEMP\Shader Replace\shaders\shader0\shader0.fsh";
scr_shader_reloaded(shader0, hlsl_vertex_code, hlsl_pixel_code);

Draw code:

shader_set(shader0);
draw_sprite(sprite0, 0, room_width/2, room_height/2);
shader_reset();

7. Add the object to room0.

8. Create script scr_file_get_contents with code:

var s = argument0, v = argument1;
var b = buffer_create(string_byte_length(v), buffer_grow, 1);
buffer_write(b, buffer_text, v);
buffer_save_ext(b, s, 0, buffer_tell(b));
buffer_delete(b);

9. Create script scr_shader_reloaded. I didn't know what to do so this is blank.

10. Press play.

11. Change shader0's fragment shader logic by adding this line at the end of main:

gl_FragColor.a = 0.5;

12. Press save

13. Shader did not change in the game window

Developer

The general steps for making it work with GMLive would be:

1. Add GMLive and shader_replace_simple to a project

2. Do shader_set_live(shader_name, true) in the end of obj_gmlive's Create

3. Try running and changing something in the said shader.

Nothing else is needed.

Thanks for the clarification! I think maybe the create event for my TestObject was firing before obj_gmlive's, and that's why I was having difficulty.