Friday, May 20, 2016

Game Saves

Well folks, this might just be the final piece I needed before heading into a real level! I was intimidated by the idea at first, but it turns out making a save file and reading it is not very hard at all! A quick tutorial and a few experiments let me see how it works pretty quickly. I'm not positive yet on how the saving will work in game, but at least know the basics.

So after figuring out how the saving works, I had to add some sort of save point. Since I'm deciding that the main character's base magic is Lore, I made what I call a Lore Well. I like how the look turned out, and I'll probably make ones that are empty that you have to collect Lore and fill them, who knows. Anyways, here's a look at what saving your game looks like, and I'm hoping that my next post might deal with the ACTUAL GAME! :D 

Thursday, May 19, 2016

Lore Casting, text boxes, and even a quest!

Boy oh boy the progress has come like crazy this past week! Work has kept me super busy but I just can't help working on this stuff late into the night (hence the 2:30 AM post...) But I am super excited about the progress I've had! I'm at the point where I want to start funneling the game into an actual level, and hopefully even story line soon. So here's what has come as a product of that plan:

As I thought about somewhat of a story line, I realized that there would need to be a progression in the spells. It wouldn't be all that fun if you automatically started the game out with your amazing flame jet-pack spell, so I started thinking of what a base spell might be. I've been leaning a lot more towards using the idea of "Lore" as the core magic of this world, so I came up with the idea of Lorecasting.


Basically it will be a fairly simple magic that is pure green (like the little lore wisps that float around after you kill stuff), and the basic spell is just a shorter range, inaccurate ability to get you going. It actually ended up being really pretty looking, so I'm already getting the urge to go beautify the other spells. But I won't get carried away with that just yet :D
I'm not sure if you can hear the sound, but I just have it using the fireball's sound now, so definitely expect a better, more lore-sounding one soon. Anyways, actually playing and fighting with this spell does just what I want it to. The limited range really limits what it lets you do, and you end up getting hurt quite a bit more than with the other long range spells.


Next big step I made was learning how to do text boxes! Luckily there's a youTuber who does plenty of Game Maker tutorials and had one that fit my needs really well. I haven't implemented a sound or anything yet, but I think the simple idea of having text boxes is really going to open my options up fast. This added feature quickly made me add in an experimental scenario where I made a basic little quest to test the behavior out. Here's a clip of my first ever quest, and I must say I was ecstatic when this actually worked.
Little bit of background on this video: if you notice, another feature I added is now the casting of different spells can be turned on or off. Going back to what I was saying before, I want the game to have progression, and up until now I had just been adding spells without any regulation. In the video, you might be able to hear me clicking the spell-change key, with no effect. Luckily I've made it so that the spell availability is dependent on a variable, so now I can change which spells are "unlocked"! This was actually more involved than I thought, because not only did I have to turn off the actual spell, but I also had to prevent the animation from happening, the element symbol from changing, it was quite the project. The clip just shows a little bit about how the locking/unlocking might work, and I'm really happy with how it's going.

So, next on my list of things to do is flesh out an actual level! I'll probably try adding in a save function as well, and just make this into the very beginning stages of what this game might actually be eventually! I've got tons to do on it, and am just so glad it's summer where I can work on this more. Hope to post again soon!

Wednesday, May 4, 2016

New Enemy and SOUND!

Summer is back and now I have time to work on this!

Coming back to my game, and after playing Enter the Gungeon (I definitely recommend it if you like bullet hell games) recently, I realized I just had to add certain things to my game. One of them being an "aiming" enemy, and the other being sound (finally).

So I have the idea of a little rock fellow that flings rocks at the player, so it was fun messing around with the math behind making him throw correctly. It seemed simple at first but it turns out there's a ton more to it than just making a perfect arc depending on the player's position. You have to take into account gravity, the way the height of the arc will affect the end horizontally, etc. It turned out pretty well though, and I feel like finishing this guy up sort of ushers in a new generation of smarter enemies. I'm excited to see what else I'll be able to do with this kind of behavior. He's not polished graphically, but here's a funny bug I documented whilst making him:

I always get a good laugh out of the random stuff that happens when you're adding new features.

After working on the rock enemy, I decided to get tinkering with sound. In my head I feel like this game would work well with sort of a SNES type sound, but I didn't have much luck as I looked for a way for me (I have no technical sound experience) to add sound. So, in the end I settled on more basic NES type sounds, and they've actually grown on me quite a bit. The sound in the video is a little muffled, so it's probably around 6 or 7 bit rather than 8 :D But you get the idea at least. I used the sound engine from here and it did the job really well. It's also super fun to play around with if you have a free minute. So here's a little low quality sample of what it sounds like:

I still have no idea what the music should/will be like for this game. I just found a platform feeling free one so I could at least have some background music.

So, those are the two main things I've been working on. As I've put in sound, I ran into some random things like cleaning up the death code for the player, making the turtle carry things better, merging repeated code between enemies, and a few others. It's just interesting to me how much code can improve over time. This semester I had a coding class that focused a lot on designing a full app, and it's interesting just how much of the ideas for bigger projects is helping my to polish up this game. Biggest lesson I've learned: do the dang thing right the first time. It's so much easier to start with good practices than to go back and try and fix things that weren't done right the first time. 

Anyway, there's my little rant. Hope you liked the update!

Saturday, February 6, 2016

Playing with math functions

