Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Turn based lighting effects

Author
Message
Devonps
16
Years of Service
User Offline
Joined: 5th Nov 2009
Location: Nottingham
Posted: 28th Oct 2010 09:54
My current game is a turn based graphical roguelike and I'm wanting to produce an effect that's similar to the screenshot, i.e. "real time" lighting of what the character can see. I've already coded the FOV routine and that works as expected.

Currently my game uses PASTEed Images to display the graphics.

I guess what I'm asking is it possible to re-colour the images on the fly before I paste them back to the screen.

Steve.

Marriage is a circle of rings....
Engagement ring, Wedding ring, Suffering!
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 28th Oct 2010 11:54
You can't really do much with just PASTE IMAGE, to add on-the-fly colouring, you'd have to use 3D, to allow the diffuse colour to be set.

Not all bad news though, because all you really need is some alpha transparent blocks, then paste them over the tiles to darken them. You could even have round corner parts if you like, it could be as fancy as you wanted to make it - just paste over each tile with a suitible image for the visibility. Maybe worth having a fog of war, so each tile is flagged as you reveal it, but the visibility still plays it's part...

So for each tile, draw the base tile, then if the tile has been revealed already, draw any items or enemies on that tile. Now, if the tile has not been revealed, paste a 50% transparent block on top of the tile. Then check the distance of the tile to player and use an appropriate transparent image to signify the light level/view.

Health, Ammo, and bacon and eggs!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Oct 2010 19:28
I'd use the box command (preferably the d3d_box command from Cloggy's d3d plugin) to draw over each part of the map...

Quick example attached:

Devonps
16
Years of Service
User Offline
Joined: 5th Nov 2009
Location: Nottingham
Posted: 28th Oct 2010 19:35
@Van B - thanks for the explanation, sounds within my grasp of art & coding

@baxslash - thanks for taking the time to put together a demo, that's exactly the finished effect I want.

I'll go away and experiment with both approaches.

Steve.

Marriage is a circle of rings....
Engagement ring, Wedding ring, Suffering!

Login to post a reply

Server time is: 2026-07-22 04:37:52
Your offset time is: 2026-07-22 04:37:52