Gearend - 2D Metroidvania

I tweaked the Bloom filter to only affect brighter areas. I’ve tried this before, but I think I did it correctly this time. I used to use a luminance calculating function to compute overall brightness, but this would fail on certain colors that actually would be pretty bright (like red). Now I’m just getting the maximum value between the three channels, which is enough to tell what should be “Bloom”-ed and what shouldn’t. There used to be a noise function tied in to make the bloom more interesting to look at, but I can’t really get it to work with the shader since it’s selectively blooming stuff, so whatever.

This looks quite nice**

Thanks, BPR.

The past few days I spent refactoring my game code and refactoring my BGHelper module. It’s basically a one-stop-shop for everything I’ve been working on, and while it’s not as full-featured as my BGHelper module used to be, it’s a lot easier to use and has some nifty features.

I’ve finished (?) refactoring my Sprites module to act like a Spritemap in other engines. Rather than the cumbersome “set variables and then use a function on the sprite object” method I used to have, a Spritemap is just an instance of a class. You create a new map, define animations, and then play them:



sprite = obj.children['Sprite']

obj['sprite_map'] = Sprites.SpriteMapMesh(sprite)

obj['sprite_map'].add('Run', ['PlayerRun', 0, 1, 2, 3], 15) # Creates a new animation named "Run" with the actual animation of ['PlayerRun', 0, 1, 2, 3], and an FPS of 15.

# . . .

obj['sprite_map'].play('Run') # Plays that running animation.


I also added some other nice features to the module, like the ability for animations to only play once before having to be manually restarted, and the ability to check to see which animation is playing currently. It’s pretty interesting. Kinda awkward porting the code over, but interesting.

EDIT - UPDATE:

I am currently refactoring the game’s core code. Instead of using functions for everything, I’ve started to use classes and instances. This was mainly to have code completion through PyCharm, but it also is very, very useful as it allows me to fully exploit inheritance between objects and sharing code. For example, both “advanced” NPCs and the player can share code, and they can also share functions (gravity handling, jumping, or dying, for example). It’s a lot cleaner than the past way my code worked (in which the “class” instance was stored in a variable, and then the class’s methods were called through that variable, like “obj[‘character’].HandleGravity()”).

I am ALSO refactoring the enemies’ code. There are only two enemies currently, but they used to run functions, and each basically had their own code bases (even though they did a lot of the same things). To solve this, I decided to implement a system called Behaviors.

Basically, each instance of the Character class (including enemies) can have one or more Behaviors running on it at any given time. These Behaviors could range from things like following the target to escaping from it, shooting at a target, dodging attacks, blocking, and so on. This allows for basically the maximum amount of code re-use between enemies (as the enemies will look different, but perform the same in the code).

All I have to do to set up new enemies is to define their unique properties (how much health they have, how much Scrap they drop when defeated, how much attack power they have, etc), define any new Behaviors if I need to, and add them to the character. This should make it a ton easier to define new enemies as well as new behaviors, as well as troubleshoot when problems arise.

Each Behavior is an instance of a class. This allows me to have tweakable variables that are easy to edit. For example:


self.add_behavior(self.Behaviors.Follow(min_dist = 5, max_dist = 10, max_spd = 10))

… Adds a new following behavior that makes the following character stay at a distance of between 5 and 10 units away and have a maximum move speed of 10 units a second. There’s also other variables in there that have default values I didn’t tweak. The handle_behaviors() function in the character’s class handles carrying out these behaviors. I can also remove behaviors later if I need to.

I recently thought of having a weight value for behaviors, as well, to influence either which ones take precedent over others, the chance that the behavior is executed, or the degree to which the behaviors happen. I haven’t decided exactly, but I think it could be useful to add in (for example, weighting Escape more than Follow could make a more skittish enemy that runs away from you a lot more than follows you around?). It feels like if executed correctly, this could kind of be pretty organic…

