Saturday, October 25, 2014

Experiments with Procedural Generation, Part 2

Conway's Game of Life

Tools: LUA, Love2D, ZeroBrane Studio

A friend of mine from college introduced me to the Game of Life when he built his own for class. Ever since then I've been interested in the subject and I've always wanted to write my own version of it. Since I was planning on learning about Cellular Automata this month, I figured the Game of Life would be a great starting point.



The rules of the Game of Life are:
- Any living cell that has fewer than 2 neighbors dies.
- Any living cell that has more than 3 neighbors dies.
- Any living cell that has 2-3 neighbors lives on.
- Any dead cell that has exactly 3 neighbors becomes alive.

These simple rules working together can create some extremely complex and seemingly-intelligent behavior, which is what makes the Game of Life so fascinating.

My implementation of it has pause/unpause, fast forward, stepping forward, and a series of brushes that should make it a little easier to create complex patterns.

Download the project here.

Controls:
Left Mouse Button - Place cell(s).
Right Mouse Button - Delete cell(s).
Space - Pause/unpause the simulation.
Enter - Fast forward when unpaused. When paused, step forward one tick.
Backspace - Clear the entire grid.
Mouse Wheel - Scroll through the brushes.
#1-6 - Select a specific brush.

Wednesday, October 22, 2014

Experiments with Procedural Generation, Part 1

Dungeon Generator

Tools: LUA, Love2D, ZeroBrane Studio

Since Itch.io is having a procedural game jam in November which I'd like to participate in, I decided it might be a good idea to use 1GAM to get some practice with procedural generation.

My October 1GAM project is a top-down rogue-lite shooter that takes place in procedurally generated dungeons where you fight procedurally generated enemies. The plan is to have a virtually unlimited amount of procedurally generated weapons and gear to collect and choose from. Because the end of the month is nearing I am likely only going to get a simplified version of this done by the end, but I am definitely going to continue working on this game past the end of the month.

The dungeon generation system is pretty powerful and flexible. I can completely change the look and feel of the dungeons being generated just by tweaking a few small settings.

Here are some dungeons generated using settings designed to create disorganized, cave-like dungeons with lots of open spaces:





In those screenshots, green and red tiles mark the entrance and exit of a level, blue marks a dead end which is a place where chests or other nice things can spawn, and cyan blocks mark big open spaces where we can potentially spawn a lot of enemies at once to create some big, interesting battles.

And here are some dungeons generated using settings designed to make more square, man-made looking dungeons with many straight hallways and corners, and few open spaces:





As you can see, just by having a few different predetermined settings to select from I can potentially generate a huge variety of levels that all feel and play completely differently.

1GAM (September 2014)

Tools: LUA, Love2D Framework, ZeroBrane Studio (an awesome open-source LUA IDE)


The title screen, with 3 AI fighting each other in the background.


My 1GAM project for September was a simplistic real-time planetary-conquest strategy game, similar to Galcon or Eufloria. Players fight for control of planets which produce ships, which you then use to conquer more planets. The game keeps going until one side eradicates all opposition. It's a genre that has been done plenty of times before, but it still isn't over-saturated. And it's a genre that I particularly enjoy, for some reason.


Fights are happening on multiple planets simultaneously.


What excited me most about this project, apart from making it in LUA, was the idea of writing an AI for the game. Though the behavior of the AI I planed was simple, it turned out well. It is both challenging and intelligent-feeling, and I could watch the AI fight itself all day long.

If you want to check the game out you can download it on GameJolt.

Next Month

Itch.io is having a procedural game jam in November, so as practice I am putting a lot of procedural generation into my project for October. I already have my procedural dungeon generator working, and I also made my own implementation of Conway's Game of Life to practice Cellular Automata. I will be doing a blog post on procedural generation to cover the two projects later.

RimWorld Zombie Apocalypse Mod (May 2014 - Present)

Tools: C#, MonoDevelop / Unity, ILSpy, XML

The first release of RimWorld Zombie Apocalypse came out on May 20th, and the mod has been in mostly-continuous development since then. At the time of writing this, between ModDB and NexusMods, Zombie Apocalypse has almost 40k hits and 11k downloads. Not bad for a mod for a game that is still in alpha and has only sold 50k copies.

Rimworld Zombie Apocalypse

Cornered survivors fight off a zombie hoard.

 

RimWorld

RimWorld is a space colony sim and combat strategy game, heavily influenced by games like Dwarf Fortress. You start with 3 colonists who crash land on an unfamiliar planet, and you have to build up your base to survive. You defend your base from raiders, recruit new colonists, and eventually gather the resources and knowledge to build a new ship to escape the planet.

Even though the game is only in alpha, RimWorld has a really healthy modding community thanks to its impressive level of moddability. All of the objects in the game, their textures, and much of their functionality are defined in XML files. This makes tasks like adding simple items or changing an old item's texture really easy, meaning simple mods can be done by just about anyone even without previous modding or programming experience.

For mods that require more than the functionality defined in the XML you can throw a DLL in your mod's Assemblies folder and the game will automatically load it when it starts. And because it was made in .Net (Unity), the entire source can be viewed through something like ILSpy or NET Reflector.

 

Background

I had been looking for a game to mod for a while just to get the experience. I had no modding experience at all despite the fact that modding a game had been on my to-do list for a long time. When I found RimWorld it just seemed like the perfect game for me to start modding.

