Tilemap vs. Prefab Thinking

Not a lot to show today. The NEO Scavenger sale on Steam is, of course, pretty big news. Especially if you still don't have the game. (Hint, hint.) But in terms of development, today was not as exciting.

For one thing, most of the morning was cratered by errands which had snuck up on us and were past due. So first order of business was to get the house in order.

Second order of business was to take care of some server maintenance. Again, necessary but boring.

In the time that was left, I found myself a bit paralyzed by indecision. Namely, what's the best way to proceed with the prototype in order to get what I want? And actually, this may be a good time to establish exactly what that is:

  • I want to be able to draw ship layouts similar to Firefly, Millenium Falcon, Cowboy Bebop, and Nostromo. I.e. 1-10 person crews, not capital ships nor fighters.
  • I want to be able to simulate things like air pressure, gas contamination, fluid leaks, temperature, and radiation.
  • I want ship systems to lean more towards realism than science fantasy. So more air scrubbers/blackwater management than bubble shields/inertialess drives.
  • I want pixel art, but I want it to look rich. I think NEO Scavenger looked "okay," but I want people to look at screenshots of player ships and think, "Oh my god, I have to play that." The gold standard, to me, would be something like Megasphere, Galactic Princess, or Halfway. Rich in detail, atmospheric, lots for the eyes to feast upon.
  • I want crew to be walking around the ship, doing their thing. E.g. Prison Architect and Rimworld.

I've had moderate success with tilemaps so far, but the blockiness kind of turns me off. Even with snazzy lightmap rendering and line of sight, it seems to break down and look too chunky in practice. It kind of looks like an uglier version of Terraria. (Mind you, Terraria sold like a bazillion copies and is much-loved by players. But it's not what I'm going for.) Specifically, I don't like the jagged edges and how it has blocks of black intruding everywhere.

The thing is, tilemaps are useful. For one thing, they're built-into engines like HaxeFlixel, so I don't have to do a lot of work to get them running. They're also easy to extend, so I can try things like cellular automata logic to control gas and fluid propagation, or grid-based AI for firefights or similar. But you can't get away from the blocks.

So that got me thinking about "prefabs." Prefabs, in this case, are just larger sprites that cover more than one grid square. They could be a 3x3 grid with more detail (like a big circle), or a diagonal piece that spans multiple grid squares (to make a slanted wall without the blocky edges). I could even do something where the user lays down long structural beams and "hangs" walls and other equipment on them.

This starts to be something more like a skeleton of a real ship, with macroscopic parts that interconnect in specified ways (e.g. via connectors nodes or sockets). It allows for more visually-appealing designs. And I could even jury-rig the tile grid to control how they fit together, and do something like a post-construction analysis to figure out which grid squares are occupied vs. open.

The thing is, this probably wouldn't work with my current lighting model. The grid-based lighting would have to tell each prefab how to be lit, and either this means whole prefabs have one amount of lighting, or I use the grid to overlay shadows/lights onto the prefab. The former is going to mean large sections looking out of place in the lighting (e.g. bright pieces sticking into dark areas), while the latter is going to mean that blocky look over the nice, smooth parts.

There's also the option to go with a 3D engine to get them properly done. There's a slight chance that hardware shaders can do it in 2D. However, I'd have to delve into OpenGL, and I'm not sure if Haxe/OpenFL/HaxeFlixel is ready for that yet. (Or if it would even perform well with a large number of lights.) But a 3D engine does this handily. It's the core feature. But I'd have to learn a new engine.

I don't know. Maybe I need to abandon the lightmaps. Maybe they're not worth the trouble. Halfway and Galactic Princess, above, go without them (as far as I can tell). So maybe hand-drawn lighting is the best compromise.

I'll have to think about this some. If anyone reading this has seen other games that do this, let me know in the comments!

Comments

Cjman93's picture
Cjman93

Good luck with this, maybe these projects can provide some inspiration?

Wayward: Terran Frontier dev post
http://www.wtfrontier.com/?p=31217

Starsector shader mod.
http://fractalsoftworks.com/forum/index.php?topic=7958.0

dcfedor's picture
dcfedor

Thanks for the tips, Cjman93!

I stumbled across Wayward just yesterday, and I agree that it does a lot of the same things. I particularly liked their "Interior Demo" with tooltip text and working airlocks :)

I think what they've done (prefab rooms) is probably a bit less granular than what I'm picturing (prefab parts to make rooms with). But it's a close approximation!

I also poked around the Starsector project before, too. I really like their normal-mapped ships, and wondered how I could do the same. I didn't realize they were letting modders write their own shaders, though. That's a cool idea!

Dan Fedor - Founder, Blue Bottle Games

Malacodor's picture
Malacodor

I'd like to add a few things about WTF:
- It started as a one man project, but the dev hired a graphics guy and the game looks so much better now, plus the dev has more time for coding (hint, hint)
- Ships are stored as several png files: the hull graphics plus optional bump, specular and emission maps (which are displayed when piloting the ship) and the interior. Each pixel of the interior image corresponds to a tile in the interior view. The alpha channels of the hull and interior images are used to store the damage. This way it's easy to implement own hull designs. Also, it's easy to make 3rd party editors since png is a well known file type.
- The current version is available for free here (in case you didn't notice already): http://store.wtfrontier.com/free

Ran around with a clown mask before it was cool

dcfedor's picture
dcfedor

Thanks for the link, Malacodor! It prompted me to take a second look, this time to peruse WTF's YouTube videos. I didn't realize how far along the interior stuff was, and now I can see why folks keep mentioning it. Some very similar ideas at work!

With so many space-based games on the horizon, I do worry a bit about overlap with my prototype. I don't want to make something redundant. However, I think my goals are still fairly unique compared to what I've seen. In this case, I think WTF is geared more towards combat than role-playing, even though the ship-designing may overlap.

As for the artwork, I agree that hiring a pro makes a huge difference. I'm seriously considering contracting the pixel art out this time (or at least a good portion of it) for this reason. Before I do that, however, I want to make sure I know what I'm asking the artist to do/what the specifications are. E.g. what resolution will I need? What are the sprite sizes? How many variants? Do they need normal maps? What style should they be in? Will they have lighting or be flat-shaded? Etc.

So most of this phase is figuring out how things are going to work and planning a trajectory before I go full-steam ahead :)

Dan Fedor - Founder, Blue Bottle Games