The other day I played around in Cave Story for a bit, and saw several flying enemies. It got me thinking about how right now the movement of the enemies has followed pretty standard paths. Back and forth, jumping, bobbing up and down, so I decided to delve a little bit deeper into some math and figure out some better paths.

I decided to put this into use with the egg I finished a bit ago. I figured it'd be fun that if you broke an egg, little bats or birds would come out, and I specifically didn't want them to just fly back and forth. So, I went off on some basic experimentation and came up with some fun behaviors. Here are some examples from the game:


For the sake of documentation, and if anyone's interested, here are the formulas for these paths.

y  = move*(cos(counter*2));                                           y  = move*(cos(counter));
x  = move*(sin(counter));        Figure 8                          x  = move*(sin(counter));        Circle

y  = move*(sin(counter*2));                                            y  = move*(sqrt(sin(counter)));
x  = move*(cos(counter));       Rainbow                         x  = move*(cos(counter));       Up and down

y  = move*(sin(counter)^2);                                           y  = move*(sin(counter)^2);
x  = move*(cos(counter));       Back and forth               x  = move*(cos(counter)^2);    Stepping down

y  = move*(sin(counter)^3);
x  = move*(cos(counter)^3);    Square

The move variable is an overall scale, the counter is a value that is constantly going up to keep the sin and cos waves going. It's pretty interesting how these waves manifest themselves. The way they look on a plot is SUPER different when you combine them with x and y axis. Anyways, there's a bunch of math for ya!

Working on this one really got me excited for different puzzles and new enemies. I don't have any specific plans for the next one, but I'll hopefully be posting again soon!

Wednesday, January 20, 2016

Let the new AIs begin!

I feel like the next phase of development is going to largely be with designing new creatures to interact with. It has been quite a while since I've done any creature art, so that got me excited, and I also want to start making mechanics to make puzzles with in the future.



So, the first new addition is the Crawler! This little rock turtle moves slow, but adds in the mechanic of ridable objects. I don't know what I'll use him for, but I feel like there could be some fun puzzles to use him for.


Adding the turtle added in some interesting coding aspects. Game Maker's structure allows for objects to have a single parent (which is extremely useful), which can be used for things like all enemies having a common parent. This lets a spell react the same way to any enemy, rather than having every single enemy in the if statements. Anyways, the turtle is a hybrid in that he isn't just an "enemy" that can be destroyed, but also should be considered a solid so the player can stand on him. The problem was that the parent option doesn't allow for more than one parent. So I hit a bump because without the enemy option, the turtle couldn't ever die. Without the solid option, the player could walk right through him. I fixed the problem by adding another target for the spells to hit (I figured it was easier to add a few lines to four spells than to add a lot of complicated stuff to everything that interacts with a solid.)

So hopefully this is the beginning of a new era of updates with different enemies and characters to see! I've got a lot of ideas for fun new things to try. I don't know if anyone even reads these, but comment if you have any ideas of cool mechanics I could try out. To finish off, here's one of the funniest bugs I've seen in a while. I'm glad I got it documented.


Tuesday, January 19, 2016

Fleshing out falling mechanic

A long time ago I got the jumping animation all working, but since then the player has become much more... mobile. Since I've been playing with the fire jet mechanic, he has been getting a lot farther off of the ground, and falling a lot farther. None of the levels are that big yet, but I realized that this game needs some fall damage. 

There were a few ways I thought about doing this mechanic. I could make a set amount of damage once you had been airborne for a certain amount of time, or once you hit a certain downward speed. I could make the damage go up as you fell longer, or one that went up the harder you hit. I experimented with a few different ones, and it had some frustrating but interesting effects. The first option proved faulty because with the fire blast, you can change speed in mid air. So if you were flying around at a non-dangerous height and then landed softly, it would still hurt. The downward speed option fixed this problem, but after some testing it just didn't feel right to fall 10 blocks and take a fourth of your health, and fall 50 for the same penalty. So the last option looked like the best option.

To give you a little insight on the coding, falling is fairly simple. Basically there is a general gravity value that is constantly being applied to any valid objects. If an object isn't grounded, and it hasn't hit terminal velocity, the gravity is added to the object's downward speed. It's a very simple application but works like a charm! Anyways, this idea of terminal velocity made me realize that I could use a certain speed as the threshold to apply the fall damage. So that was the first step: once you hit about 80% of the max fall speed, the damage applies. Then, instead of just using a straight damage value, I made it start adding damage once the speed hits that level. Then voila! The farther you fall, the worse the hit is, and it works great! I'm sure this will require a lot of testing because I don't know what is a fair distance to fall and all that. Oh well, we'll leave that for the future beta testers :D

After the damage was being applied correctly, I realized that it just simply needed a visual cue. With this same idea of the terminal velocity, it opened in up perfectly to add in a falling animation. Up until now the player just looks down as he falls, but now I added a falling animation! It's nothing flashy, but it is fun to see his little arms flap in the wind. Aaaand also know when you are going to get hurt when you fall. Here's a little look at it. Don't worry, the anti-climactic "death" isn't the final project; I was just tired of seeing him explode in fire when he died.


Saturday, January 16, 2016

Controller Support

So contrary to the title... the Mac version of Game Maker actually doesn't support controller input :[ But luckily, there are very easy ways to map controller input to keys. So, after binding some keys to my controller, I was able to play as if it was a console game! Being a platformer and all, it is very satisfying to play on a controller. The main reason I wanted to look into this is because somewhere down the road I really want to make this multiplayer! A little face off arena would be super fun. Anyways, here's a little sample: