Dev Log Entry 2: at least 2 in 2022

I decided to try something a little different from my normal posts: use a post in place of a google doc. 
This post is an attempt at something of a hybrid between a "normal" post and a freeform stream of consciousness google doc made solely for my own consumption. I'll see soon enough if it's going to work.

If it wasn’t clear already: I plan to regularly use GameMaker Studio 2 (GMS2) for the 12 months of 2022. Because the subscription license expires December 31st 2022. That’s the main reason.

I’ve now gone through at least four video tutorials with GMS2. Two were drag-and-drop (DND) and two were in the custom scripting language, GML.

I’m starting to think the GML versions might actually be easier some how. Or I just need to learn that DND UI a lot better.

I’ve decided instead of moving on immediately to a video tutorial of high complexity or just longer form – by which I mean the 24 part playlist about making a game called “little town” – I am going to try and take stock of what I’ve learned about GMS2 the IDE package. There are also the (for lack of a better term) basic algorithms on things like assigning keyboard movements, associating sprites/objects and keeping a movable player object without the bounds of a window or other “walls”. I also think I want to work on an original creation. The only real way to know if I’m learning is to create something from scratch applying what I have read and followed. That GMS2 has a way to open multiple instances of itself with different projects open is just a bonus, really.

Of course some of the issues end up being there are easier and more streamlined approaches introduced through the course of a tutorial, so I could be missing something when re-reviewing some of the material.

I don’t really know how I’m going to do this yet as having a million screenshots doesn’t seem efficient.

I haven’t tried the “convert to GML” feature of the DND version though, so I could just describe the hierarchy of where the code is then paste in the GML-derived DND code. It should be noted this GML conversion only goes one way e.g. I can’t convert it back to DND. But that’s not that important.

Starting the Fire… and Fire

I suppose starting at the beginning is as good a place any anywhere. The beginning for me was Fire Jump (well technically I did “space rocks” first but I’ll get to that). I used the DnD version of the tutorial – both written and video in conjunction – but I’m starting to wonder if I should go through the GML edition in written form now. I’ll see as I go along.

Fire Jump Tutorial Walkthrough part 1

I’ll just start with the player character.

This is the DnD version of the player code for Fire Jump. Actually it’s not that hard to kind of see what’s probably going on here. At least with the controls. There’s some collision with fire stuff, some collision with windows, create and step events. Not sure I could reproduce these if I had to but it’s here.

What I’m going do is look at the create event in particular for the player object then convert it to GML using the GMS2 feature.

This isn’t really that complex of a demonstration of what’s going on. We’re setting a speed, setting some gravity and putting in a global variable.

Lets see what happens with this simple create event is converted to GML.

I converted this GML and this is all I got back. WordPress doesn’t have a syntax highlight choice for GML so you may have to use your imagination (I just used JavaScript as a “close enough”).

Anyway, all this seems strangely simple. I think I could just copy/paste this or write it out pretty quick.

The global. designations are just there to specify variables set globally, so all the objects can read and write values.

vspeed = -35;
gravity = 1;
global.score_rescue = 0;
global.score_height = 0;

I’m going to try the same thing again, this time with the step event screen because there seems to be so much more going on and the code will be more interesting to look at.

The Step event via DND

Now I’ll just convert it over to GML and..

if(y < room_height / 2)
	if(vspeed < 0)
		var downspeed = -vspeed;
		with(obj_move_parent) {
		y += downspeed;
		y = room_height / 2;
		var back_y = layer_get_y("Background");
		layer_y("Background", back_y + downspeed);
		global.score_height += downspeed / 100;

Well that isn’t that bad for generated programming lines. Or I have low standards.

Actually I’m still trying to learn about why in the particular case this player object needs that “move parent” since that object doesn’t seem to have any particular code to it. And yet it’s the assigned “parent object” of a lot of other objects.

I mean I think I know what that means and does now. It a way to in “derive” attributes from another object rather than writing redundant code. In other words if ;you have a parent objects named “apple” with attribute “round” you can a new instance of an apple and it’s already got that “round attribute” so that detail doesn’t have to be defined since it’s already there. See? I get some stuff.

Only difference is this time the “move parent” doesn’t actually have any attributes for child objects to inherit. I’m sure it’s explained in the guide. I just don’t get this particular instance at this particular moment.

The rest of the code I actually do know what it’s doing since I created it all in the DND UI.

Move over to rocks

Going to be all over the place for this write up. I opened a new instance of GSM2 and opened my copy of the Space Rocks project. I think I can learn some things from both these projects and selectively pull from each one. And also the other two projects.

In fact I think I’ll what I wasn’t sure I wanted to do yet initially and just start up a new project.

Space rocks: bullet collides with asteroid event “DND” edition

I’m looking at all these events and objects over in the Space Rocks project and it’s kind of interesting.

You can see here there’s a score tracker, a destroy instance and some code about splitting asteroids into smaller asteroids which won’t apply to what I’m going to be doing.

I could take the debris affect for both the enemies I’m planning and the player ship though.

The “apply to other” is kind of interesting too. I’m almost positive that’s a way to say “this applies to any other object this applies to”. Or to put it another this applies to whatever asteroid this bullet object collides with.

This post didn’t go how I was expecting. I think I managed to learn a lot though.

I’m going to create a separate post for game I’m going to create called Newtius. So stay tuned for that.

I’ve already created a GitHub for that game though I haven’t really started it yet as I write this.

One thought on “Dev Log Entry 2: at least 2 in 2022

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s