I’ve also come up with the idea of Random and Sequence Behaviors. These should be useful for unpredictable and bosses respectively. A Random Behavior will execute one of a set of behaviors randomly (i.e. choose between escaping, shooting, and blocking). A Sequence Behavior will execute a series of Behaviors in a row, like a boss would (i.e. shoot, shoot, wait, follow, jump, wait, and repeat).

One thing I’ve yet to approach are enemies that physically behave like the player, with parts that can be equipped, for example. It’s definitely something to consider.

I think I’m getting / have some cool ideas for gameplay mechanics - the combat might even be a bit out of the ordinary… :o

Yeah if each enemy is a mix of player usable parts… that could make it interesting… especially with rarity etc.

Seems like retro-gaming become more & more popular! Very nice game

The behaviors sound cool! I’ve recently thought of something similar for my own project which (will) involve a lot of sword to sword combat.
Instead of behaviors I would have skills sets, for example, an AI setup (simplified) would look something like this:
reaction speed: 5/10
sword skill: 10/10
defend skill: 1/10

This would make an enemy that would react to player attacks semi-well, can greatly attack and counter but has trouble defending attacks (don’t know how to properly defend).

Also, it seems like this game isn’t really a mini-project anymore like how you made it out to be in the beginning.

Nonetheless, I’m excited to see more!

Spent the last few days refactoring the enemy AI some more. I’m pretty much done, which is awesome.

I expanded the behavior system to include BehaviorTrees. A BehaviorTree is just basically a list of behaviors that can be added to or removed from. You can also toggle behaviors that have been added and get Behaviors that have been already added to the tree under a certain branch, so you can make some complex AI out of those behaviors by turning on or off behaviors as necessary.

For example, you can set up a “rush” behavior that will have enemies rush the player, shooting and attacking with everything they’ve got, but when they see the player’s shooting, then they pull back and toggle on a “defend” behavior to block attacks.

This behavior execution is also available on all CCharacter instances, so even the Player can execute Behaviors. This would be very useful in a co-op situation in which the Player’s AI could easily take over if the Player leaves the game, and Follow around the remaining player, shooting at enemies and dodging attacks and stuff. It could also work against the player, as if you’re controlling an unwilling robot as it does its own thing.

Although, more traditional behavior trees seem to be a lot more effective and sound really cool for more complex AI (if I understand behavior trees from other sources), I don’t think I’m going to implement them. While it would be nice to have cool advanced behavior systems, for my purposes, I don’t think I’ll be needing entire Behavior systems. Most enemies will be single-minded in their strategies, and bosses will probably choose from a selection of behaviors or perform a sequence of behaviors.

Anyway, I also refactored the weapon system a bit to make it easier to use and understand (for myself, of course). The weapons are instances of a weapon class that stores weapon-related variables (how much attack power the weapon has, how quickly the weapon fires, etc).

I’ve also come up with a few more parts (haven’t implemented any more yet, though). I think one of them will be fists that enable combos and charge solar energy while attacking. I have to iron out exactly how all of the weapons and parts will work, though - some parts will be passive in terms of their abilities (i.e. freeze time when you take a lethal hit), while others seem like they’d be best suited to have an active ability. However, I don’t think I want to have additional ability buttons if I can avoid it - there’s already a few buttons I’m using. This means that the abilities would have to be intuitive to the mechanic of the part - for example, if I have double jump feet, then you would just press jump in the air, and not the “foot ability” button. That limits the customization a bit, but I think it would make the game a lot easier to play.

I added a Collision() Behavior that allows me to make characters bounce on colliding with specific types of terrain, or do other things on collision, which is cool. Behaviors are kind of like Components, but they themselves don’t do anything. I feel like this might be a weakness in my code, as if the Behavior handled the actual execution, then I’d be able to test a Behavior to see if it executed correctly (useful for some Behaviors, like the Collision one), which would help to make those more complex Behavior Trees. I could test Behaviors anyway, but it wouldn’t be as clean. But I don’t really need it, so it doesn’t really matter. I’ll make a video showing my code base soon - I know some people are interested over on my YT channel.

