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!