TFernando

LD15

Declaration of Intent

I’m going to try to sneak in under the wire (I didn’t see a timeline for when you had to say you were planning to participate in LD15 to participate). I’ve wanted to do one of these for a while, but always manage to not notice the start date and time. :)  I’m pretty sure I’ll be working at my real job tommorrow, so I’ll lose some hours there, but other than that I think I have the full weekend available.

Planned platform: Flash

Tools:

FlashDevelop (IDE)

FlexSDK

GiMP (gfx)

Audacity (SFX and music if I get that far)

Should be fun!

-TF

www.nightflyergames.com

Caverns?

Okay, I was expecting the cold topic… I mean the keynote speech referenced the frozen north of Canada, and everyone would immediately assume that this meant the cold topic wasn’t the winner… but obviously, when they put together that video they knew that everyone would assume that whatever topic they referenced wouldn’t be the winner so clearly they would use whatever topic was in the lead in the video…

I really don’t know what to do with this theme. A shooter or RPG set in a cave … is a shooter or RPG set in a cave, it could be almost anywhere else with a graphics re-skin. Flying through caves hasn’t really been bettered since Caverns of Mars, and I’m probably not capable of cloning Spelunky in 48 hrs. The only ideas I’ve had so far have been silly (a game based on Troglobites, where the player would have to use senses other than sight.. (makes a lot of sense for a flash game, no?))

I’ve set up my framework though (I suppose I should have disclosed it, but it consists of one switch statement, an int to switch off of (gamestate), a timer, and 2 global constants (ScreenWidth and ScreenHeight)) Code and in-progress prototypes will follow.

You know… once I actually have a viable idea. :)

-TF

FallingTown

So I was having trouble with an idea.  I’m trying to stick with the definition of cavern which is a naturally occurring void in the earth, and perhaps that’s too limiting.  I came up with two concepts I like though, and one I’m going to develop.

The runner up for me was Stalactite.. here’s the crummy mockup:
Concept1Stalactites

Where the idea was to grow stalactites by somehow moving the water around. The soluble minerals that could become stalactites would be limited resources, as would the water. But although that could be a neat simulation, I didn’t see a game.

Option 2 is a competitive game where there is a town being built over a cavern. There are two players (I’ll initially code hotseat multiplayer, and then code some type of AI). A grid represents the town, and another grid represents the cavern. Each turn a player can either place a building, or a support. Buildings have different weights. If the stress at a given point exceeds some constant (TBD), a sinkhole forms and the buildings within the confines of the sinkhole fall to the cavern level and are out of play. The game ends when… (I’m not sure yet). Each player gets points for his opponents buildings in the cavern, and loses points for his own buildings in the cavern.

My goal for the rest of the evening is to get a mock-up done of this, and a basic UI.

-TF

FallingTown 0.1

Really not too much to show here… the ground and caven backgrounds are just solid fills with some about 5 colors airbrushed over each at random. The grid is generated with two for loops, and there are two instances of each… I’ll be storing stress information in the cell objects that comprise the grid. Next up is to draw some houses and supports which will be placed by mouse click. In anycase, here’s the game so far:

(oops, WP doesn’t like me embedding a swf from my domain.. oh well, here’s screenshots instead) (And here’s a link where I’ll keep an index of the in-progress .swfs)

#gallery-1 { margin: auto; } #gallery-1 .gallery-item { float: left; margin-top: 10px; text-align: center; width: 33%; } #gallery-1 img { border: 2px solid #cfcfcf; } #gallery-1 .gallery-caption { margin-left: 0; } /* see gallery_shortcode() in wp-includes/media.php */ Screenie1 Screenie2

-TF

FallingTown 0.2

Ok, this is not a major update, I was asleep and then I had to fly to Illiamna and back, so I’m just picking things up again now.

Flash games on the web take the form of .swf files, which are streamed by their host. The flash player won’t normally play a frame of a flash movie until all the assets used by that frame have been loaded. Working in FlashDevelop/FlexSDK, you really don’t use frames much at all, everything is done from AS3 code, and the .swf which is created is a flash movie with 1 frame. Because you don’t want to show the player a white box until everything has been loaded, normally you add a pre-loader, which is small, and which allows the flash player to show something to the user while the rest of the assets are loaded.

