Saturday, September 7, 2013

GameMaker: Day 7 - Climactic Conclusion of this Changing Climate

TL;DR

I didn't get EVERYTHING finished in my clone, but I did add a feature or 2, and the game looks better! I'm going to stick with it for a while, because it WILL make me faster at game development and prototyping.

What I Did Today

Holy cow, this week has gone by fast! It feels like I just started watching videos on GameMaker Studio. But it's been a whole week, and I've gotten a pretty good impression on what it's all about.

Today was my wrap-up for my week-long GameMaker adventure, and the second day I worked on my GM remake of Samsara, my most recent Ludum Dare entry. Despite my best efforts, I didn't get as much time to work with GM today as I wanted, due to being enrolled at a hacker-school currently, and having projects to finish. (Sorry!)

But I WAS able to make a complete-ish game! My remake has most of the features of the full game, but I'm missing 2 crucial things due to my time constraints. The first is music, I just ran out of time to get it put in. The second thing is the copied 'clone' sidekick. While getting everything put together, I didn't have enough time to fully tackle the "not-having-real-arrays" problem, so I pulled the unfinished code out, as to not confuse people with arbitrary code. This is the first thing I need to investigate now that I'm not on a schedule for learning as much as possible.

But you need to put this in perspective. I only spent 4 hours working on this today. Couple this with yesterdays 2 and a half hours, and I only spent 6.5 (ish!) hours on this projects. That's multiple hours less than I spent coding during the first day of the Ludum Dare 48 hour event. This is why I looked into GameMaker. It's quite the program, and I can definitely recommend it to anyone getting into game development, or wanting to be more productive doing so.

This project was a great warm-up to get into GameMaker. You can move with W, A, S, & D, and press the Spacebar to shoot. The enemies randomly spawn, move at a random angle, and shoot at the player at a certain interval. Enemies take you hits, you take 3, and you lose if you hit an enemy.

Play it, look at the code, and enjoy it!

Here are some screenshots


Time spent coding today was about 4 hours, so the entire project was roughly 6.5 - 7 hours.

Source Code

The source code/GM Project file is zipped and available HERE, from my website.

Conclusion

I actually like GameMaker. It has its problems, for sure, but after getting through a few things, it has the ability to really save you time, and make you extremely more productive. Everyone should give it a try, from people who don't know how to program, and will be using the drag-and-drop interface, to people who have programmed or made a game before, and just want something to help with the boring/tedious parts.

Suffice it to say, I'm a fan of GameMaker. They also seem to have a great community too!

Friday, September 6, 2013

GameMaker: Day 6 - Deja Vu

TL;DR

Started re-making a game (Samsara) that I recently made for Ludum Dare, but in GameMaker, in 2 days! Cut out a HUGE chunk of dev time already, can't wait to see the total savings.

What I Did Today

Today was day 1 out of 2 where I will be re-making my HTML5 game Samsara, my latest Ludum Dare entry, with GameMaker. There's not much more to say on that, I've been messing with GM for 5 days, and now it's time to see what I can do.

I'm already seeing great leaps in productivity. i started out by making an empty room, adding the player sprite, and setting up his movement. Everything was super streamlined. I remember getting everything setup with my original entry being such a hassle. 

After that, I changed the snow particle emitter from an earlier example to go from right to left, removed the wobble, and used circles (disks) instead of the snow texture. This created the scrolling star background, but the stars are completely random in size and speed, unlike a static image that scrolls. It gives the game a ton of depth, and really makes the look. Later I made the particle emitter persistent, so it stays between room changes, and placed it on the title menu, so the background never stops or resets from the title screen to being in-game.Its the little things like this that people won't always obviously notice, but would definitely miss if it wasn't there. Anywhere you can add subtle things like that, do it.

Enemies are extremely stupid AI-wise right now, there are 3 that were manually placed just off the screen, and all they do is fly right and shoot constantly, but they'll be a tad smarter by tomorrow night. I also want to make an enemy-spawning object tomorrow, so that way they keep showing up until the user loses/dies.

Added in shooting next, all I had to do was throw a direction of either 0 degrees (right), or 180 degrees (left), give them some speed, and I could create them to my hearts content. I made it so they automatically remove themselves on 2 events, either going outside the bounds of the room, or colliding with a person of the other faction. When each ship collides with a bullet of the other factions, they subtract 1 health from themselves, and the enemies can take 2 hits, while you can take 3. 

Then I threw the title screen in, made an object with no sprite to draw all the title graphics (with custom fonts!), and another object with no sprite to wait for keyboard input to move to the next screen. 

