revealing area? how?[solved by me lol]

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

revealing area? how?[solved by me lol]

Post by omar shaaban »

like in strategy games your unit is standing and the map is black and then u move your unit and the map reveals and the only lighted and active area is the area around the unit!!?
Last edited by omar shaaban on Sun Jun 24, 2007 9:22 pm, edited 1 time in total.
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post by Dances »

you could use lights. Turn the ambiend light to 0 and give every unit its own light. Otherwise you would need to use tiles I think.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

... or have a Texture applied on a quad above the scene (between camera and scene) and use alpha channel for holes. If you use antialiasing it will also make the gray area effect. Then just edit your texture with white/black pixel for your fog-of-war (that's the name). As for unit to bu unselectionable under the fog, check the tile it's on against a dual array or your texture (array would be faster but then you got information in double). Anyhow, experiment alone a bit before asking, think, search forums like gamedev, gamasutra, etc. Don't expect an easy ride to your game creation. Some modules you'll implement might even take weeks...
olivehehe_03
Posts: 157
Joined: Tue Mar 20, 2007 8:30 am

Post by olivehehe_03 »

...Some modules you'll implement might even take weeks...
And a few more weeks of tweaking them because the person you got to test them found some massive bugs :D

Anyways, dorth's idea seems like it should work, textured quads on each tile or something like that. Just remember, if you look at any other RTS game units aren't visible under the fog or war but any buildings you've seen are. Just get a basic implementation going and then tweak it so it acts more fog of war like
Tell me what you cherish most. Give me the pleasure of taking it away.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

AHHHH! I never suggested a quad per tile! That's way more than is needed. Just use a single quad and alter it's texture...

P.S.: The reason I suggest a Quad instead of a billboard node is simple. Imagine if you start supporting rotation of camera like Warcraft 3 ;) Or just if your camera is at an angle... meh, way better off with a quad ^^
fvapres
Posts: 2
Joined: Wed Jun 20, 2007 1:50 am

Post by fvapres »

If you're using models, you could hide the mesh's for the enemy pieces unless they're in a certain radius of your pieces/buildings...using a class for the pieces wouldn't be that difficult...

Mesh (pointer returned by loading the mesh - use it to hide/show the units)
Affiliation (Yours/Enemy 1/Enemy 2/Enemy 3...)
Unit Type (Person/Building - used to determine viewing distance)
Location X/Y
Movement Speed
Hitpoints
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

.....
Last edited by omar shaaban on Sun Jun 24, 2007 9:32 pm, edited 1 time in total.
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Oy, then seriously, read a bit more and practice with the engine too.

Simple idea. You have a camera at point A. You got your map and units on a plane placed on point C. Place a Quad (a rectangular mesh with only 2 dimension) on a plane with the same normal as your map (aka, parallel to it)

Then, on that quad, apply a texture that is at first fully black. For the Alpha Channel, put it all to opaque. Then, either choose white as your alpha channel or change the pixel's alpha channel yourself. Second method would likely give you a better result in the end, but if you are somewhat new to textures and images manipulation, go with the first method. If you need help with that, search either the web for ways to edit an image in memory, read the Irrlicht demos and API or search the forum for RTT and anything linked with that. I'll assume you will find a way to do that (because I will not write that code for you...). From there on, you find a way to determine which tile should be seen and which shouldn't. You apply full opacity to the hidden tile on the corresponding pixel (or pixels if you want to have round-ish kinda fog-of-war) on the texture and transparency on th others (or a degree of transparency, if you want to do hidden previously explored part) and apply said texture to the quad. Maybe you can even directly manipulate the quad's texture, though I'm not sure about that.

Since english doesn't seem to be your first language (nor is it myn, for that matter), do not be scared by blocks of text or skip something you are not absolutely sure you have understood. Read A LOT! Then some more. Then think about your problems. In the shower. In the bus. In the washroom. Before going to bed. While reading forums. While coding. While doing nothing else. Eventually you'll connect a lot more dots, become a better, and most importantly, more resourceful coder this way.
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

Dorth wrote:Oy, then seriously, read a bit more and practice with the engine too.
Well i think i am more experience than u :?
and for the method , i got it my self and even better for my tile based system but anyway thanks

Since english doesn't seem to be your first language (nor is it myn, for that matter), do not be scared by blocks of text or skip something you are not absolutely sure you have understood. Read A LOT! Then some more. Then think about your problems. In the shower. In the bus. In the washroom. Before going to bed. While reading forums. While coding. While doing nothing else. Eventually you'll connect a lot more dots, become a better, and most importantly, more resourceful coder this way
and yes my first language isn't English but i read all the English text in any post and i am very good at English and maybe even better than u offff :x
do not be scared by blocks
are u kidding :?


and your method will not work as i want because the buildings will disappear too or it will appear and the units around it will appear also!! and that what i don't want
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Do not confuse posts number on this forum and experience ;)
I might be new to Irrlicht, but not to coding, nor creating game.

Also, you never specified you wanted the building to stay visible
like in strategy games your unit is standing and the map is black and then u move your unit and the map reveals and the only lighted and active area is the area around the unit!!?
And even so, I gave you part of the solution by telling you that you could set your alpha shading to an in-between level (like 128) and thus having the grayed out area. Of course I did not tell you how you might hide units after they had been discovered because a)you did not ask about it and b) fvapres gave you a good way to do it already and telling things twice is useless.

Furthermore, your aggressivity is childish and annoying. The same goes to keeping that attitude towards me in other threads. Glad you stop the multiple punctuation marks (almost), though some punctuation would still be needed. Anyhow, you seem to want to learn and create, and that I respect very much. Making a project alone is quite a task, and you certainly didn't pick the least. But then again I'm the lead Programmer for the Game studio I work for. And before I went as a programmer (or while I was studying) I was a Game Tester, First for EA, then for another big Game Testing lab (where, btw, some of my tasks were language proofing ;) ). I've seen many projects rise or fall.

The advice I gave you where in good will and I'm happy you succeeded in doing what you were looking to do (even more so if the solution came from you.)

Anyhow, have a nice day, I'm off to bed...
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

Dorth wrote:Do not confuse posts number on this forum and experience ;)
I'm the lead Programmer for the Game studio I work for
:oops: I will never post in this forum while i am angry :P
Post Reply