Up till now, all of my projects have been wrapped either by the Mochi version control wrapper, or by Whirled’s wrapper. These include preloaders, so I’ve been able to totally ignore all aspects of preloading up unitl now. :) Unfortunately, as in my normal development flow I had set up my FD project as an ActionScript3 project. In order to get the FlexSDK to create a movie with more than 1 frame, so that that first frame can be implemented as a preloader, there are a few compiler options that need to be set. FD has a AS3+preloader template option, so I re-setup my project and away we went. (This really isn’t a big thing, but I lost 30 minutes because I didn’t know my tools).

Also in the line of I didn’t know my tools, if you hold shift while using the pencil, GiMP will draw a straight line!! Learning this alone made entering LD worth it to me. :)

Implemented a main menu and intro animation. Next up is building/support placement and a stress heat-map. That might take a little longer, so I figured I push what I have public.

Embedded flash versions here

screen3

-TF

Don’t need windows to check…

Early in a project, things like this are funny. Later on, I find the time lost incredibly frustrating. I don’t think windows is going to find the error before I do…

screen4

-TF

FallingTown 0.3

Right, I haven’t gotten the building placement yet (nor drawn the buildings, so that’s the major stumbling block) but my little game is correctly placing the supports and displaying the stresses on a heat map. Playable version history here. The halo effect in the screenshot below is caused by setting every border cell, actually, every cell 1 step outside the border of the playing field to be a support. I’m not sure if that’s going to work or not in the long run (however long of that run is left). Ideally, 1 support will nullify 1 building. I’m not sure if it’s a better idea to drop the supports around the edges entirely, or to thin them out a little so their effect isn’t as large…
screen5
-TF

FallingTown 0.4

Well, it took longer than it should have because I keep getting distracted by skimming forums… I did get a house drawn, and am now able to place it. Once placed the houses apply a stress in the opposite direction as the supports, and it reflects correctly on the heat map. However, I haven’t yet implemented the houses falling into the cavern, scoring, and the player turn indicator doesn’t really do anything. So I still have a ways to go…

