Toilets, New Orleans, Video games, Linux, PostgreSQL, the Marigny, Restaurants, Live Music, Bars, Hollywood Hotties and all with 30% less fat!!

There's no place like home.
Home

Recent Additions.
What's New


Tell me that you love me!!
Feedback / Submit Reader Photos


PGDesigner Datamodeling Tool
PGDesigner


The Greatest Game of all TIME!!
Cylindrix


Links
Links



Personal









Links:

Watch Me Eat a Hot Dog

www.glitch13.com

Live New Orleans

Yaddoshi's site

Six Ten Split

Fleshbot

Offbeat
Hardcrawler - House Editor

2005-10-31: Hardcrawler - House Editor - Hardcrawler
I tried very hard to keep all editing in-game. I remember playing around with Duke Nuke 'Em's in-game editor, and I have always considered an editor of that sort to be a good design goal. After much frustration, though, I decided that some things were just too cumbersome to do in-game, particularly when you consider that I was having to add new packet types since all of the logic is running on the server.

I had already written a little skeletal SDL app that views my sprites. This allowed me to dump from Blender and quickly view the results without having to do all of the C++ overhead of adding the new entity type to Hardcrawler (not to mention the CVS updating to make sure both the client and server have the entity, and restarting of the server)

I took this skeletal program and modified it slighly to support the windowing I wrote for Hardcrawler, as well as other data structures related to the environmental background tiles. I created a new window type that allows you to add a series of arbitrary bitmaps to it, and then when they are clicked an arbitrary callback can be fired. I used this window to store a series of "building block" bitmaps for a building, and when clicked, they are added to your current "scene". The keyboard controls a 3D cursor which moves the blocks around, as well as lowers and raises them in a simulated 3D scene.

For the house data file, I decided to finally bite the bullet and start using XML. I am notoriously conservative with technology, and I like to wait until the rest of the planet has beta tested something before I use it in my own projects. Since everyone else on the planet has already jumped onto the XML bus, I figured I'd go ahead and take a ride.

I found a cool little chunk of C++ code called TinyXML. It's only a few .cpp files, is relatively lightweight, and simple to use. After a couple of hours of coding I had the house editor loading and saving house data files in XML. No more text parsing, no more crappy C++ string crap for me. TinyXML is handling it, and I intend on using it for all future data files.

For the actual building tiles, once again I used the magnificent Blender. After I started putting a house together, a fundamental limitation of Hardcrawler began to dawn on me. Previously, every tile in Hardcrawler had a boolean flag denoting blocking. 1 meant the tile blocked, and 0 meant it didn't. The problem with this is that you end up with very little playable "real estate" inside of a house. Let's say that you build a 5x5 tile house, well the bare minimum number of blocking tiles you can have is 16 tiles, and this only leaves you with 9 tiles (3x3 interior) of navigable space.

Once again, Brent's early warning was correct. I should have taken the extra time to make my blocking border based rather than tile based. I spent a few hours and changed my blocking boolean to a 4 bit blocking bitmask. Each tile can block movement to the north, south, east, west, and of course any combination of these. This allows you to stand on the same tile as, say, a wall tile on the east side of the house, but you cannot walk another tile east even though that tile is open because the wall tile blocks to the east. Now a 5x5 tile house has 25 open tiles, which allows for far more usable room in a smaller space.

In the Hardcrawler game, houses are entities just like any other entity. When they are created, the tiles that make up the house are placed into the map. Obviously, I had to add the ability for background tiles to have a height value for any of this to work. Once I added this, the next logical step was to allow entities to have a height value (independent of the land height). Of course, when I did this, I had to modify my entire packet structure to facilitate sending/receiving of height information for entities.

In this screenshot you may notice some red 3d cubes. I added the ability to create arbitrary placeholder game entity tiles in the house data file. The red cube at the bottom is designated as a Door entity, and when a house entity is loaded into Hardcrawler, a door entity is automatically created and placed where that placeholder is in the house xml datafile.

At the top of the house you can see a stairway entity. Stairway entities are special entities that basically sit around and wait for another entity to enter their sqare. When that entity does, it moves them either up or down, depending on whether it is an "Up" stairs entity or "Down" stairs entity.

Voila! It all comes together in a lockable house, and you can climb up and down the stairs etc. As a finishing touch I added a special case to my item entities that allows them to have a different graphic when they are placed on a wall (i.e. on the same tile as a tile that only blocks in one direction). This allowed me to implement paintings and flags that you can hang on the walls.

Permalink to this post.

Philosophy

Computer Stuph

My Weight Loss Program

Misc Stuff

Dream Page

My Adventures

Media Reviews

Poker

People

Hardcrawler

Toilets

Gods of F*!@ING Rock!

Starcraft II

Video Games

Random People

Live Show Reviews

John's Guide to Being a Metrosexual

My MAME Project

The Coolest Men on Earth

Hottest Hotties of Hollywood


My Taiwan Adventure


My Hong Kong Hijinks