From here all I added the character's ability to draw his UI, which for now is just his health counter, and I was done for the day. I clocked in at just over 2 hours. That's right 2 hours, and I'm just over halfway done with remaking a game that originally took me 48 hours to make. 

Holy. Montana.

W, A, S, D, to move, and space to shoot!

Here are some screenshots



Total coding time was around 2 - 2.5 hours.

Source Code

The source code/GM Project file is zipped and available HERE, from my website.

Conclusion

I'm floored. I've cut roughly 7-8 hours off this development cycle already. I did more today, in 2 hours, than I did during the first day of the LD competition, in about 10 hours. THAT is progress. It should be noted that you can't count all of the 7-8 hours I've saved, as I already have all of the game designed, I just have to code it. So maybe 6-ish hours of savings. Still incredible!

I saved the single hardest feature, the 'clone' ship, for last. The reasoning is that I relied heavily on custom objects and arrays in the JavaScript implementation. This is one area where I realize some of the disdain for GameMaker Language, it does data structures differently than every other programming language I've seen. But I'll power through tomorrow, and have an awesome product at the end to boot!

See you guys tomorrow, for the epic conclusion!

Thursday, September 5, 2013

GameMaker: Day 5 - Persistent Persistence!

TL;DR

GM has awesome features, but it's arrays aren't exactly fun normal. Neat project today. Tomorrow I start my 2 day re-build of Samsara!

What I Did Today

I've wrapped up Shaun Spalding's Youtube video series on GameMaker Studio today.  Pretty informative. He touched on some topics today that I wasn't sure he would. One such topic was basic error/bug fixing and tracking. This is an amazingly useful skill for anyone doing anything related to software development.

There were quite a few topics covered today specifically about GM Studio. The first I want to talk about is changing rooms. Seems like something simple, but it was something I hadn't done just yet. Gm has two ways of changing rooms, by either specifying the name of the room you want to load, or by loading the "next" room. GM decides that the next room is going to be the one below it in the Rooms folder on the Resources tab/explorer which is on the left of your GM Studio window. This allows you to go between menu screens, switch to a game screen, and go between different rooms/screens in the game (think Zelda on the Super Nintendo, how when you walk to the right off the screen, you appear on the left side on a new map!). This brings up the next topic, persistence.

Persistence is the ability for an object to stay 

Then I started seeing where some of the limits to GM are.

Arrays. Arrays suck in GM Studio. There's no way to sugar coat it. The arrays themselves don't know how long they are, or there isn't a way for them to find out. There is supposedly a function you can pass an array to which will return it's length, but when I used code from Google'ed examples, hell even the documentation example, it would error and say that it wasn't a method. ( EDIT::9/5/2013::This is not true, just update GM Studio to 1.2 and the documentation example stops throwing errors) This can be a huge turn-off to many people with a programming background already, because we love arrays. They do one thing, and do it well, at least they do normally.

A solution to this problem that kept popping up online was to use GameMakers build it data structures. Let me preface this next part with this, "Data Structures solve the array problem posed above". Ok, now that that's cleared up, I'm not really fond of I hate data structures. Why? They're a memory leak just waiting to happen. For those of you unaware of what a memory leak is, let me explain. With most things in memory, when you're done with them or cannot see/access them anymore, part of your program called the garbage collector comes around periodically and collects these things in memory (variables, images, objects, ect) and destroys them to free up that space. Sounds great, no? Well with data structures, if you don't explicitly say to GameMaker Destroy data structure 'X' when you're done using the data structure, it stays in memory, FOREVER until your program ends. It doesn't sound too bad at first, but it's a real problem. It's not just when you're done using it, it's anytime your program will stop seeing it, so anytime you destroy an object with a data structure, or switch rooms, ect, you have to make sure to destroy that data structure. If you don't, even though specific version of your room is gone forever, that data structure lives on in your memory. Do this enough, and with enough different data structures, and you could literally fill up your computers memory (though you would have probably stopped playing by them, it can still slow you game down drastically).

"But Nick, why can't you just remember to destroy them?"

Oh, I can, that's not that hard. But it's part of the reason I'm trying GM Studio, is to get away from all the pesky gotchas and tedious code of programming everything by hand. I'm probably just overreacting because of the array thing, but it's still a valid concern.

On a positive note, you can make extensions/plugins for GameMaker, so I think I'll look into making an FULL array extension!

Today's project isn't truly a game, but it looks like one! It starts with a title screen, which you press space to load another room! This puts the penguin in a blue room, with some snow particles. You can move with W, A, S, D, and the other thing you'll notice is the pads marked "WARP". They allow the penguin to go to the other room (red/blue). What's cool is you have penguin and snow particles in each, but technically they're the same objects, they're just persistent, so they carry over to every screen, until I change that.

Here are some screenshots

 





Time coding was about 15-20 minutes.

Source Code

The source code/GM Project file is zipped and available HERE, from my website.

Conclusion

Despite the array fiasco, GM is still pretty awesome. What I made today took about 15-20 minutes, and would easily have taken me an hour-ish or more to do by hand. Besides the array deal I don't have much to complain about today.

On another note, tomorrow is day 6, so I'll start trying to rebuild Samsara! I'll be rebuilding the entire game in 2 days, so it will be just like the Ludum Dare where I made it, except I expect to get more done, with less time to work on it.

EDIT:: 9/5/2013
It has come to my attention that updating to GM Studio 1.2 solves the problem of the method shown by the documentation throwing an error. So it's not that bad anymore. Still gonna try to add a full array, because passing an array to a method to get it's length feels dirty. :/

Wednesday, September 4, 2013

GameMaker: Day 4 - Room with a View

TL;DR

Let is snow, let it snow, let it snow!~ Snowing particles, that is. Also, have you SEEN this view? It's quite moving. (Bad puns ahoy!)

Oh, and double jump. Almost forgot that one.

What I Did Today

I watched a couple more of Shaun Spalding's Youtube videos today. While they are very instructional, he's starting to focus and show how he uses the built in Contents/Help menu (F1) to find explanations and documentation from within GameMaker on all things GM and GML. I've been using it sparingly for a day or so, but spent some time exploring it simultaneously while watching today's videos.

If you haven't checked out the Contents/Help documentation yet by hitting F1 (or haven't checked out GM yet), I'm telling you that you are required to right meow now.

No arguing, this is important.

Learning the basic names of sections and how to navigate the built in documentation will make you a better developer in the long run than any trick you can learn in a video. Yes, videos and tutorials can be EXTREMELY helpful when starting from nothing, but once you have a decent grasp on the basics you need to learn to stand on your own. Knowing how to look up things puts you one step closer to solving your own problems with Google. Yes, Google is great, but one day you're going to run into some bug you can't solve or fix, or some feature you want to implement that NO-ONE has, and there won't be a single tutorial online on how to do that. These tutorials get my super-two-thumbs-up-of-quite-a-lot-of-approval-indeed because they don't just show you haw to do 'x'. They DO show you how to do 'x', but also tell you why you're doing it this way, and show you how to look up helpful things related to it in the process. Flippin' awesome.

Today's project is an expansion of yesterdays, so it's a platformer. The first thing you'll notice is the snow. It's a particle system/emitter that randomizes the size/speed/wobble/lifetime of the snow particles and creates them. After that you'll move around and notice that I implemented a camera system. Literally 0 lines of code, just filled out some fields. Literally. The only code I wrote related to the camera/view is in setting the positions for the UI text. Also, we learned about the depth of things inside the room (level), and how this affects the order in which things are drawn (snow in the back, the level & penguin, then the text. Then we streamlined some of the code for collisions and jumping, and added double jump! (And correct ceiling collision) There are still a couple logic errors where you get hung up on corners when you approach them a exactly the right angle, but For something I threw together in less than an hour I'm pretty darn happy about it. I've written (and then had to test and RE-write) collision code before, and believe me, it sucks. And takes forever. And sucks. Just be happy that GM lets you get something up FAST, and then later you can smooth out the rough edges.

Here are some screenshots



Time coding was about 20 minutes.

Source Code

The source code/GM Project file is zipped and available HERE, from my website.

Conclusion

I'm getting excited about GameMaker. It feels weird, even doing things I would find boring coding completely 100% by hand before (particle systems, collision, ect) are a breeze in GM with GML, and I get them done in LITERALLY a fraction of the time. I'm trying to keep my cool when using GM, but I'm starting to feel like a kid learning to program again! Everything has been fun with GM.

I wonder if there are any arcades close to me in San Fran?

Tuesday, September 3, 2013

GameMaker: Day 3 - Quite the platform.

TL;DR

Platformers. PLATFORMERS. PLATFORMERS!!!1!! METROIDVANIA JUMP-N-MOVE PHYSICS TODAY! Not bad progress for 30 minutes of coding.

What I Did Today

Today was one of my shorter days, we're starting our big final projects at App Academy(the hacker school I'm at), so my time/motivation was all there today. BUT, that doesn't mean I forgot about my pledge to give GM a week of my time.

