Category Archives: Code

Nitty-gritty technical bits.

Performants

As it turns out, OpenGL loves to check for errors after every call. This makes you spend about double the time in OpenGL every frame. We were going kinda crazy trying to figure out what the problem was; I assumed it was my fairly elaborate collision detection. But running the Python profiler exposed the truth, and now we’re at a happy 30 frames per second again.

Dungwall

This weekend gone, Fet and I managed to carve out a few precious hours to actually work on Paraplu together in the same room. The progress was substantial.

Most of the work we do on Paraplu is conceptual – either I’m making tiles outside of a level, or Fet is tweaking or introducing a new feature for which there is no art. It’s been very rare thus far that we actually assemble any of these pieces we have. Whenever I do attempt it, I am impressed with how quickly and easily it is possible to assemble something roughly game-shaped in a small amount of time.

With this, both of us are relatively inexperienced at some of the concepts associated with this. We haven’t either of us had much practice in making levels, or really thought about the consequences our current system has on level design. Each time we delve into this realm it is deeply enriching and we learn a lot in a very short while. Some of what we learning is surprising, and gives us an exciting insight into what our forefathers must have felt when designing their first experimental levels: getting an idea for how to direct the player around the level, to inspire a sense of adventure and curiosity through the lofty building bricks of Passable and Impassable tiles. It’s an artform, and the first time you put brush to canvas, it inevitably feels heavy and unfamiliar in your hand, yet the tantalising and powerful potential is there – through this medium you can fashion exciting, undiscovered worlds into a form that can be experienced by others.

And yet, once we had made a level and put some basic enemies in it, we were left with the “now what?” feeling.

Fet summarised it well, “What makes this game Paraplu?”. I have many clever ideas, most of them are most likely a programming nightmare! I’m usually too scared to mention them to Fet, but I often do anyway. Trying to expand the scope of the game beyond just killing enemies, without introducing complicated code is a difficult challenge. But, for the time being we must remain strong and focused. We can make levels quickly with a great editing tool, and you can do things in them. Next: learn how to make levels! That’s progress, and it’s really good fun, too!

Still feeling very inspired, have been working on Paraplu pretty much every day. :D

Objectives

Until today, the only way to finish a level was to kill all of the enemies in it. Of course, with our new infinitely enemy-spewing doorway thingys, there would have to be another way. I set up an objectives system that allows us to define any number of different conditions for beating a level.

In the process of testing out the “get a particular item” condition, I became stuck inside a rock. This has been going on since I put together the obstacle collision, and I decided to attack the problem. It turned out to be more difficult than I’d expected. At one point I had a crazy system that checked how many character pixels were overlapping with the obstacle, and compared it to how many would be overlapping were the character allowed to continue on her current course:

overlap.png

In the end, I just did a simple series of four checks (which I originally deemed too tedious) to analyze the x and y components of the character’s velocity, and stopped either one if following it would result in a collision. This lets you slide along an obstacle if at least one of your axes of motion is still valid.

slide.png

mortalGuys

Hi! Tonight I implemented a bunch of stuff to add flexibility to our map objects. When an object is added to the map, it checks a dictionary of dictionaries of dictionaries to find out if it should have any special attributes. One of the possible attributes is an “initStep”, which is the name of a function to call one time when the object is created. This gives us a free pass to do anything we want with a new map object: add it to some special sprite group, give it a weird behavior, and so on.

The initial motivation for this was to be able to create crazy puzzley situations like an enemy spawner which constantly sends dudes across a space toward a hazard that kills them. This creates a sort of doorway of enemies that you have to blast through. Actually the hazard will kill any mortalGuy that comes in contact with it; that includes both enemies and the player…

Damage

Today I worked on the hit points system for the main character, and the damage and dying mechanisms that that implies. Now the character has a hit point total, can be hurt by enemies and their projectiles, and dies when reaching 0 hp. Pretty basic stuff, but it was taken out for the sake of simplicity when I copied the ship code over from Soft Landing, and it needed to be rewritten.

Thankfully, the code to do all this, including flashing Vivienne red and making her invincible for a short mercy period after taking damage, was quite easy. It only took about half an hour, and worked the first time I tried it!