I also added sprites flashing red for characters whose health drops low enough. Because both enemies and the player inherit from the base CCharacter class, they both display this effect, which is cool.

I tweaked the Bladed Sentry to become way more aggressive when it turns critical, which makes it an interesting enemy that’s not entirely predictable. On second thought, maybe I’ll make it so that it speeds up after it’s been attacked - that would be a more dangerous enemy, for sure.

I want to create new enemies, weapons, and areas (or at least spruce up the areas I’ve got already) soon, which should be a lot of fun.

Anyway, here’s a GIF.

https://lh6.googleusercontent.com/-XIFZVMcjCJQ/U7O_czY3gXI/AAAAAAAAAgc/CxJVtBVrEXM/w320-h240-no/GearendNewBehaviors.gif

Very promising and a great advocate for the BGE! Great work SolarLune

Refactored my weapons code considerably, moving the weapon shooting code from the player to the weapon classes themselves. I added a Bipedal class for characters like you (that can equip two weapons) and gave each such character their own copies of the equippable weapons (so that they can wield weapons too). Haven’t made any Bipedal characters yet other than the player robot, but laying the ground-work’s important, too.

I also added rockets and rocket jumping. Not sure if I want to keep rocket jumping in there as a solution to puzzles, but I like the mechanic. :slight_smile:

https://lh4.googleusercontent.com/-raweR68qqCg/U7penr7BskI/AAAAAAAAAhA/kwb32SHAom4/w480-h270-no/GearendRocketing.gif

https://lh5.googleusercontent.com/-3UDE9gn5YmE/U7penpNekaI/AAAAAAAAAg8/hyT7hAQwQo8/w480-h270-no/RocketJumping.gif

MMMMMAAAAAAANNNN that looks sweet as balls.

Hey, thanks, hellooo!

Here’s some more devlog vids!

Part 1
Part 2

Cool project! I’m glad I found this thread and your dev logs, 'cause incidentally, I’m working on a 2D ‘metroidvania’ game myself, and I’m always looking for game development insight and examples from other people.

SolarLune: this is one awesome game shaping up, I love it, it shows your really putting creative soul into your project. Very talented “correction” skilled game designer can’t wait to see more updates…

^ Thanks, you guys! Glad you find the devlog interesting.

I’ve done quite a bit in the past few days. I was thinking about crowd-sourcing this, but I think I’m going to bypass that and just try to finish the game. I also want it to be a bit short (so that I can finish it). I’m probably going to cut a lot of the ideas I had (like upgrades and optional missions). However, the game should still be Metroidvania like, with hidden areas and cool items to use.

Anyway, I’ve started on another area - a nautical research facility.

The background still needs some work, but I think it’s coming along okay so far. I’ve also got the player bobbing around in the water (a bit unrealiably at the moment, though, haha). Need to refine it, but it’s coming along.

As a side-note, I made a wrapper class that allows me to reliably access specific faces of a mesh, which is really, really useful, as the BGE has no guarantee about giving you the same face whenever you ask for a specific one (i.e. changes to the mesh might change which number corresponds to which polygon).

Your only real option is to use either UV maps or vertex colors if you want to “select” a polygon in code, and those options are limited. This way, you can find polygons using just the knowledge of how the mesh identifies its polygons.

Anyway, I’ll commit it to my SVN page sometime soon.

It’s been a little while sine the last update! In that amount of time, I got some stuff done, and also rebooted (?) my old devlog blog, which should make it easier to have a single place for updates and information. Here’s a X-Post.

[TABLE=“class: tr-caption-container, align: center”]

http://4.bp.blogspot.com/-beNgVJAH5h4/U-CT1A5JpiI/AAAAAAAAArk/UD5ALOHogGM/s1600/camelot_yes_no.gif

[/TABLE]
Today I implemented a Camelot RPG-esque choice system into Gearend, as well as save stations. I say “Camelot RPG-esque” because Camelot is a game company that made different games (usually RPGs) for handheld consoles, and they usually expressed choices this way - via emoting heads. I liked the idea, so I thought I’d make a similar system for Gearend.

