Time!

Happy New Year, and Happy Birthday, Eric!

Today I worked through Level 05 of the GPC. Level 03 introduced the irandom_range function, and provided a few examples of how I could throttle when actions occured – remember that in GML, action happens according to game speed (30 by default, or 30 steps/second).

This time, instead of leaving something up to random chance in hopes that it falls on the correct number or number range, we learned how to guarantee that the action occurred at a specified interval. This happened one of two ways:

  1. Using a counter – declare an instance variable in the create event for an object and set a value:
    //"counter" is the name of the variable, 
    //you could call it anything you wanted...
    //we set it to 0 so that it could count up 
    //in the STEP EVENT later
    
     counter=0

    Then create a step event (an event that cycles x# of iterations, 1 for every point you’ve set the game speed to):

    //add + 1 to the counter every time the step runs, 
    // 30 times per second by default
    
    counter=counter+1
    
    //when the counter reaches 150, or 5 seconds, 
    //do something
    
    if counter >=150 {
    ...code whatever you want to happen here...
     }

     

  2. Using Alarms – a built-in counter you can use. Each object can have up to 12 different alarms in it. They work like this:From another event’s code, enter:
    //where 0 is the alarm # (0-11) and 90 is the 
    //# of steps to wait (3 seconds)
    
     alarm[0]=90

    When the alarm #0 goes off, you can execute a piece of code by adding an Alarm Event for that specific alarm #:

    //e.g. create an explosion in a random location 
    //on the screen
    
     effect_create_above (ef_explosion,irandom_range (100,600),irandom_range (100,600),0,c_orange)
    
    //makes the alarm reset to 3 seconds
    // comment out of if you want it to
    //only happen once.
    
    alarm[0]=90

###

Level 05, Lesson 3: Getting Out of Sync

I’d like to preface this by acknowledging two points:

a. It’s FREE…I didn’t have to pay for ANY of this, yet all of it represents his own time, effort and money (i.e. hosting fees for his website, cost of recording equipment and software and so on).

b. John Janetka is a teacher first and foremost – the GPC website, his YouTube channel and all the content therein are done in his spare time, and shared with me, you and everyone else who’s interested because he can and wants to, and with a ‘best-effort’ LoS.

Up to this point, I’d worked out that I needed to go to the website first, read the lesson, watch the video(s), then go back to the website to complete the challenges.

This pattern held true until you get to Level 05, Lesson 03.  The first thing he asks you to do in Part A is to read the notes on “L05-03-Reading01.pdf”. There isn’t a link to it on the website, or anywhere!

Then he asks you to watch the video 05-03-A to review said notes, but again, there is no such video on his YouTube channel!

Further down, he asks you to go through the questions in L05-03-ConceptQuestions01.pdf, which, like the notes, aren’t linked on the page or anywhere else…

So where are they? Well, after doing some digging, I found the word document versions buried in the Lv05 resource folder that was  included in the zip file from his resources page (the link labeled “Course Resources For All Levels”).

While I could have sworn that he’d touched on &&, || and != somewhere in one of his previous videos, they aren’t covered in any of the Level 05 videos up GPC-05-03-X1Preview. Not that it matters much as the lesson notes do a pretty good job explaining what they each do and when to use them.

By and large, the questions did a good job of reinforcing the lesson up to Part C, where the answers didn’t really follow the format he specified in his instructions…

SPOILER ALERT: Part C Questions and Answers

The question is phrased as follows:

Condition Is it ‘always true’ or ‘always false’?
if x>20 || x < 10
if points<20 || points>10
if life>=100 && life>50
if life>=100 && life<=0
if (points>10) && (points<20)

My answers were:

Condition Is it ‘always true’ or ‘always false’?
if x>20 || x < 10  Neither
if points<20 || points>10  Always True
if life>=100 && life>50 Neither
if life>=100 && life<=0  Always False
if (points>10) && (points<20)  Neither

His answers were:

Condition Is it ‘always true’ or ‘always false’ ?
if x>20 || x < 10 not always true
if points<20 || points>10 always true since one of the conditions must be true
if life>=100 && life>50 not always true  (ex. life is 25)
if life>=100 && life<=0 not always true  (ex. life is 50)
if (points>10) && (points<20) not always true

“Not always true” implies that it is sometimes false, when if fact, in some cases (e.g. if life>=100 && life<=0) it is ALWAYS False.

To check my answers, I wrote a test program which used the i_random_range function to generate a number every step between 0 and 200 (all of the examples above fall in that range).  From there, I ran each condition separately and had it display the result (true, false or both) each cycle, proving them correct.

I’ve provided it here, feel free to use it if you’d like.

…and yes, I probably spent waaaay more time on this than I reasonably should have, but it’s all good practice, right?

 

Later still in the same lesson, he tosses in some functions not previously covered (e.g. room_exists, room_goto_next etc.). I hope these will be covered in more depth later as this was the first time we’d played around with a project that had more than one screen.

Welp, on to the rest of the lesson! Stay tuned for more…

 

Image Credit: Don’t Hug Me, I’m Scared 2

Stepping Stones and a Clear Path Forward

Building on an Unstable Foundation

As we draw closer to a working prototype, it’s become increasingly more apparent that there are some fundamentally flawed issues with the way we’re going about implementation.

Eric is new to both programming in general (save for some college level coursework a few years ago), and GML. All in all, he’s got about 4 or 5 weeks worth of experience in total, but no formal training. As such, he doesn’t have a solid foundation of knowledge to build on, forcing him to seek out tutorials (usually YouTube videos) which give him ideas as to how a thing can be done.

The most popular videos are more akin to “Let’s Plays” with little (if any) structure, and even fewer explanations as to why the developer elected to go about doing things a certain way.

This forced Eric to look at what the other developer did, attempt reproduce it, then reverse engineer it without understanding what each piece’s purpose – trying different arrangements and configurations until it worked (or at least appeared to).

What troubled me was that sometimes I’d ask for a seemingly trivial feature only to find that he was unable to work out how to program it, and compromised with an implementation that wasn’t up to spec.

For example, instead of using keys 1-6 to toggle a different weapon type, and Ctrl to fire,  he mapped weapon type 1 to key 1 because from a logic standpoint, he had no idea how that would work, let alone how to frame the problem so that he could look it up.

Another example was the breakable wall from my prototype specifications in the last post. What I asked for was for wall, when placed, to take damage when it collided with the enemy, and update it’s animation frames to show progressively more damage before being destroyed.

Because he didn’t understand how variables worked, the wall was killing the enemy rather than the other way around – my suspicion was that he didn’t use the “with other” construct to indicate that it was the wall taking damage, not the enemy as they both had an instance variable called “hp” (i.e. hitpoints).

After a few more hours of working on it, he came back and this time the walls were taking damage, but being destroyed after only a second or two. This was because he was using the image_index property to advance the frames of damage to the wall sprite, destroying the object when it reached the end of the animation, foregoing hitpoints altogether.

Since the room speed was set to 30 (i.e. 30 cycles/second), the enemy was colliding with the wall 30 times a second, causing the wall to cycle through each frame of its sprite sheet within a fraction of a second. While this “appeared” to work, it in fact did not follow my design specifications (no hitpoint system) and was therefore not fit for purpose.

I suggested how this could be solved in pseudo code, but he insisted he tried that and it didn’t work – again, probably because of which object he was calling the variables from, but I didn’t know that either at the time.

So where could we go from here?

You Don’t Know What You Don’t Know…

The root of the issue was that while I understood the basic logic I wanted to use, I didn’t have the syntax for it, and neither did Eric. We needed to take a step back and learn the basics before trying to implement big, hairy, complicated features.

So again, I took to YouTube – we’d watched several of the Let’s Learn GameMaker: Studio channel’s videos, lots good information covering what was available and what options there were for each feature, but there was no practical application of those lessons; at at the end of the lesson, there was no example of a typical use case for that feature in your game

A Clear Path Forward

Just when I was about to give up, I managed to stumble upon another channel aptly named, Gamemaker Game Programming Course.  The channel is a bit confusing (the playlists in particular) until you work out that it’s actually just a video repository for his website:

www.gameprogrammingcourse.com

Start there, download the resource packs and project files, then start with the playlist labeled: Level 02 [ GameMaker Basics Sprites Objects Events ].

The site and videos were created by computer programming teacher named John Janetka for his high school’s computer science program. The quality of the content and structure of the lessons are the best I’ve come across on YouTube thus far.

By the end of Level 02, I was able to solve both of the programming issues Eric was struggling with above, and created two games in the process. Simple as they were, the experience was valuable.

I’d asked Eric to place his programming efforts on hold to go through this course with me. I asked him to try not to think of this as a step backward, but rather rather a stepping stone forward toward better, more stable code. He agreed, and will continue to check in every day or so to share what we’ve learned.

###

Image Credit: “Martyn B

Disclaimer: I have no affiliation with any of the websites, applications or YouTube channels referenced above.

TANSTAFS: There Ain’t No Such Thing as a Free Salad!

Update – August 11, 2015: I received an email from GameSalad asking if I’d consider the Basic version for a $4 discount ($15/month). While I don’t take issue with  paying for a tool, I don’t think a subscription model is a good fit for the Basic version. I would rather pay a flat, one-time fee, and pay again for upgrades, if I wanted them.

I could even advocate paying a subscription for service (online publishing) and support, but if all I can do is publish to the GameSalad arcade, it’s just not worth it :(…

When I began using GameSalad, I had three major aversions to buying the ‘Pro’ version for Windows ($300/year):

  1. Stability
  2. Features (on the Windows version)
  3. Learning Curve

The Windows version was the bastard step-child of the Mac one, always several versions behind, plagued with bugs, lacking the same features as it’s Mac counterpart. While there is a robust community of developers, the vast majority are Mac users, and so due to the great disparity between the Mac and Windows versions of the application, many of the tutorials were using the Mac version, which simply wouldn’t work the same way (if at all) on the Windows one.

So what did GameSalad do?

Well, in my last post, Windows had finally caught up to the Mac edition with the implication that they’d stay synced. Even so, the Windows version was prone to crashes on startup, but a couple of updates later and that seems to have been tackled.

As to the learning curve, the new startup screen features a link to official tutorial videos!

Unfortunately, There Ain’t No Such Thing as a Free Salad…well, not anymore…

###

When I booted up GameSalad for the first time since patching, I was greeted with a 15 days remaining on my new ‘trial’ edition. No in-app explanation. Nothing in the ‘Help > About’. Zip. Zilch. Null…

Did I get a free trial of the ‘Pro’ version? What gives? Well, come to find out, their old CEO stepped down and the new one decided to start charging for the ‘Basic’ version ($19/mo).

So what did I do?

I uninstalled GameSalad. I know it’ll take me a hell of a lot longer than 15 days to learn how to use GameSalad. It’s initial appeal was that I could take my time and learn the tool at my own pace, and when I was ready, and had proven to myself that I was able to make (what I felt) was a product worth selling, I wouldn’t mind paying for the privilege of publishing it.

This is a good opportunity to change gears and maybe delve into Unity or Unreal…

Nothing is Trivial

When I take a walk through the internet, I never know where I’ll end up. What started as a search for book reviews of a particular novel I was reading ended with a memorial dedicated to the gone, but not forgotten Cronan Thompson. I’d never heard of him nor would I have been likely to, given that our interests didn’t align. To paraphrase Freddy Mercury,MiST was never my scene and I don’t like Star Trek.”

Despite having little in common, I couldn’t help but find myself chuckling over some of his writings. He was whimsical, even brilliant beyond his years. I began to envy those who had the opportunity to match wits with him, and pity those who couldn’t appreciate his sense of humor. The more I read, the more I began to feel a deep sense of regret. The same crushing twinge I recall feeling the first time I heard Ferris Bueller’s  casual observation, “Life moves pretty fast, if you don’t stop and look around once in a while, you could miss it!”

Well, I had missed it. I will only ever know this person vicariously through what remains of his writings and the second-hand experiences of others. All I have left is the heartbreaking realization that you can never go back – the world will never be what it was, then and there. For better or worse, all we have is now. If there’s one lesson Cronan has taught me, it would be this: Indulge your passions, no matter how trivial they may be to others – for nothing is trivial.

GameSalad

In my last post, I discussed my intent to use the GameSalad engine as my initial development platform. After reading several reviews, I decided to try it for myself and see what I could do.

Day 1:
I downloaded the application and placed a background I created in the frame, and the a sprite on top of it. I assigned behavior to the sprite, allowing it to be moved using the Arrow keys.

Day 2:
I decided I’d learn faster using guided tutorials to become familiar the concepts and methods available. As I mentioned in my previous post, I came across a series of Tutorials on YouTube that described how to make 4 distinctly different games, supplying all of the images, sound effects and music to allow a novice to follow along. I’ve gotten through 2/9 of the series.

Note: I did run into an issue in Lesson 2, the sound effect that was supposed to play when pressing the menu button to change to the “Whack a Monster” game didn’t play. Looking at the comments, several other people ran into the same problem. I tried to troubleshoot this several ways:

When I removed Change Scene Behavior, the sound played. I tried changing the order of the “do” actions and that didn’t make any difference. I tried creating a different rule with the same settings, but that didn’t work either. I tried researching the problem on GameSalad’s forums, but couldn’t find any further information.

At the time, I didn’t think to create a separate project and test this one feature with a different set of assets, but may give that a try later. It wasn’t important to the core functionality of the game, so I let it lie and went on to building the “Whack a Monster” scene.

Important Concepts

So far, I’ve been introduced to a number of new concepts employed by the GameSalad engine:

Scenes: This is where the action takes place, can be used to represent different “screens” (i.e. menus, level stages, etc.).

Actors: This can include backgrounds, sprites, or any objects that the player might interact with. They can have rules assigned to them to dictate their behavior.

Behavior: These control what a actor does, and can be used to animate the image, play a sound, change something in the environment and so forth.

Media: Image, music and sound effect files in various formats which you’ll include in your game. Can be assigned to Actors and placed in Scenes.

Of all of these, Behaviors are the most complex element and will require a lot of review to understand how to use and troubleshoot them.

Further Questions

How are large environments handled? i.e. suppose I have a level that spans multiple screens, do I just create a giant background image? Or is a separate scene for each screen? If the later, can scenes be grouped or nested to help organize them (e.g. lumping all scenes from one “level” together)?


Update: October 2, 2014
I did attempt to troubleshoot the bug mentioned in the note above. To rule out the possibility that this had anything to do with the game assets used in the tutorial, or the setup of the project itself, I started a brand new project with a new image and sound file.

Just like in the tutorial project, I found I could change the scene, or play the sound when the actor was touched. If both were listed, the scene would change, but the sound wouldn’t play, regardless of which came first. The only way I could get the sound to play was by removing or disabling the change scene behavior.

According to the manual (see Windows Creator 0.10.0 manual, page 21), behaviors are supposed to be executed sequentially (top down). Keep in mind that I did check the “run to completion” flag.

After doing some research, I found another post on the official GameSalad forums which described the same issue I had. I posted a detailed response which I won’t repeat here, but long and the short of it is that this seems to be intended behavior: all sounds stop when the scene changes.

I can think of a few different ways to handle this:

  1. Use an older version of GameSalad (10.4 or earlier, which is what worked for Matt P., author of the tutorial videos)
  2. Find some way to handle the actions sequentially rather than simultaneously (play the sound until it finishes, then change the scene)
  3. The last option would be not to change the scene at all, instead, move the camera to a different region in the same scene.

The first option doesn’t seem like a good one as it runs the risk of introducing stability issues which have been addressed in the latest version.

The second option might work, maybe figure out a way to either add some sort of delay to the Change Scene behavior to prevent it from executing immediately, or perhaps add a delay between the sound playing and the scene change? I’ll have to test this when I got home.

As to the final option, this seems like a hack (and probably a bad one) as each scene has its own attributes (size, background color etc.) so that would force me to use the same ones for both the menu and the level.

Where to Begin?

Before one can build something, there are a few basic questions to answer:

  1. What do you want to be build exactly? (2D? 3D? Puzzle? Action? be specific)
  2. What tools/resources will you need?
  3. What skills will be needed to create resources/use tools to accomplish your purpose?

Since I want to jump in and create something, my aim is to gain experience. I know that I’m not going to create a perfect game on my first attempt, so I want to start with something simple and portable. That last time I attempted this about 12 years ago was with a tool called “3D Game Studio“. While I was able to create a few “working” 3D environments, and learned a lot about textures, sprites, blocks etc., I was never able to get a handle on scripting.

Also, given that I had no experience working with 3D modeling tools (would have been 3D Studio Max at the time), I had no way of creating models for actors, nor did I know anyone who was capable doing so.  While I might be able to teach myself, this is a highly-specialized art that takes a lot of time and skill to master.

2D sprites on the other hand are something far more familiar to me as I can draw, and I am very comfortable with Photoshop (I ought to be, having used it for the last 18 years or so).

So going back to the questions above, here’s what I’ve got:

What do you want to be build exactly? (2D? 3D? Puzzle? Action? be specific)

A simple, 2D game with basic mechanics (right now I’m leaning toward a “Diabolika” clone)

What tools/resources will you need?

I’ve been researching non-programmer friendly game engines and came across GameSalad. It’s PC version is a bit buggy, so I’m hoping it’s just user error and not a reflection of the quality of the application.

What appeals to me about it is that I can use for free as long as I like, and will only incur a cost ($300 USD/year) if I elect to publish with it.

Edit: GameSalad went to a subscription model around June of 2015, and no longer offers a ‘free’ version.

This seems like a reasonable investment given that I’d have the ability to publish to Android, Apple and PC (HTML5) markets without having to do any porting.As to other tools, I already have Photoshop, and will be picking up a Wacom tablet to draw sprites with (I own one already, but that’s back in the US, and I’m currently working in Saudi Arabia).

As to sound effects and Music, I have a decent microphone, and have been creating electronic music on Skale (a windows-based version of Faster Tracker II) for almost two decades, and have literally hundreds of pieces (some finished, many not) of original music I’ve composed myself, and can use as source material.

What skills will be needed to create resources/use tools to accomplish your purpose?

Of all the tools listed above, the only one that’s new to me is GameSalad. Thankfully, there are a lot of Tutorials on YouTube that explain the basics, as well as other resources provided by GameSalad and others to help me get started. I’m currently working my way through a series of tutorials  created by “Matt P”.  From what I can tell, this appears to be part of a formal game creation class as he’s also included links to the source material in his comments (sprites, sounds, music etc.).I’ve watched and followed along with 3/9 of the videos so far, but I’ll write more on that in my next post…