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 / Boardgame fog of war????

Author
Message
Dabein
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location:
Posted: 12th Dec 2003 20:22
Hey, im making a board game/rpg using a matrix as the board and with walls (boxes) placed as dividers. I want to create a fog of war system so that I can use a view from above the board as the "map" of the dungeon, but not let the player see where he/she has not been yet.

any ideas???
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Dec 2003 21:28
Why do ppl have to create threads that have already been started on the same topic?
Dabein
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location:
Posted: 29th Dec 2003 15:47 Edited at: 29th Dec 2003 15:48
Look, why dont you be alittle helpful for once and instead of insulting people when they post a question, try directing them to the right area. I searched the whole board for information on fog of war and found stuff RTS games, but nothing for what I was looking for, which is a completely different style of FOW.

This forum is all about helping, why dont you HELP or leave.
Cyberflame
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: Im not sure....
Posted: 29th Dec 2003 15:50 Edited at: 29th Dec 2003 15:50
@dabein
I agree. I hate posting, looking for help, and then getting flamed because I dared to ask for help in the NEWCOMERS FORUM.

VISIT MY GAME DEV SITE: http://www.neoeden.web1000.com/
VISIT MY APPAREL SITE : http://Cafeshops.com/gerritgear
Neophyte
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 30th Dec 2003 12:18
@Dabien

"any ideas??? "

Hmmm. That sounds like it could prove to be a challenge. But I'll give it a go. You could probably simulate it by placing a plain above every matrix tile and your character, and texture or color it black. As your character moves on to the tile delete or hide the plain permenently.

How you would go about this in code requires a bit more thinking but I'll give it my best shot. You would need to follow these steps:

1. Create a matrix.
2. Create a two-dimensional array the width and depth of the matrix(I.E. If you created a matrix that was 20 x 10 tiles big, you would create an array like the following: dim arrayname(20,10).)
3. Fill the array with data on whether it is visible or not. For now will assume that nothing is visible. You would do this with something similar to the following:



4. Create a plain of size equal to or slightly larger than your tile size.
5. Texture or color the plane black.
6. Orient this plane so it is faceing up(you are looking down on the map correct?). You can do this rotating the object around its Z-axis(I think, might be X. Definately not Y though) by 90 degrees(positive or negative depends on whether you texture it and/or have backface culling set on. If you rotate it the wrong way so that it is facing down then you won't see the texture and probably won't see the plane either if back face culling is on. I believe it is on by default for plains though I could be wrong. You can set backface culling off with the SET OBJECT CULL ObjectNumber, 0 command. As to which way is the wrong way I don't remember that off hand. I think pos 90 is the right way but I'm not sure. Try it for yourself and find out.)
7. Clone as many copies of this plane as you have tiles. You would do this in code like this:

7. Now comes a trick part. Placing each clone above a tile. I assume you already have a set height you want to view your map from so pick a number between the height of the camera and the max height of your map. For the x and z positon of the clone a bit of math will come into play. To find out where to position each clone you will have to find the center of your plains(because that is where the object position commands start from I think):


With that out of the way now comes...
8. Place character on map. I'll assuming he/she is at tile (1,1) for now.
9. Update array to reflect where character has been. So in this case since he has been at tile(1,1) you would do something like this:
arrayname(1,1) = 1
Real simple. Now I'm assuming that only spaces that your character has physically been at are updated. If your character has some sort of line of sight or area of sight then that can get a slight bit more tricky. I won't go into details of how to deal with that here because I"m pressed for time but if you need any advice on how to do it just post and I'll see if I can get the time to help.
10. Scan array for visible tiles. If they are found hide corresponding plane:


Some quick pointers that I've neglected to mention:

Keep movement tile based. This will help a lot with figuring out which plane to remove and which to not.

Don't check the array every loop. If no movement or any other effects that modify visiblity have occured, don't check the array. Use a global variable like MovementOccured or something and set it to true if movement has occured or false if it hasn't then test to see if it is true before you check the array. This will improve the speed of your game greatly.

Better yet, don't use the scan array method at all. Just hide the appropriate plain when you move your character. This will save you even more work.

If you have any questions or feel I left something out just post. I'll try to respond when I can but I don't normally frequent this board. I'll check back for the next few days or so, but after that I probably won't be around if you haven't posted anything by then.
schoenhs
20
Years of Service
User Offline
Joined: 29th Nov 2003
Location:
Posted: 30th Dec 2003 12:36
Here is what i would try, first of all hide all the units etc that are outside your visible radius, then ghost all of the buildings that are outside ur radius so that they are semitransparnt. Then change the textures on the matrix tiles outside of the radius to a slightly darker/ maybe even black and white texture i have never tried it but that seems to me like it might do the trick
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 30th Dec 2003 12:39
another way of doing a 3D fog of war is to simply hide all enemy units that are beyond a certain range of friendly units. Units that are close to this range could be ghosted. This is the method used by Impossible Creatures and Alpha Centauri and AOE.

AOE and AC also have a 2D map, that has your classic FOW black fog
over the 2D map. In 2D, a FOW is much easier to code than in 3D.

Also, a little trick here... don't use black (rgb(0,0,0)) for your FOW plains, use almost black (rgb(1,1,1)) and you'll need an array of textures for the clear areas. Just like texturing a matrix...
Use black(rgb(0,0,0)) for the transparent areas with almost black for the opaque areas. And instead of hiding the plains, retexture them .....

I don't think this will look good in 3D. But, thats how it was done in DK2. But then everything was the same height in that game (no mountains).

internet gaming group
current project http://home.comcast.net/~norman.perry/Archon.html
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Jan 2004 05:24 Edited at: 2nd Jan 2004 05:26
I'm not flaming anyone for posting. Just posting a topic which I has just seen with the exact same discussion. Though it is possible you created your post first, and I just saw the other one first. Here's the thread I was referring to. http://darkbasicpro.thegamecreators.com/?m=forum_view&t=21605&b=7


And here's a post of mine demonstrating how to change an image with memblocks mentioned from that other thread.
http://darkbasicpro.thegamecreators.com/?m=forum_view&t=21862&b=6


Waffle, do you know how they did the fog in WC3? It looks purrrty.
Dabein
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location:
Posted: 3rd Jan 2004 05:00
Thank you everyone for your ideas, I think i might be able to throw something together to get the effect that im looking for. Thanks again.

Login to post a reply

Server time is: 2024-11-25 23:43:06
Your offset time is: 2024-11-25 23:43:06