Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411196 Posts in 69314 Topics- by 58380 Members - Latest Member: feakk

March 18, 2024, 08:21:10 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsThrockmorton (twin-stick dungeon crawler)
Pages: [1]
Print
Author Topic: Throckmorton (twin-stick dungeon crawler)  (Read 2175 times)
Spooner
Level 0
***



View Profile WWW
« on: July 23, 2012, 07:57:40 AM »

Throckmorton

This is a twin-stick shooter (move with keys & aim with mouse) where you dungeon-crawl through a cavern system. The gameplay is relatively simplistic (you have health, energy and two attack modes: direct shot and AOE burst); I'm aiming for a level of complexity similar to Alien Swarm, I think.

Map and texture generation is entirely procedural (mainly based on Simplex noise), which is poor quality at the moment, so I need to work on it a lot. Each level layout is based on a simple seed, so sharing levels would be effortless.

Ultimately, it is intended to be run in networked coop mode (2-4 players, depending on how well that works out; it is designed with that in mind, but I haven't made it actually work like that).

I am using a dynamic shader-based line-of-sight lighting system, but it is glitchy at the moment, so I've disabled it for the screenshot.



Links
* Github project (Implemented in Ruby and C and glsl)
* Wiki (Includes description of what is currently implemented as well as a todo list).
* Early devlog (it still had tiles back then :D)
« Last Edit: July 23, 2012, 04:17:14 PM by Spooner » Logged

Unity of Command (ex-lead programmer) and my personal games
Spooner
Level 0
***



View Profile WWW
« Reply #1 on: July 24, 2012, 08:25:03 AM »

Originally, the game had used tiles and Chipmunk physics for each of the square wall sections. I just changed to a completely free-form map and was a bit perplexed how to efficiently continue to be able to prevent my objects from hitting the walls.

The answer was a distance map. First thing I tried was to implement it in Ruby (A high level interpreted language), but it took 1800ms to generate one for my level map and wasn't terribly accurate. The size of the yellow squares indicates the clear distance from a wall:



I re-implementeded the algorithm as a GLSL fragment shader and now it takes 10ms to generate and is at least a thousand times more accurate (it calculates distance for every pixel and looks for blocking terrain in more directions and steps outward from that point at lower intervals)! Ha!

The brightness of the floor indicates the distance from a wall - I set r/g/b channel equal to the distance, in pixels, from the nearest wall. To prevent collisions with walls, all I need to do is ensure that the object's collision radius is lower than the red channel of the pixel it is moving to. This information will also allow me to work out navigation routes around the map allowing for smaller creatures to know they can fit through smaller spaces.

The red dots are points guaranteed to be far enough from a wall to allow any object to spawn (I need to move those about a bit so they don't look like they are tiled :D). The entities have their collision circles drawn on to show their "real" sizes.

« Last Edit: July 24, 2012, 03:53:07 PM by Spooner » Logged

Unity of Command (ex-lead programmer) and my personal games
Spooner
Level 0
***



View Profile WWW
« Reply #2 on: July 24, 2012, 11:15:38 AM »

As an appendix to the last post, here is the mask of the solid terrain (greenish shows blocking terrain) and the resultant distance map (lighter shows areas a long way from blocking terrain):

terrain mask:


distance map:


superimposed:
Logged

Unity of Command (ex-lead programmer) and my personal games
Spooner
Level 0
***



View Profile WWW
« Reply #3 on: July 27, 2012, 02:22:19 PM »

Haven't achieved much in the last couple of days, working on optimising parts of my graphics engine a bit. I added line of sight using the distance field (the enemies now turn and run at you, but only if they see you). Tried to add wall-sliding to the physics code, but everyone just gets stuck on the walls even if they are trying to move obliquely along them; doesn't matter so much for the enemies, because they will have pathfinding eventually, but I need to allow the player to be able to move close to convex walls without sticking. Wondering if rolling my own physics was such a great idea after all, but I couldn't see a good way to integrate dynamically-shaped terrain with a polygon-based physics engine Crazy
Logged

Unity of Command (ex-lead programmer) and my personal games
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic