Monday, December 4, 2017

Post Ludum Dare #40

Ludum dare was by far some of the most fun I've had making a project. Having the feed with other creators open in the background really gave me the motivation to keep moving forward. Even when I realized my codebase was becoming quiet shaky, I pushed through. I have a finished game! It is small and not well balanced, it becomes quiet repetitive, but it works the way it should, and I am very happy I submitted it.

You can play it here.

Friday night when the theme dropped I quickly started brainstorming. I decided on defending an ever growing hoard, with the number of enemies directly corresponding to the size of your hoard. I opened a text document and quickly jotted down my basic game loop:

"you're a swordsman, you run around collecting gold coins
the more coins you have the more enemies spawn to kill you you'll eventually die BREAKDOWN Character-sideways movement, jump, swing sword Enemies- gobs, ignore player rush towards gold if gobs collide with player player takes damage gobs die after 1 hit
player has hp, takes damage from gobs
gobs who leave the area permenantly take the coin with them"

GDD complete!

I open jMonkey ide and create a new project and start importing libraries. I initialize my repo and make a first commit, everything going smooth. Until I realize I made my project inside of another one of my projects directories. I quickly tell jMonkey ide to move the project, but now my repo is messed up. I try to fix to no avail. Not the best of starts, but I'm not to worried.

Next I create some very simple artwork. A simple human, a coin, a pile of gold "poo", some cobblestone, and scribble of a "Gob" - the main enemy in the game.


With some quick artwork finished I can start working on some game elements. This is one of the first times I was attempting something in true 2d, with all pixel art. I knew I needed to keep pixel densities as close to eachother as possible but I didn't know how to approach a spritesheet or 2d animations. I made a simple entity component that you assign a texture to, and the system will create a jMonkey spatial which uses the size of the texture to determine the size of the quad needed for the world. This worked perfectly, for now.

Working without animations is easy, most of the logical code is similar to games I've worked on in the past. I decided I wasn't going to use the library I have been building up with easily re-usable code for this project. I was curious how I would come up with implementing things without using my old code as a crutch. This turned out to be a good thing as I have re-worked systems I have taken for granted in my old library and I believe my new systems are much cleaner. This helped with this project as I could quickly implement exactly what I needed without any added weight.

With dyn4j integrated, character movement functioning and the beginning of the coin code started I decided I was far enough along I needed to start having animations. I needed a way to visualize attacks and goblin states without relying on println's. This is when I realized that nifty system I designed in the beginning was actually quiet terrible for sprite animations.

For sprite animations it's best to have large image maps with every frame of the animation on one image. With my current system this would have caused the game object quads to be huge and the animations to not appear correctly. I was relying on a sprite shader I found in the jMonkey forums from a long time ago (Thank you Pesegato!) which would position a quads uv coords along an image for the specified index, thus making setting the frame as simple as "setFloat(index)". I probably could of found a way around this, kept each frame a seperate image and loaded each image as needed but I believe this would have been much slower.

I wound up making a "bandaid" system which took an animation component, a new image and just stole the existing game object quad to use. Not great at all, but functional.



Fixing the animations took me to the 24 hr mark, I had no sleep at this point and was looking forward to another 24 hours. I used to work 2 jobs so I've been up for 48+ hours in the past, but things are a little different sitting at a computer. I made sure to take frequent breaks. Get up, stretch, grab drinks. Eventually my stamina was wearing thin.

Nearing 30 hours I had finally finished the coin counting and inventory system. It's a pretty reliable system but it is limited. No entity can carry more than 1 coin, and the entityId is simply added to a list of "carrying coin" entities. If the player reaches his hoard his id is removed and he gets +1 hoard. If a gob runs off the world his id gets removed from the list. Gobl spawns are a simple 1+hoard/3.

36-37 hours in I took a nap. Thank you to my ultra-supportive wife who put up with me being grumpy and got me out of bed after 2.5 hours.

The nap helped but I was still exhausted. I wound up finishing art assets, re-doing all the animations and called it done. I really wish I had tried to add in 1 other enemy type and an "end game" boss, but my head was way to cloudy to focus. I wound up posting the project a couple hours before compo ended and went back to sleep.

When I woke back up around 7-8 (an hour before compo ended) my wife asked to play the finished game. I went into my dist folder to open the finished game file as opposed to loading the ide which takes a lot longer. I'm really glad I did because it turns out I had packaged everything wrong! I spent the next half hour or so figuring out what went wrong, fixing it, re-packaging and re-uploading. Still turned in early but now I had at least a working executable uploaded!



Ludum dare was an awesome experience. As a newbie dev this was a kick I definitely needed and enjoyed every minute of it. I already plan on entering the next dare, as well as focus on producing more finished projects between now and then.

Thanks for reading and I hope to see you at a dare in the future!

No comments:

Post a Comment