Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411488 Posts in 69371 Topics- by 58427 Members - Latest Member: shelton786

April 24, 2024, 01:07:52 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsBlock Man (Demo Available)
Pages: 1 [2]
Print
Author Topic: Block Man (Demo Available)  (Read 3595 times)
qMopey
Level 6
*


View Profile WWW
« Reply #20 on: September 21, 2020, 08:44:30 PM »

The Darkness

Finished the darkness. There's a lamp the player has to carry through levels, and this lamp provides light to buffet the darkness. Taking steps and making moves takes time, and the oil in the lamp burns out slowly reducing its radius of effect. Collecting more oil expands the lamp's light radius, granting more time to solve the level. For now I'm just showing the lamp's effect on the player by attaching the lamp's light component to the player.

When the light radius is full, only a single circle of light is applied. By using the stencil buffer it's quite easy to implement this kind of effect. Clear the stencil buffer to 1's, then render in circles over the lights while setting the stencil operations to set all rendered portions to 0. Afterwards, render the darkness over the screen by a full-screen quad with a darkened color.


The light radius can go from 0-1, 0 meaning completely dark, and 1 meaning the maximum radius. This 0-1 value is then cut into different sections with a very useful function I called remap.

Code:
float remap(float t, float lo, float hi) { return (hi - lo) != 0 ? (t - lo) / (hi - lo) : 0; }

This function takes an interpolant and scales it to a new range. For example, if we want all values from 0.5 to 0.6 to be rescaled to a range of 0-1, it would look like so.

Code:
t = remap(t, 0.5f, 0.6f);

Usually the input value can be outside the given remap range, and so I do also quite often use remap in conjunction with a clamp. For example, remapping t from 0.5f 0.6f to 0-1, and clamping within the 0-1 range.

Code:
t = clamp01(remap(t, 0.5f, 0.6f));

This remap function is used to map a large range of the light radius to go from bright to fully black. There's a small section near the large end of the radius remapped to fade in the gradient (the inner ring of slightly-less-dark pixels).


Another small section of the radius is remapped to fade in the creepy things at the edge of the light radius.


However, I also had to be careful to also fade out smaller lights that are not coming from the player's lamp itself. These smaller lights, if not handled carefully, would illuminate the creepy things when the player approaches, completely ruining the scary effect.


To solve this I ended up rendering all the creepy things along with the radius of all lights except for the lamp. These are all rendered with the same color. As the creepy things fade in, the other lights in the game fade out with the exact same color. To achieve this effect I utilized the stencil buffer again. First clear the screen to 0's, then render in the creepy things and non-lamp lights to set the buffer to 1. Then render a full-screen quad with the color of the creepy things.

The rest is some hand-tuned RNG to procedureally place all of the geometry for the dark creepy things at the edge of the light. There's some code to generate a crescent triangle mesh, and some code to generate the circle triangle meshes.


And finally a gif the full effect!


Despite being a fairly simple looking effect, designing how multiple different lights interact with subtle behaviors to make everything feel completely seemless takes quite a bit of design work. It would have been trivial to simply use the stencil buffer a couple times to render circles, but also rendering in creepy geometry at the border of *one* light (the player's lamp), but *not* on any other light without any kind of visual artifacts was an interesting challenge!



Oh wow - looks pretty spooky. Especially when those arms/worms reach into the light circle.

Thanks buto  Grin
« Last Edit: September 21, 2020, 09:05:20 PM by qMopey » Logged
qMopey
Level 6
*


View Profile WWW
« Reply #21 on: October 04, 2020, 12:41:43 AM »

Trying to finish up the game ASAP. Not a whole lot left. I've implemented all the planned gameplay features. Just need to finish some more art, make levels, some menu work, sound FX. Things are coming together.

I got the game compiling on emscripten, so please feel free to try out a small demo! There's around 10 or so levels to try out at the time of writing this.

https://www.randygaul.net/games/block_man.html
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #22 on: October 05, 2020, 04:35:35 PM »

Finishing up some final pieces of art. Like the candle and lanturn (only candle shown in this pic)  Gentleman

Logged
qMopey
Level 6
*


View Profile WWW
« Reply #23 on: October 06, 2020, 02:56:08 PM »

Gameplay is done, levels are done (only 15 of them), art is done. Just menus and SFX left!



Logged
marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #24 on: October 07, 2020, 12:52:19 AM »

What's the story behind those creepy shadows? The transition looks pretty neat!
I'm probably not the first to ask, was Block Girl taken?
I was first thinking Sokoban, but I believe you have some quite different mechanics to move the blocks. Where will you be releasing Block Chick?
Logged

qMopey
Level 6
*


View Profile WWW
« Reply #25 on: October 07, 2020, 03:22:34 PM »

What's the story behind those creepy shadows? The transition looks pretty neat!
I'm probably not the first to ask, was Block Girl taken?
I was first thinking Sokoban, but I believe you have some quite different mechanics to move the blocks. Where will you be releasing Block Chick?

The idea is icy girl going down the crypt encounters spooky stuff. I wanted the creepy shadows as a gameplay mechanic to lead to interesting puzzles, but I actually think it's sort of a failed game design prototype to be honest. So, it's only in a few of the levels. At least it looks cool!

Working on a title screen thing. I really want the character to look kind of like on of Syosa's pieces. He draws beautiful faces. I think I got the proportions and pose down just fine, but, will take some great effort moving forward to get the kind of face I'm looking for.

Logged
buto
Level 0
***



View Profile WWW
« Reply #26 on: October 08, 2020, 12:38:52 PM »

First I wanted to say that I think it's really cool how fast and coherent this all came together. Seems like you're following some kind of plan...

I played the demo a bit. I think in level 5 the dev-tool disappeared and I was not able to restart the level. I will pick it up again in one of the next days. It was actually fun Smiley. Here are some first thoughts:

  • Very nice atmosphere from the very beginning. Nice choice of music and cool graphics!
  • Pressing keys on my keyboard felt somewhat laggy. I think that's due to the pause between turning into some direction and actually moving into that direction. Actually, first having to rotate the character before being able to move forward is probably unnecessary if you're not carrying a block, at least.
    If the player is not carrying anything, rotate+move with one key press would make walking around quite a bit more pleasant, I think.
  • Where is the spinning animation? Smiley
  • I really missed a 'Restart Level' button (ah - ok - you can reload the level again)
  • I actually liked the puzzle design. I had to think more than I anticipated from the screeshots.

Looking forward to the next levels and further updates!
Logged

xjxoxhxnx
Level 0
*



View Profile
« Reply #27 on: October 12, 2020, 10:11:47 AM »

I noticed in one of your updates you used an array in your code. When I found out about arrays I used them all the time. What language are you using?
Logged

I code old style text based games
qMopey
Level 6
*


View Profile WWW
« Reply #28 on: January 01, 2021, 11:25:50 PM »

I noticed in one of your updates you used an array in your code. When I found out about arrays I used them all the time. What language are you using?

It is in C++ Smiley

In other news, game is open sourced here -- https://github.com/RandyGaul/block_man
Logged
oahda
Level 10
*****



View Profile
« Reply #29 on: January 05, 2021, 02:52:56 AM »

Tried the demo! Sounds and looks really nice. Kiss

I'd prefer instant movement at a constant (slightly slower) pace as soon as you hold a directional key down to the wait followed by fast movement there is now, as it felt a bit unresponsive. Felt a bit unclear when I can and can't turn while holding a block but maybe I'm missing something. Who, Me?

Title screen art looks great so far, I'm not familiar with the art you're trying to emulate but I think the face is very well-drawn as is FWIW. c:
Logged

Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic