Wednesday, July 8, 2009

LOS and other stuff

Well, I haven't quite gotten to LOS yet, but I've written methods that allow for it. Previously, the screen was being generated via the environment class without any regards as to what the selected unit could see. I've added a few unit variables and methods so that (unless you've enabled omniscience) the player only can see what the unit can see. I don't have a LOS algorithm yet, but I've got it set up so that I can drop one it. I randomly set the boolean array 'player can see this tile' to T/F and it works.

I've been reading through a few LOS explainations and such, but I think to start that I'll just do something simple.

Also, I've implement directional facing, both automatically when you move a certain direction, and also for TU cost if you change which direction you are moving while you are motionless.

Another thing, I've started writing methods to allow for sounds and smells to be left in the environment by agent's (and alien's ) actions. Sounds will only be stored for the current and previos turn in the form of a linkedList. Selecting a unit will show which sounds they heard (and where they may have originated) I'm trying to add in more tactical elements. :-)

2 comments:

droid factorial said...

Any forum thread on roguelikes, given sufficient length, will eventually degrade to discussions on LOS.

You are starting to work on detection/sensory data. There are some good articles on roguebasin on AI, this one (about halfway down, ctrl+f "It's common") shows how I plan to do sensory data. Any event that could be detected is stored by the map, and an actor will ask for events that it should know about every update.

Something potentially tricky with your situation is how do we represent LOS of soldiers vs. LOS of player. Perhaps the best solution for the sake of gameplay is to just assume that anything that any soldier is aware of, all soldiers are aware of. Thus a sniper can hit a target even if it is being detected by another soldier.

abagoforanges said...

Yeah, I'm aware that there are a lot of LOS articles out there. I've got a few bookmarked, but for now I just need something simple... to get me started. I'll check out the page you suggested in a few minutes.

As far as LOS is concerned with multiple soldiers, I think I'll pool LOS for all soldiers that can see each other, (picture soldiers signaling to each other) Though, I might change this, and there would likely be technology that would let all soldiers know what the other soldiers see. (or perhaps when they are in stealth mode (quiet) they only know what the others see if they can see that soldier... So that it's a trade-off between better awareness of the environment and better stealth. But, these kind of things would make more sense once I have real gameplay available... so that I could get feedback about how much it makes sense to limit LOS in this way.

Also, I really appreciate your feedback on my posts.