Anyway, screenshots below. Playable version history here. (If you play the draft, the preloader hangs between 95-98% complete. It does complete though, give it a few seconds. I’ll be working on that soon too. :(

Screen6

Screen7

-TF

Milestones to Meet

Currently, I can place buildings of three sizes. That’s the only major change from the previous version I posted. But at least I’ve got decent error checking for overlaps now. Next live update will be a version with a selector.

Unroll your loops boys! We’ve got a milestone to hit!

Joe Ludwig

Sadly, while I do have a milestone to hit, my brain is getting tired and not only did I realize I should have used a pretty simple loop here, but I also have too much left overall to do to refactor this section.
Loops

Screw it… I’m going to go get a coffee.
-TF

Falling into the Cavern

Ok… Finally got the buildings to fall into the cavern. I’m having massive issues because I’ve got grids 90 degrees off from each other, and not all my grids are the same size. Definately next time I’d use a master class which stores EVERYPIECE OF DATA that ANY type of cell could want so that I only had one NxN array instead of 7 or 8…

Haven’t touched the building selector yet, or recolored the buildings for the other players. No chance I’ll get to sound I think… I’ll be lucky if I finish a UI and have an AI which does more than place random moves. Here’s a current screenshot though.

Falling
-TF

FallingTown 0.5

New playable build. Got the building selector working a lot faster than I expected. Now I need to (in the order it’s likely to happen):
– Recolor Buildings so they are unique for each player
– Add tracking for the Player’s Cash (Left side of screen) and Points (Right side of screen)
– Come up with a score mechanism :eep:
– Script some type of AI to replace players 2-4. Generally thinking here, player 2 will always place the largest building he can afford on the least stressed square. Player 3 will 25% of the time place a support, rest of the time place a building on a low-stress square. Player 4 will try to collapse the human player’s buildings into the cavern… but obviously none of this has been implemented yet.
Screenie:
screen8
-TF

Moar color

Well, it’s more colorful anyways… Fixed a bug which caused the stress grid to recalculate itself up to 800 times per frame o.O Score and cash displays in progress and coming up next…
screen9
-TF

FallingTown 0.6

I can’t believe how far some of you guys got… I must be looking at the compo site too often. New build is up, here. I’ve implemented scoring, couple of bugfixes. 6 hours left, I need to:
– Set computer behaviors
– Set Win/Loss conditions
– Write Instructions
– Add a help button
– Add a reset button
– Do whatever gameplay tuning I have time for… don’t think it will be much.

screen10
-TF

FallingTown — Submitted —

Well, it’s done! I’ve submitted. I started feeling time pressure a few hours ago, and I think I caught all the fatal errors anyways. There are certainly still some issues with the display, and the AI. (It’s quite presumptious to call it AI– there’s three scripted behaviors. One of them is ‘ask the random number generator where I should move’. You can play with the game to figure out the others or wait for a postmortem. :)

Of the things in my last post, the only thing I don’t think I really handled was a help system.. there are instructions, and slightly better instructions in the submission entry. A lot of the last minute stuff was a kludge though. This is my code in my Main class for handling a reset or restart:

case 8:
if (this.contains(GameOverScreen)) this.removeChild(GameOverScreen);
if (this.contains(CGame)) this.removeChild(CGame);
CGame = new CavernGame();
GameState = 5;
break;

Obviously that’s not an acceptable way to restart– CGame is a HUGE object by the time the game ends and restarting hangs my flash player for about 20 seconds. (I don’t have a profiler, but Windows Task Manager shows a 30Mb jump in flash players memory usage when that section of code is called) However– it does work. And it would take me more than the two hours and change left to find all the variables that need to be reset in CGame. I’m also tired, and I’m at the point where I’m afraid I might break something trying to add polish.

I’m looking forward to seeing everyone elses work, but I’m going to get some rest first. I’ll leave you with a couple screen shots:
Complete

SubScreenie

subscreenie2
-TF

FallingTown- Postmortem

I probably should have written this closer to the end of the contest, but I wanted to finish a small puzzle game (The Knight’s Tour) I had started the week before for release. As a result, my recolection of some of this may be a little hazy.

I’ve added a zip containing my project directory to my game’s page… it’s complete except that I had embedded the font ‘Arial’, and you’ll have to add your own copy of arial.ttf to the font’s directory in order to get it to build.

I. Genesis

(*** Note: Nothing in this section is meant as a disparaging remark about anyone elses entry, but is intended as a depiction of my thought process at the time, with respect to my entry only. ***)

When the theme came out, I really had no idea what to build. The first thing in flash space that comes to mind for me when you say ‘Caverns’ are the cave fliers, which I didn’t see much space for innovation in, or platformers where I knew I wasn’t going to be able to compete. I was pretty stuck for an idea.

Since I don’t know much about caverns I looked up cavern on wikipedia . :) The article calls a cave or cavern a natural void– which in my mind ruled out mines. I tried to come up with an idea that related to cave formation, but thought while I could write a neat simulation I wouldn’t have much of a game. The article also mentions sink holes… and at some point early in the compo someone twittered (I think) a comment like: ‘Make a board game!’

I remember playing a game as a kid, Cathedral where the idea is to place buildings on a grid to capture space. My idea stemmed from that– the buildings would have weight, and if too much weight was concentrated in a space, they would fall through to the cavern below. I guess it’s a reach to say this was connected to the theme, but it’s what I ran with. The size of the grid and being 4 players were arbitrary decisions for me.

II. Development

I knew roughly what I wanted to do, but didn’t know how the buildings would interact with each other in practice, so I needed to get an interface up and running fairly quickly. Unfortunately, I did not do much on-paper design work and just winged everything as I came to it. As a result, there are about 6 or 7 2-dimensional matricies which hold information about each cell. This isn’t an inherrent problem, but because I was making stuff up as I went, some of them are 40×40, some 41×41, some 42×42, and the grid which records stress is either 80×80 or 100×100-I think at one point I switched, but I’m scared to look now. :) To make matters worse, some of the grids are indexed [row][column] and some are [column][row]. As a result, the majority of my time in writing code for the game was spent trying to fix offset discrepencies. (Why is a house placed here, stressing something way on the other side of the board? Why is that building being displayed in the right place, but when it falls through it fell over there? Why didn’t my overlap checking prevent that placement?)

Another problem I had is that when I coded the interface originally, I tied all of the legal move validation to the mouse click… but when I came to the AI’s, I wasn’t sending mouse clicks I was sending cell coordinates. I was feeling a lot of time pressure by that point, so I just hacked in new validation methods.

Because I wasted too much time early on trying to get an application together which would let me place buildings, and see the stresses I never really got around to developing a game. My ‘first best guess’ for things like building weight, cost, rent became final constants. The only real gameplay decision I made were the points… I knew needed an incentive to place the smaller buildings and supports, so the player had to be penalized for losing a building, and that penalty had to increase with building size. But once I had that penalty, I then had to go back and give a reason to place the larged buildings. Again, ‘first best guess’ became a final and I was left with the system in place now.

II.a. If you don’t know how, fake it!

I’m sad to say, that cool as it looks, my stress map does not reflect actual physical stresses on a surface caused by weights being applied. Each building had a weight (supports had negative weights) and when the stress is calculated, if a cell had a weight it’s weight was added to all nearby cells by the incredibly complex formula: Weight = BuildingWeight/(Distance+1). This made pretty pictures, so I called it good enough. :) If I was going to take this to a ‘worthy of release into the internet flash game space’ I’d probably replace this with an actual stress calculation based on integrating moments or something like that.

Along the same lines, I didn’t have much time for AI. One of the players is totally random. The other mostly random player has a 25% chance of placing a random support. The green player queries the board to find the human player’s largest building and then places houses within 10 squares of that building. Eventually, unsupported that building will collapse and then the green player chooses another building. That’s the only behavior that’s the start of a bonafide computer player. Had I had another day, much time would have been spent creating more realistic behaviors. If the computer players appear to be thinking at all, that’s because I added a delay to their moves, because otherwise I’d have no idea what they were doing. 😉

II.b Player Reaction

I think the general comment trend of ‘cool idea, but not very fun’ is pretty much correct. I think it could have been fun, but I didn’t pull it off.

II.c. Summary

The big major takeaway for me, is that once I get the urge to start hacking at code, I need to stop and figure out why what I’ve done so far can’t be extended the way I want. If I had used one consistant grid.. or heck, if I had used many grids, but they all had their origin at the same point and were all addressed by [row][col] life would have been easier and I think I would have produced a better game.

III. Other Cool Stuff I Learned (but which you probably already knew)

You wouldn’t know it, because I didn’t put any effort in gussying up my index of development versions, but Flash Develop has .html and .php templates, and functions as a html or php editor, with code completion! I’d been doing all my wordpress maintenance (on my site) via notepad. This will help me a lot.

I’d seen passing references to sfxr before, but seeing it used in other entries I finally got up off my butt and downloaded it. It’s great and will reduce my dependence somewhat on royalty free audio sites for my normal games.

GiMP can draw straight lines! You have no idea how many hours I’ve wasted placing lines pixel by pixel because I thought it couldn’t. :)

That’s it. I’m enjoying playing everyone else’s entry.
-TF

LD17

Back for LD17

I got the time off from work for LD17 (which was the reason I missed LD16), so I’m probably in.

I guess it’s time to declare tools, etc.

My Tools:
FlashDevelop + FlexSDK
Audacity + sfxr
GiMP

If I need collision detection, I’ll use Troy Gilbert’s 2007 Pixel Perfect Collision Detection class. (I think this is within the spirit of the competition.)

Anything else I need I’ll generate after the compo begins.

-TF

Comments

nutink
23. Apr 2010 · 05:54 UTC
Nice 😀 *hi-5’s* Nice to see another Alaskan participate in LD by the way.

Pan and Zoom

For some reason, I just wasn’t able to get a good start yesterday. Starting to catch up now I think.

Click here for my in-progress builds (Requires Flash Player)

Sticking the rest of this behind a read-more tag, since there’s a bunch of images.

So… the general idea of my game is that there’s a group of islands, populated by an endangered animal (currently, a striped kiwi). An invasive species (not yet finally named) has arrived, and the player’s job is to eradicate the invader.

No idea why it’s a kiwi. I drew it and the invader last night before falling asleep. I probably need to re-draw both.

glomperkiwi

The basic rules- untested as of yet.. are
– The player can place traps, and walls.
– Traps will kill any animal that steps on them (good or bad)
– Walls will permit movement of the kiwis, but not the invaders
– Player gets resource points every second which he/she spends on the traps/walls
– Animals can walk on shallow water, but not deep water

Anyway, to explore the ruleset, I need to be able to visualize what’s going on. So, thus far I’ve been working on getting a map working. Much as I’d love to have procedurally generated islands, I could see spending all of the remaining time trying to get an algorithm to work. So I just free-hand(ish) drew some:
tilemap

I say free-handish, because I used the path and stroke tools in Gimp, to draw the islands, and then went back over the image with a pencil tool to ensure that the image only had 4 colors in it. More on that in a sec…

Now, I figured that map was too ugly to display to the player, so I screwed around with various filters and effects (mostly creating noise, and then using that noise as a bump map) to get a (slightly) more aesthetically pleasing map for player use.

prettymap

(I’ll admit to having the artistic ability of a year old turnip, but I like this map a little better) Now I have a scale problem… my island fauna are tentatively 32×32 sprites, which would be too large for my islands. I need at least one, and probably more levels of zoom, right?

Going back to the original 4-color map, I read that map in pixel by pixel using getPixel32(). The returned color sets each tile’s type (Sand, Jungle, Deep Water, etc), which is stored in a 2d map array. When the map array is created, it also generates a random offset for that tile, which is used to pick a rectangle out of a base tile to represent the terrain. This, for example, provides 50, 20×20 Deep Water tiles:
Deep25

This seems to work adaquately, though as you can see, I need to lighten some of the darker pixels in my first level of zoom:

v01FiveZoom

However, at this point I’ve spent way too much time on aesthetics (and explaining(!!)) so it’s time to get to populate my islands and get some dynamics working!

-TF

Predator Explosion

No screenshot, but I’ve got the basic movement and predator/prey dynamic set up now in Version 0.3 of Invasive. (Available here)

Decided to stick with the name Glompers for the invasive species, and Kiwis for the endangered species. Starting with 5 Glompers, the Kiwis all get eaten in about a minute.

So far I’m not doing any real pathfinding at all… The kiwis are choosing a direction randomly each frame (and getting stuck in the SE corners of each island for some reason I haven’t figured out yet), and the Glompers move in one direction until they hit an edge, at which point they change direction. I may change the Kiwis to have the same movement schema as the Glompers…

I think I’m going to need something which the Kiwis can run into that makes them spawn. That can be a player placeable object in addition to the not-yet-implemented traps and walls. Otherwise I think the game will be over before the player has a chance to do anything.

On the plus side, my engine seems to be handling a couple thousand kiwis pretty well! Rather than using Gilbert’s collision detection, I added a map-sized blank bitmap to my Fauna class (which holds all the animals). Since I don’t actually add that bitmap to the stage at any time, it doesn’t seem to be dragging down my rendering performance very much. When the kiwis move, they plot their location on that map as a single pixel, and when the glompers move, they check to see if they’re on a pixel that has the kiwi color. The glompers thus only have to check the entire kiwi list if they’re definately in collision with at least one kiwi. This can probably be optimized further, but it seems good enough for now.

-TF

Comments

25. Apr 2010 · 05:14 UTC
Neat. I named my project Envasive temporarily, but that’s way too close to your name… OOPS!

Player Interaction

The clock thingy says 13 hours left, so I think I’m in decent shape. Unfortunately, I’m starting to feel the time pressure & starting to feel tired. I’d rather have one or the other…

Player can now place objects, and the Glompers and Kiwis interact correctly with them. Screenie:
interactionScreen

Playable build here.

It’s kind of funny– I originally planned for the glompers to only be visible 1% of the time. So part of the game, was to figure out where they were and build defenses to keep them away from the kiwis. But unless I slow everything down, that just doesn’t matter.

The other problem I’m seeing is that the Glompers reproduce just way too fast. So, instead of having them spawn every time they eat a kiwi, I’m going to require them to eat a specific number of kiwis. (I’ll define as a constant, and tune as I work on other stuff). This -might- give the player a chance.

Another thing that might be better, would be to have the walls stop both Glompers and Kiwis. This would let the player create a preserve of kiwis.

ToDo:

  • Game Reset
  • Win Screen
  • Lose Screen
  • Title Screen
  • Lots of Tuning
  • Implement Hunger
  • Life limited traps (like the trees)
  • Sound (ha,ha,ha,ha…)
  • -TF

    Cleaning Up, Fixes, One Significant Change

    New build here

    I now have a title screen, win/lose screens, and the game can reset itself nicely. Made a number of small changes for aesthetics (aligning text, cleaning up the intermediate zoom sand tiles, etc).

    I’ve had enough play testing now, to decide that I needed to change the walls so they block both the glompers and the kiwis. So that’s done. I don’t want to make traps life-limited, so that means I’m getting close to done.

    Quite a bit of CPU usage on my computer, but it seems stable and I don’t seem to be leaking memory (for once :))
    CPU

    I just need to figure out what sound effects I need/can generate… Thumps and such when the player adds objects are easy enough, but if I add a sound when things get eaten, it will be getting played more or less continuously in midgame.

    -TF