This should pave the way for building our first few fun, challenging levels, now that the presence of enemies in them actually has some consequence.

Equipment

Over the past couple of days, I’ve done a lot of work on the equipment system. It was harder than I expected, but now you can equip various types of items that determine how your attack works. This is the core of the “algorithmic shooter” concept we originally devised together. In Paraplu, your attack is calculated based on three types of equipment. From our internal planning site:

– Weapon determines ROF, bullet type, range, damage.
– Costume adjusts ROF, damage, range. “Firing upgrade”. No costume should be objectively better than another, and most should offer similar factors of improvement. We want costumes to be valuable and interchangeable throughout the game.
– Accessory adds special effects of all kinds: number and direction of bullets, explode on impact, swirly paths, poison, fire, et cetera. “Meta upgrade”. Practicality of these can vary widely.

Mirror Match

I have got the mirror system working, basically. This is how you equip weapons, accessories, and costumes. It was remarkably difficult to make a system that simply opens up a menu, then opens up another menu based on the item you chose. Those old NES RPGs full of nested menus must be a lot more sophisticated than I ever imagined.

But, in the process of getting that working, I really refined the whole concept of the focused (foremost) interface box, and the management of interface modes. Now the game always knows pretty clearly what is going on, and it should be easy to add more multiple-step interfaces.

I also factored some code out into functions, for doing common things like figuring out the selected item in the foremost menu, constructing the syntax needed to show an item’s icon and name side by side, and unfocusing the focused box.

equip.png

Cabinet vs. Wardrobe

Not a whole lot of work today, but I’m trying to keep some momentum going. I added a wardrobe object (with awful programmer art, of course) to accompany the cabinet object in the atelier. Now, different types of items are stored in the different containers: materials in the cabinet, and costumes in the wardrobe. We’ll need to add a vanity for accessories, too, once we have some of those.

It occurred to me lately how strange it is that at work I’m a designer who keeps his hands off the code, and in MOMO PAX I’m a programmer who keeps his hands off the graphics.

K Groove

I had a nice time coding in the little food court at Whole Foods today.

10685915

– After several hours of work, taught our most basic enemy how to avoid obstacles. This is way harder than it seems, and I had to write in a bunch of psychedelic drawing effects to visualize what what happening in the code. It turned out I was telling it to go in a direction only if any obstacle existed that it wouldn’t hit, rather than if there were no obstacles that it would hit.

– Fixed a weird string-length bug that became apparent when resetting the description box for an item.

– Started moving the main character to a specific spot on the screen when moving between areas, so that you can’t arrive stuck inside a bush.

A Groove

I was determined to get into a Paraplu groove today, because it was the first time in a couple of months that I had a significant chunk of free time to myself. After getting energized by some bass-playing, coffee, pinball, and Ar tonelico music, I sat down to plow through some coding and planning tasks. It went well!

– Designed a master chart for all enemies, the items they drop, item rarities, and crafting recipes.

– Wrote a system for enemy spawners.

– Added a spawning effect for when enemies appear from a spawner.

– Wrote the item drop probability system. Enemy types have the possibility of dropping one of each of a common, uncommon, or rare item. The probabilities of dropping one of these rarities of item, or any item at all, is customizable per enemy.

– Made it so that items you collect in adventures properly appear in your inventory when you visit your atelier.

– Filled in all of the items, rarity rates, and recipes for the items we have in the game so far. You can theoretically craft a Peasant Dress in the game now if you keep at it, but once I collected the ingredients I immediately got stuck inside a bush.

**Update:** I’m unstoppable!

– Subclassed Interface as TextBox and ViewBox, because once again that class had gotten huge. It was taking up half of the “guys” source file! Really cleaned up how the interface guys work.

– Added enemy portrait and description, in their own little boxes, to the bestiary system.

– Added item description, in its own box, to the inventory system. We have written lots of cute little bits of text about the inhabitants and artifacts of Nettle-Belfry, so this is a big step.

**Update:** My unstoppability continues!

– Set up statistics for how many times you have beaten a certain type of enemy.

– Made the bestiary hide enemy info until you beat that enemy at least once.