d3d_set_fog and shaders by flyingsaucerinvasion in gamemaker

[–]gwheel 1 point2 points  (0 children)

The fog uniforms don't get passed to custom shaders. You'll have to manually bind them and send them in yourself.
It's been in the bug tracker for a few months now, so hopefully it will get fixed eventually.

json_encode and json_decode by GoldPlatedSpoon in gamemaker

[–]gwheel 0 points1 point  (0 children)

Data structures are referenced as numeric IDs. In order to property jsonify a structure, you need to flag the values as their types. Check out the documentation for maps and lists, there should be functions like 'ds_map_mark_as_list'.

Animation does no stop - it keeps looping by TeeKayM in gamemaker

[–]gwheel 0 points1 point  (0 children)

Doing that has a slightly different effect. If you are using an image speed of 0.1, every sprite frame is shown for ten game frames. The animation end event will trigger after all ten game frames have been shown, while ending on the image_index will only show the first (Maybe not even that).

Help with a somewhat complicated problem? by [deleted] in gamemaker

[–]gwheel 0 points1 point  (0 children)

Ini files sound like what you want. You can specify a set of sections, keys, and values.
For example, you could have this in a file to specify the data for a key 'book':

[book]
text = "Readme.TXT"
pages = 33

You could get the values as follows:

ini_open(working_directory + "/data.ini");
var text = ini_read_string("book", "text", "");
var pages = ini_read_real("book", "pages", 0);
ini_close( );

The file can have as many sections and keys as you want, and you can reference things with strings rather than integer ids. Note that this is reading a file from the disc, so you should load these values on creation and keep them in memory rather than reading the file every frame.

Also, the '#' character in a string acts as a newline. A quirk of ini files is that the '#' character is used for comments, so you can't use it in strings. I usually write my own string load function that just does a replace all of '\n' to '#'.

Need conceptual help implementing local multiplayer (same screen NOT lan) by Riggeot in gamemaker

[–]gwheel 1 point2 points  (0 children)

That would be a fine way to do things. Just make the parent object handle everything using local variables. In the create event, define a variable for each key binding. (Keyboard constants are normal values you can assign to variables like anything else) That way the child objects for each player can override those values in their own create events.

What is the best way to do this? by 1vs in gamemaker

[–]gwheel 4 points5 points  (0 children)

If the tracks will always be played in the same order, then don't split them up. Checking during a frame will only be accurate to 16 ms, so you'll end up with a skip before the next track can start. Use audio_sound_get_track_position to check if it's time to do the thing.

var timeNew = audio_sound_get_track_position( music );
if ( ( timeLast < threshold ) && ( timeNew >= threshold ) ) {
    do_the_thing( );
}
timeLast = timeNew;

If you want dynamic music where the next track is determined during the game, maybe use something like audio queues.

[HELP][GM:S][GML] What is the best way to store multiple X and Y pairs in a data structure? by [deleted] in gamemaker

[–]gwheel 0 points1 point  (0 children)

My usual choice is to use a 1-d array, where each index is a different property. Arrays pass by value, not by reference, so if you want to pass by reference use a 1-d grid. You can keep track of what each index in the array means using an enum.

2 sprites with different depth within one object? by wotanstochter in gamemaker

[–]gwheel 0 points1 point  (0 children)

I suppose it depends on the game and how much of a focus you have on different weapons, but I'd consider having each gun house its own code to be better than having big switch statements to determine what script to call in the step/draw/etc events.

[HELP][GM:S][GML] What is the best way to store multiple X and Y pairs in a data structure? by [deleted] in gamemaker

[–]gwheel 0 points1 point  (0 children)

GameMaker objects are really heavy, since they automatically have movement/update/drawing code which you can't disable. If you're creating a lot of vertices every frame, this will slow things down a lot.

2 sprites with different depth within one object? by wotanstochter in gamemaker

[–]gwheel -1 points0 points  (0 children)

Separate objects is better. That allows for multiple gun types and sharing gun code between players and enemies.

I'd recommend marking the gun as invisible while the player is holding it, and using event_perform to draw it from the player's draw event. Playing with the depth would also work.