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.

Newcomers DBPro Corner / FOG OF WAR?

Author
Message
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 11th Dec 2003 15:52
how do you people make the fog of war for your strategy games?
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 11th Dec 2003 16:46
I'd suggest using the FOG DISTANCE command.

You could set the fog to the viewing distance for the current vehicle or character - just do a check when the object moves onto a new tile - you would'nt want to check it every loop. An easy way to decide on the fog range would be to check the current unfogged area for 'tiles' that have been visited. The more tiles visited, the less the fog.


Van-B


I laugh in the face of fate!
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 11th Dec 2003 18:33
well,in the screen, you see 10 tiles across and 10 tiles up to down..
so the character has visited only the 5 tiles in both directions yet,
how to use a fog distance command??
does dbp support fogging half of the screen only? i dont think so.
KNau
21
Years of Service
User Offline
Joined: 25th Nov 2002
Location: Canada
Posted: 11th Dec 2003 19:40
If you are using a tile-based engine then I would create an array entry for each tile DIM fogged(100,100) and have all the tiles set to 1. When you update the screen, every tile that has a fogged value of 1 will be drawn black.

When you position the character simply get the tile positions within 5 tiles of him and set their fogged value to 0. When you update the screen every tile that has a fogged value of 0 will be drawn using the appropriate graphic since the tile is visible.

You can also to a running check every so many cycles to re-fog areas that the player is no longer near if you like.

http://www.canceriannewmedia.com
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 11th Dec 2003 20:14
Hey im interested in Strategy games. How do you make the tiles?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Dec 2003 22:53
KNau stated the method that I've been experimenting with.
You don't need fog tiles to cover the whole map, only enough to cover the visible screen. Get a character's screen coordinates, then hide all fog tiles within a certain radius of the object/character.

If you wanted to get fancy, you could use 1 image which is drawn offscreen the pasted over. The image would would have circles cut out of it representing the visible land areas. This would be one method to use for a less grid-like look, and display gradients in the image/fog. You'd probably have to use memblocks to be able to update the image fast enough for it to be effective.
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 11th Dec 2003 23:53
You can use any 2D graphics program to make tile images. From there you can load them directly to the screen, create and position sprites, or assign them to 3D planes and position them within your game space.
--
TAZ
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 12th Dec 2003 10:59
i have no ideas what i am talking about, but i wonder if it is possible to make one huge plane over the matrix forexample and setting an oval shaped alpha map textured on the plane.
Like a visible oval textured in the middle of the plane.
and while the character moves,calculating the x,y coordinates of the character on the matrix and scrolling the oval visible texture on the plane syncronised with the motion of the character
if anyone understood what i said,can you tell me if is that possible?
thank you.
Mougli
20
Years of Service
User Offline
Joined: 10th Dec 2003
Location: United Kingdom
Posted: 12th Dec 2003 11:35 Edited at: 12th Dec 2003 11:41
i think i know what you mean(maybe )

what your saying could work,but the camera would have to be directly above the character(looking straight down) to work.Also you would have to constantly edit the texture on the plain - otherwise you'd just get an oval that moves with the character and blocks out where you've been.(unless thats what you want)

Also its a B CH to scroll texture relative to something else as you can only scroll by a floating value between -1 and 1.

Is the glass half empty - or half full?

You thought bubbles was a monkey? - well she is my banana ...
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Dec 2003 12:05
Actually the black plain idea might work.

You could start with a big plain, at ground level, then colour it dark grey (not black), then everytime a unit goes to a new tile, you'd adjust the image so that the areas under units are disolved. If the plain was negative ghosted, you would colour the revealed areas grey, or jet black if your using transparency. The idea is that you disable the plains ZDepth, that way it is drawn on top of everything.

If your level is 100x100 tiles, you could just use a 100x100 image, that way the fog would blend between the tiles, it would'nt look blocky, it'd look just like warcraft2, probably smoother though.

In DBPro you could make the image from a memblock, like have the image as a memblock, adjust the pixel colour inside the memblock then convert to an image each time.

In DBClassic you could use a hidden bitmap and plot fog changes (probably best to do it on a unit by unit basis), then get the image.


Van-B


I laugh in the face of fate!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Dec 2003 21:45
Quote: "If your level is 100x100 tiles, you could just use a 100x100 image, that way the fog would blend between the tiles"



I don't get how you think that would show a blend between tiles. 1 tile would be hidden, then the rest visible. Creating a grid-like fog.
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Dec 2003 22:12
Nah, the blurring of the texture would mean it'd blend the image over an entire tile, if the image is the same size as the tile size of the level.


Van-B


Next time he runs past, GRAB HIM!

Login to post a reply

Server time is: 2024-09-21 12:06:16
Your offset time is: 2024-09-21 12:06:16