I started off the day watching the 10th episode from Shaun Spalding's Youtube videos and man, they're getting a lot longer. No extra GM content that I won't need, as he's started showing (almost) purely GML ways of doing things. He also went over some programming concepts, and while I already understood how a loop worked, seeing some of the intricacies of how GML handles them was nice.

The episode I watched today ended at just over 40 minutes, though I did pause once or twice to finish typing out some code. With typing while watching/listening (2 monitors, woo!) I would say I finished the video in just over 50 minutes. I enjoyed the video, and some platformer concepts were introduced and explained also.

Neat.

After the video I did some experimenting, didn't like the results, and put my code back to using a fixed step. I'm too tired to work out the exacts of gravity with delta_time, sue me. Just over an hour spent watching videos/coding, and I have basic platformer collision and movement?

Awesome.

In today's project you can move left and right with W and D, jump with Space, and there's even gravity! Have a blast, and look at the code. Today's code is pretty much Shaun's tutorial code, I'm not focused too much on platformer mechanics at the moment, so I really couldn't change much.

Except to use delta_time, but I'm too tired for that nonsense. No reason to do it if I have soemthing working today! 

Here are some screenshots


Time coding was MAYBE 30 minute, tops. Did so while watching the video and a tad afterwards.

Source Code

The source code/GM Project file is zipped and available HERE, from my website.

Conclusion

GM is turning out to be crazy. I spent less than 30 minutes coding (including experiment time!), and STILL had collision detection and jumping working, though they aren't the most elegant solution. I'm scared to say I'm amazed with GM. I'll keep looking for big shortcomings, and praying I don't find them!

Monday, September 2, 2013

GameMaker: Day 2 - Whats up with that Penguin?

TL;DR

Shaun Spalding has good GM videos. Today's project lets you shoot lasers out of a penguins rump... IN SPACE!

What I Did Today

Today I continued my day old tradition of watching video tutorials on GameMaker Studio. With me having already watched all of Wizirdi's Youtube videos on GM Studio yesterday, I needed something else. Luckily, after wading through some horrible videos, terrible audio quality, and lackluster content, I landed at Shaun Spalding's Youtube videos. VERY good videos.

While I enjoyed the humor from Wizardi's videos, it really didn't serve a purpose, so I'm not disappointed that Shaun doesn't employ the same tactic. However, Shaun does have content of a similar level of quality to Wizardi. Shaun actually has more GM Studio videos (19, compared to 11, though Wizardi has a BAJILLION on GM videos not specifically tied to the new Studio version, like a series dedicated to designing a full game in game maker, and 42 videos on GameMaker Language), and they're a tad longer, but I think I know why.

Shaun explains all of his examples first using the drag-n-drop method (ewwwwwww) and then with the supa-awesome-o GML version. I got through 9 of the 19 videos today, and must say, they're great. After the first video or 2 the way he starts explaining things becomes a little more high-level, showing you what you're doing, and why you need to do it, instead of just telling you to write code, or drag blocks over. This is exactly what a tutorial needs, so that way when the video is over you actually understand the underlying concepts.

I'm pretty pumped to finish Shaun's videos, he's going over platformers next, and I have no clue how to most efficiently do stage collision.

Today's project is a shmup (SHoot-eM-UP), because I'm gearing my learning towards the Samsara remake I hope to have finished after this week with GM. It's looking like I'm going to blow that target out of the water.

With today's project you can move you penguin with W, A, S, D like normal, BUT you can also use the arrow keys to rotate the penguin! This plays into the next thing I added,  bullets! You have two ways of shooting today, the spacebar will let you shoot forward like you would expect, but pressing or holding the ENTER key does something awesome! Instead of shooting in a predefined direction, the bullets shot from pressing enter shoot out at an angle relative to the penguin's rotation.... out of his rump.

Why do the laser bullets shoot out of the penguins rump? Why is the penguin in space?

Because why the hell not? (Also because the "space" is a scrolling, tiling, infinite background! Something else I wanted to do.)

I also got text displaying in a different color, wheeeeeeeeee!

Here are some screenshots

Total time coding was probably less than an hour. I was sporadically coding while watching the videos and a tad afterwards.

Source Code

The source code/GM Project file is zipped and available HERE, from my website.

Conclusion

I'm really enjoying GM, but I'm not getting my hopes up yet. I'm seeing a HUGE dropoff in time that I have to spend coding, but I've only worked on 1 type of game so far. With platformers in tomorrows videos, we'll see how it goes!

Sunday, September 1, 2013

GameMaker: Day 1 - Why the hell am I doing this?

TL;DR

