Showing posts with label hexes. Show all posts
Showing posts with label hexes. Show all posts

Sunday, 19 February 2012

2D Is Easier

Annoyed with my inability to find a nice way to create 3D tiles, I made a little tiny tile-editor for the 2D version.


Everything's so much easier in 2D. Ah well.

Edit:

I added some water and grass tiles, but not enough for a new post. Trying to do something in the spirit of pixel art but that is amenable to rotation around 60 degree increments (and requiring less in the way of raw talent). I think I might need to try flat colour polygons and a finer subidivision, but it's an interesting clean look.

Saturday, 18 February 2012

Holes



Not an awful lot to discuss this weekend. The dungeon is now a multi-level affair; you can just see the hole in the ceiling in the ugly screenshot.

At the moment, you can fall down a hole by walking into it, but climbing up requires a few conditions to be met. You must be directly under the hole, facing a wall (against which I shall eventually rest a ladder, I suspect), and the hex on the upper floor directly above the bit of wall you're facing must also be clear of obstacles. These conditions being met, you scramble on to the upper floor.

I'm considering shrinking the vertical distance somewhat. To keep things simple, the hexes have a diameter of 1 unit, the player has a notional eye-height of 1 unit above the floor, and ceilings are 2 units off the floor. Whilst this mostly works, it means that even with a relatively wide vertical FoV (I'm using ~100 degrees in recent screenshots), it's hard to clearly see a hole you're standing underneath. I'm considering just halving everything in the vertical direction and seeing what it looks like.

I also finally knuckled down and properly categorised wall-tiles. Given a tile that contains a wall and that isn't completely surrounded by walls, you either have:
  • Zero neighbouring walls - a pillar.
  • One neighbouring wall, a length of wall comes to a stop here.
  • Two neighbouring walls - with the walls in ortho, meta, or para position (adjacent, with a one-hex gap, or opposite each other).
  • Three neighbouring walls - four possibilities here, either clumped together, in a Y shape, or two different chiralities of "two-blocks-together plus one block on its own".
  • Four neighbouring walls - equivalent to swapping the two-wall case for two-spaces.
  • And lastly five neighoubring walls, giving a little nook.

Someone smart would doubtless have done something clever involving symmetries; I just assigned each wall tile a binary number by starting at the hex due north and proceeding in counterclockwise fashion around neighbours, setting a 1 bit for walls and 0 for empty spaces. I created rough meshes for the thirteen interesting cases in Blender and named them according to this scheme (wall_00, wall_09 etc). Then it's just a case of extracting this categorisation number from the map data at runtime, rotating the bits to get the minimum number out of the given arrangement of zeroes and ones, and rotating the numbered mesh the same number of times before rendering.

So that worked quite well, apart from the tiny fact that it's looking like a real pain in the arse to author interesting meshes without leaving sparkly gaps. I'm considering welding the mesh as a post-process, either the whole dungeon or in chunks depending on poly budget, but by this point it almost feels more sensible to hand-craft a dungeon level as a chunk of unique geometry and then go around setting up the logical grid to match.

Alternatively, it should be easy to do something like calculate a large, concave polygon for all dungeon geometry and then extrude it, but this doesn't help make the walls interesting to look at.

None of these approaches save hand-crafting or something involving marching cubes/tets suggest anything for a more natural environment such as caves, either.

Think I'm going to try to get the 2D debug viewer working and maintain that alongside the project, so I have somewhere to test out things whilst wrestling with the demons of content creation.

Wednesday, 30 July 2008

Hexy texture madness



Testing out the sub-texture stuff with normal maps and shadows. Right hand images apply textures on a per-hex basis, whereas the others just have random perlin smeariness.

Interpolation between hexes is still enborkinated, so the hex edges display some very rough geometry and there're no smooth variations. Also, the ugliness of the shadows is getting to me...

Tuesday, 15 July 2008

Hexy fun

Things have been a bit slow recently. I'd like to say I've got a heap more stuff done on the RL, but to be honest it's mostly been refactoring and trying to smooth out issues with running it under Ubuntu, when I've had time and energy to devote to the game at all.

I have been spending many cycles on converting the grid to a hex representation, though, and today actually implemented a bit of it over lunch. All the procedural noise and stuff is currently turned off for debuggery, so you can see the hex structure very clearly:


Apart from a massive amount of refactoring and bug-chasing, this doesn't actually have many implications for the game. I simply think the rectangular grid was bringing some problems with the 3D representation into sharp relief; diagonal movement between two pillars generally 'looked' impossible, and the natural walls looked very unnatural. The hexes help in generating more natural-looking shapes, and there are no joined corners to worry about so the mesh can be more sensibly connected.

On the flipside, straight corridors and rectangular rooms cause issues. But what the hell, what's the point of having aztec bee-lizards if they still build boring structures...