I felt the need for this because I had no way to allow the player to choose either to save or not when they approach and interact with a save station. Now, it gives you the option with these rather excitable heads.

I also worked on a new arm part, as well as the first boss’s graphics. I hope to finish the game quickly. Thanks for reading this tiny update!~

You going to have some castlevania synphony of the night style animation sequence to save/load when you make the choice to save?

looks great SolarLune keep going…

BPR - Ah, maybe. Gotta think about it.

hanzo - Thanks! I’ll try to.

http://3.bp.blogspot.com/-YWDK5l5fn6w/U-M3va6NA7I/AAAAAAAAAr4/E1XVwT17H2c/s1600/Shield.gif

So today I added some basic cruddy particles to the Railgun, and added a Shield. Both should be nice items to get in-game (especially the Shield). I also added the basic functionality that was missing to have different animations for the different use states of the item (i.e. the shield has an “idle” state and a “use” state).

I also drew up this dude as the first boss (the new one’s on the left):

http://3.bp.blogspot.com/-7ezIMcCN2sI/U-M3TvhN-fI/AAAAAAAAArw/zy_jpJPdNuo/s1600/GottaAnimateTheseDudes2.png

Not sure how I’m gonna animate him, but I like him, I think.

Hi Solarlune…
I totally love your particle effects!

The end boss looks nice already. I have a few crits! I know you are working with a limited color palette and I have to admit I am not very familiar with pixelart.
I made a small overpaint to show what I mean. I would try to give your character a bit more color variations. Most of your character looks overall the same, concerning the shading. Try to put some parts deeper into shadow, this will increase the dramatic and will make him look more interesting. For example put the legs depper into shadow and make his feet a bit brighter, this will let them pop out a bit more.
I also would give him smaller legs which makes his upper body bigger and gives him a more powerfull body/look I think.
Hope this helps you a bit.

I also think that someone can combine traditional pixelart with more modern technics as concerning color blending and stuff!
But thats only my opinion :slight_smile:

Thanks, ndee! That edit is wonderful! I’d like to incorporate it into my design if I can somehow, so I’ll see about that.

Animations~

http://3.bp.blogspot.com/-77KI5hvYwZU/U-2-kZiXVTI/AAAAAAAAAtc/9DI_sZRyips/s1600/Animations.gif

Starting to animate this big guy. I think he might be a bit difficult, so perhaps he’ll be the second or third boss; the first one will probably be something a bit more your size, which should give me a good chance to test out a Bipedal enemy (an enemy that can equip two items, like you).

I’ve been listening to this song from the fighting game Under Night In-Birth because it’s awesome and I need some rockin’ boss music. Gotta step it up on my music, too!

I’ve implemented another enemy that just sits there and shoots and aims at you; nothing really impressive, so no GIF of that. Just some simple stuff here and there.

So, work continues on my projects. For Gearend, I decided to make the first boss a bipedal robot like the player character, which should make it easier to design and work with. I’ll introduce him a little bit when I get him into the game, but he’s going to be kind of an interesting character, I think.

http://2.bp.blogspot.com/-C9-V4sThTPo/VBGIRPgtNrI/AAAAAAAAAvo/o8u_o-iVhMk/s1600/Upgrades.gif

Today I implemented Energy and Health Upgrades - they’re RAM chips and Hard Disks in-game. When you pick them up, they give you a little message about what was on them from a time when humans were prevalent, like “You can see a small puppy sniffing the video camera.”, or “It’s a video of a middle-aged man returning home to his wife and kids.”

(Yeah, I know RAM chips can’t store data when they’re unplugged, but whatever, I’m trying to make them interesting.)

Just something to make it interesting to pick up the upgrades, kinda like Earthbound’s flavor text after you go to the different points of interest or whatever.

Also, I did some room design today, and fixed up some of the music to be more pleasing, though I might remake the village theme altogether because it kinda sucks as it is. :1

Gonna keep chugging away on this!~