I'm trying out GameMaker Studio for a week, to see if I can be more efficient at creating games with it. By the end of the week I want to have re-made my LD27 entry, with MORE features.

Preface

What?! Nick wants to use GameMaker? Doesn't he know how to program? Is he crazy?

Yes, yes, and yes.

Despite the fact that I know multiple programming languages, I've decided to try using a game engine, specifically GameMaker Studio, for future game prototypes and projects.

Reasoning/Backstory

I've been (kinda) programming for over a decade, doing it seriously for about 5-6 years. I've been seriously making games (as a hobby) for about 2-3 years. It's something I've always done in my spare time.

Recently though, I've been losing more and more of my free time normally for gamedev, due to my life actually getting together, and being accepted to a hackerschool/developer bootcamp (App Academy, if anyone is wondering. Go check it out, it's awesome!). Because of this, during the Ludum Dare 27 game competition, I had a realization near the end.

I didn't get a LOT of the polish features into the game. There isn't even a score. The enemy path finding is non-existent. The enemies can only shoot straight. There's no story or end. While I WAS able to get the "reincarnated" clone to follow your actions and shots, with a 10 second lag (which is AWESOME, if I say so.) , I just couldn't get anything else done ( By the way, my entry is Samsara, play it for 30 seconds? ).

I decided that even though I consider myself a damn fine programmer (no expert, yet!), and I know multiple languages, I'm just not efficient at creating games with my current flow. This is a problem. I don't have globs of time just lying around for me to piddle away. I need every second to matter. Because of this I decided that I would give game making engines another try.


Why GameMaker

 This isn't my first foray into using game creation engines. I've messed with Unity, not extensively, but enough to realize that it was still to cumbersome for simple game dev. A lot of the engines like Game Salad were too focused on non-programmers. I was looking for a middle-man between taking some of the boilerplate work off of me, but still giving me a lot of control over whats going on. Being able to script almost everything I want is a MUST. It came down to 2,

Construct 2, and GameMaker Studio

After some deliberation, I decided to go with GameMaker. After watching lots of videos on both, and doing tons of reading, GameMaker appealed to me more. I'm NOT saying Construct is a bad choice. I'm just saying that it doesn't appeal to me as much as GM does. Both platforms can push to multiple other platforms (including mobile!), but it seems like GameMaker has less problems pushing to other platforms, but don't let me mislead you, GM DOES have bugs. No program is perfect. But I was also swayed by seeing the breadth of products that have been made with GameMaker ( I had no clue Hotline Miami was made in GameMaker! ).

GameMaker it is!

Whats Going to Happen

I've decided to see what I can get done and learn with GameMaker in a week. That's it. I've looked, and I can give at LEAST 1 hour a day to GameMaker this next week, and possibly up to 3 hours on 1 or 2 days. By the end of the week, I want to have a re-made, and more complete version, of Samsara. If I can learn enough about GameMaker and GML(GameMaker scripting Language) to create 

What I Did Today

I started today by downloading GM Studio, and picking a tutorial to get up and running. I ended up at Wizirdi's Youtube series. Not bad at all. Some of it felt too slow, but I attribute that to the fact that I already know how to program. Even with that, his videos are short and concise, I definitely recommend checking his videos out if you're looking to get into GameMaker.

I spent somewhere right around 2 hours watching his videos. I didn't do the exact code he did, and I experimented some, pausing the video to brush off my Google-fu. I did pay attention to what he was saying and typing, but I was changing it to what I was doing, which was just trying to get many different ideas incorporated into one "game".

I ended up with a neat little keep-away game. It's nowhere close to being anything substantial,  but it shows off what 2 hours of GM videos and tinkering can teach you.

You basically move the penguin around with W, A, S, and D. The sprite is constrained to the dimensions of the window. By pressing the space bar the game creates enemies that move towards you, and you can destroy them by left clicking them.

I also learned about drawing text, and concatenating strings(text) with variables(values in the computers memory for things I need it to remember). Your penguin has health, and it is depleted by being touched by one of the enemy angry-faces. If your health hits 0, the user is prompted about the game being over, and it restarts!

Here are some screenshots



Source Code

The source code/GM Project file is zipped and available HERE, from my website.

Conclusion

For spending 2 hours with GM, I feel like I learned a HELL of a lot. I'm not messing with any of the drag-n-drop scripting things, I'm doing all events with code. Which is nice because GML seems to be the love child of C++/Ruby/JavaScript, all languages that I know, and the last 2 are languages I know pretty darn well.

Lets see how far this goes guys, I'm hoping it pans out. If not, I've only wasted 7-14 hours.

Also, check out the GameMaker sub-reddit!