Most zombie games only capture part of the zombie "experience". The important things are usually all missing from games: bites, reanimation, the dread of having one of your loved ones bitten, the horror of friends and family members running around as corpses trying to eat you. For a while I had been longing for a game that actually did these things well, as I felt these were the things that truly made zombies scary.

Rimworld was a perfect fit for a real zombie experience:
- You only have a handful of colonists, which makes it much more tragic when a colonist is killed or bitten. Every life is precious.
- Lots of people die, and their corpses stick around until you bury them (at the time there was no crematorium built into the game). This is perfect for a "turning" mechanic.
- When I started working on the mod all of the enemies in the vanilla game were exactly the same, and all of the custom enemies from mods (of which there were only a couple) were nothing more than reskins of things that already existed, with no interesting or unique behavior. I figured a new enemy that truly added a unique dynamic to the game would interest many RimWorld players.

 

Making Of

I spent a week just going through Rimworld's code in NET Reflector and ILSpy, figuring out how everything worked together, and doing a lot of experimenting. The entire time I felt like I was just trying to find clever ways of breaking the game and doing things the dev never intended to be allowed. I often had to program around checks that were specifically there to prevent anyone from doing what I was trying to do, like forcing the character textures to render green instead of the skin tones, or hijacking the "Undefined" map condition state because it wasn't being used and there was no way to create my own at the time.

It took me two or three weeks, but finally I released the very first version of Zombie Apocalypse. The very next day the developer of RimWorld contacted me on their forums and asked me if he could feature the mod in the Alpha 4 release video. I agreed, of course, and I was made a private tester so I could get access to early builds of the game and update the mod in time for the Alpha 4 release.

Go here to see the Alpha 4 release article, and the video featuring the mod.

 

Zombie Apocalypse

The mod has evolved quite a bit since the first iteration in May, but here is the feature list as of version 1.0, released at the beginning of October:
The Zombie virus has gone airborne and the dead have started rising from their graves.
   
Gameplay video from the RimWorld Alpha 9 release of Zombie Apocalypse.

Zombies
- Zombies are mindless killers. They kill you and your enemies indiscriminately.
- Their bites are infectious. If a colonist is bitten you will get an alert. The colonist will slowly die of the bite, and then they will turn into a zombie immediately on death.
- They are 20% slower than colonists and other enemies, and can be easily killed with Cutting weapons like knives and swords.
- You can easily keep track of the origin of any zombie by looking at their names. A zombie that was spawned in a zombie hoard will simply be named "Zombie". If the zombie reanimated from someone who was originally living in your game, their name will be "Zombie [Name]". If they were a colonist there will be a pair of "*"'s surrounding their name.


Zombie Infection
- The Zombie Infection will affect any limb that is bitten by a zombie. This can be seen in the Health tab.
- The infection deals continuous damage to the infected colonist, until their inevitable death.
- Removing infected limbs will cure a colonist of the infection.


Zombie Hoards (raids)
- Zombies attack in large numbers.
- Zombies do not give up or flee.
- Zombie hoards always attack immediately.
- Zombie stragglers will be left behind, forcing you to leave your base to deal with them after the initial zombie attack is over.


Zombie Apocalypse/Airborne Zombie Virus
- The zombie virus goes airborne and affects all humans and corpses. All human corpses will start reanimating even if they were never bitten while living.
- This incident never ends. Once the virus goes airborne, everyone is infected.

 

Reception

I've received a ton of support and encouragement on the RimWorld forums and elsewhere. Because of the popularity of Zombies and the need for an interesting new enemy in RimWorld, Zombie Apocalypse quickly became one of the most popular mods for the game.

It's really weird seeing the mod become so popular. The most recent version came out less than 3 weeks ago and it currently has almost 2300 downloads. That's over 750 downloads a week. Hundreds of people regularly play RimWorld with Zombie Apocalypse active, and several have even told me they'd never play the game without it. I've seen several Let's Plays with it. I've seen the mod mentioned in threads on Steam, Reddit, SomethingAwful, random forums I'd found through Google, and basically anywhere there are people talking about RimWorld. I even watched one streamer play with my mod active for ten hours straight. Twice.

And the mod isn't losing steam. With every new release it becomes more an more popular, and stays more popular. Since the release of v. 0.7.1 on September 10th there hasn't been a single day where less than 100 people have checked out my mod.

Since I released Zombie Apocalypse I had been hoping to make the top 100 mods on ModDB just for a little while, and it finally happened after I released v. 0.7.1 on September 10th. ModDB linked my release article for v. 0.7.1 on their Facebook page, which resulted in the mod spending much of the following week in the top 100 list, and even dipping as low as #30 at one point.

On NexusMods, Zombie Apocalypse just recently hit 1000 unique downloads, making me an officially recognized mod author there. It gives me access to a private forum that is only for reasonably popular modders. I don't have much use for it, but it's still nice.

The steadily increasing interest in the mod since the beginning is definitely helping to keep me motivated enough to continue working on it. Since RimWorld has already been Greenlit, I plan on continuing to support the mod well after the game is finally released on Steam. With a well polished Zombie mod that already has a sizable following hitting Steam right as the game launches, who knows how popular the mod might become once RimWorld takes off (and it will). It might even hit the #1 position on the top 100 list. Who knows?

 

Download The Mod

http://www.moddb.com/mods/rimworld-zombie-apocalypse/downloads
http://www.nexusmods.com/rimworld/mods/34/?