Choose Your Language

Thursday 3 February 2011

Area Map - Fog of War!

How many times have you had your "desire for exploration" frustrated because of being given a whole map of an area even before you started exploring it? What ever happened to the good old "fog of war" (FOW) that represented the parts of an area we weren't familiar with yet? Well, I can at last declare that after giving it more thought, I have finally achieved this for NWN2! For the astute among you (E.g. E.C. Patterson's post on the previous Map Blog), I did indeed manage to rework the "grid" idea that I used with the Rune Puzzle into a "fog" for an area map.

The task was simple enough in the end, but something I had to keep going back to because it required the repetitive task of copying and pasting lines of data, which then needed slight alteration. My concentration only holds for short periods of time and so I had to break the task over a number of days. I am, however, most pleased with the end result. Furthermore, this new system works alongside my previous system for making the "Map Unavailable".

Area Mapping

There are some changes to the way the area map works, simply because the area map function now relates to what the PC knows about the area or has "mapped". Pressing "M" on the keyboard now brings up the map fully zoomed out and giving the maximum view. It is no longer possible to zoom in on an area map, because the map is meant to be a fixed reference that the PC has made for themselves. Note, however, the mini-map (accessed by pressing "N" on the keyboard), still has the + and - zoom buttons to focus in on the immediate area that this map provides. You will also see from the screenshots that the mini-map has been redesigned to give a slightly larger view than it did originally. (It is not subject to FOW.)



The PC starts mapping by opening the area map.


Furthermore, as the area map now represents what the PC is mapping, this map only updates when the player has the map open. If they move around an area with the map closed, then the map is not updated and the FOW is not removed. The map will also automatically close if the PC enters combat. There can be no map referencing while the PC is in combat. Mapping has been made personal to each player. Therefore, in a MP game, players will have maps with differing levels of FOW removed according to where they have explored and mapped. This information remains intact between area changes.


The Fog of War updates as the PC wanders across the area mapping.



An example of where the PC stopped mapping and moved before starting mapping again.


The Map System

The new system was designed to allow the builder to ensure a map is not immediately available to the player. However, there are circumstances when an area is either too small (only one or two rooms), or said to be known well enough by the PC to be provided with the full area details from the start. The system takes this into account, allowing the builder to enable or disable the initial FOW as required.

Current testing has shown the system to be robust and works well for both indoor and outdoor areas and even for custom size areas beyond the standard sizes. It makes only one assumption: that an exterior area has a 4 tile border, which I have not seen differently to date. However, if this is not the case, there is provision for the builder to add a couple of variables to the area in question to correct for this if need be. NB: I have NEVER seen this as a problem to date, and it may not even be possible to build an exterior area without the border in question.

Other News

I have decide that I will be releasing Module 1 prior to finishing modules 2 and 3. This is so I can start receiving feedback and make corrections I may need to make along the way. To this end, I have updated the left side pane to show the percentage completion rates for each module.

For the time being, I have placed the two other puzzles I had in mind on hold, so that I can concentrate on trying to finish the first module. I decided these puzzles and others I have in mind could be integrated at a later date if need be.

Crafting System Poll

Thanks to those who voted on the current poll. It is good to see that the alterations to the OC crafting system I have made are encouraging some to look at crafting in this module more positively. If you have not voted yet, then please do.

18 comments:

Jclef said...

Holy cow - it's really real! Fog of War for NWN2. Great work, bud! Good idea about releasing the first part early too.

Kamal said...

ooh! Most games do not require the main map to be open to update, but I guess this is either your choice or some technical limitation on how you've done it.

Lance Botelle (Bard of Althéa) said...

Hi Jclef,

I'm glad you like it. :) As there has been interest, I will upload this to the Vault.

Hi Kamal,

The current reasoning is down to choice, but inspired by the initial coding. The code currently only updates while the map is open, but could be altered to work otherwise. However, I felt that allowing a map to be drawn required the map to be open. It also provides the player a means to "turn off" the updating for amy reasons they may have.

Lance.

Nemorem said...

Having to have the map open seems a little odd to me, too. But overall... awesome.

kevL said...

@ Kamal
i kinda like the idea (if you have to have the Map open) - i mean, mapping should be a time-intensive process. Ya hafta have your charcoal and parchment out, can't do it in combat, hard to do when running around trying to escape, etc.

Lance Botelle (Bard of Althéa) said...

Hi Nemorem,

As I say above, it's a design choice, inspired by current coding. Extra coding would be required to continue the map updating when it is closed, and I decided against it from both a gaming choice and the extra CPU cost when updating.

Lance.

Lance Botelle (Bard of Althéa) said...

Hi KevL,

That was my reasoning as well. :) It is meant to be an "active choice" of the PC to map the area in question. Being in combat or not paying attention to the map stops this from happening.

Lance.

Shaughn said...

Lance, this is really great!!

I really like this and agree with having the map open. The combat example best explains why it would not update.

Following the bioware forum I see that you are considering changing that with a toggle to create a passive map feature. I would suggest instead of a toggle, go with a feat. Mapping Expert or something, "I never get lost, if I've I've been there once I been there a thousand times". This would better explain why a character would be able to map while in combat or when fleeing from combat. If the character doesn't like the active mapping they can choose to spend one of their feat selections on changing it to a passive mapping.

This will likely cause some conflict with other custom content, but I would think some of the larger class packs would be more then willing to add this feat for compatibility providing it didn't conflict with a reserved line.

EC said...

Awesome. Enough to get me to think about releasing another version of Trinity.

A few questions and comments

-Would rather mapping occur even when map closed and while in combat, the latter especially if creature event scripts have been edited. You usually don't go over that much ground while in combat i.e. you stay in current explored area, so it's a little moot.

-Why no FoW on minimap? Would rather if possible.

-Does this edit areamap.xml?

Lance Botelle (Bard of Althéa) said...

Hi Shaughn,

I think the idea of making the Expert Mapping feat is a good idea and is the way I would go for my own designs if need be.

I will probably add the code to account for the feat, but not go into too much detail as it starts to involve TLK files and edited 2das, as you say.

Lance.


Hi E.C. Patterson,

Trinity rerelease with the system may be a first to fully demonstrate it! To answer your questions/comments:

1) I will be working on a "passive" mapping system today. I will probably release it as a seperate file alongside the original as an option.

2) FOW for the mini-map is (likely) possible, but adding it there as well poses a few issues (for the way I prefer it anyway). I also wanted to allow the player at least one map facility that allowed the player to be able to zoom in and out. The FOW system has to disable these buttons to ensure it works properly.

3) You probably know this by now already (if you have downloaded the file and read the manual): Yes. :)

Lance.

Shaughn said...

Lance, I have been playing with the two demo modules this morning and WOW! It looks great and works well!

My only criticism is the minimap. It is too large and the zoomout function can cancel out the war fog feature.

On the vault I noticed there were some comments on the diameter revealed. Would it be possible to adjust the diameter based on spot or survival rank?

One more idea, these easy to come up with when not writing the code. Would it be possible to have a waypoint ot other object that could be placed on a map that would reveal the set diamter around it. That way know areas and fog areas could exist on the same map instead of all one way or the other.

Lance Botelle (Bard of Althéa) said...

Hi Shaughn,

Glad you are finding it useful. :)

The minimap can be made to the original without too many changes. However, I do not know what you mean by the zoomout cancelling the FOW. I am not experiencing this. Please can you explain what you mean?

Reason for diameter change is easy enough to plan for, but actually changing the code to account for that would take more time.

I did consider the partial FOW myself, but it did not fit in with the remit I was working to. i.e. This is supposed to represent what a PC has mapped. Giving a part FOW could be explained, but I currently have no plans to do so in my own module. Maybe it is something I could address as the need arises or when I have nothing else to do for my own module. Not enough hours in the day and a matter of priorities. ;)

Lance.

Shaughn said...

The zoomout in the mini map doesn't really cancel out the FoW, but will allow the minimap to be used for navigation instead of the map with the WoF.

https://picasaweb.google.com/S.Clark1117/NWN2?authkey=Gv1sRgCNGmgO6nt-LHWg#5570626503486292338

This screen shot is taken from a large area with a bunch of barns stuck on it. I zoomed out the minimap as far as possible. I should have taken a shot with the main map open but I haven't moved the character so they are surrounded by black and can't see any of the barns. The black circle on the mini map is what the player can actual see in game with the default fog setting. The four barns circled in red are outside the players vision. The mini map fully zoomed out can be used to bypass the FoW.

I know you are looking at adding the FoW to the mini map but if the zoom in/out features where removed and the map was set with the zoom in the middle or a little closer it would represent the players line of vision.

Lance Botelle (Bard of Althéa) said...

Hi Shaughn,

OK, I understand what you are saying now. I was aware of this, but my original design was to use the area map as a representation of the PC mapping and the mini-map a kind of what the PC can see ahead. In my own world, I have removed the fog back and so the mini-map is a fair representation of what they can actually see ahead.

That said, I did also realise that I would want to remove the excessive advantage that the mini-map gives, especially when it comes to interior areas with rooms close to each other and is why I added the mini-map being unavailable as a new option in the latest release.

As you say, disabling the zoom buttons on the mini-map as well (I have already disabled them on the area map for technical reasons) would also be a good way to prevent some potential advantages to the player as you explained.

Maybe I can look at releasing another version of the code with an option to disable the zoom buttons on module load. As long as there is no way for the player to zoom in or out between any disabling, then it should work fine. I will raise it as an option on the forums and see how much interest there is, as an alternative to making the mini-map unavailable altogether. (Especially as I cannot fathom how to include FOW on the mini-map.)

My own preference would be to keep the mini-map with the option to zoom in and out and disable it when need be (which the code currently does). That way, a zoom option is still available in the game. The problem is, you cannot turn the zoom option on and off *during* the game as it may be left in a state that is not what you want (i.e. zoomed out). It remembers it's last state if I recall correctly. Therefore, the option would have to be zoom or no zoom throughout the whole game, set in place by the builder at module load time.

Lance.

Shaughn said...

Lance, I have come across two issues:

The first is the map examine script continues to run even with the no fog waypoint. See screenshot. This is with the active mapping system.
https://picasaweb.google.com/S.Clark1117/NWN2?authkey=Gv1sRgCNGmgO6nt-LHWg#5571365545457280994

The second issue is some of the black is not being cleared in one of my areas. It is an exterior, natural area. Width=8 height=16. The angled blocks are showing up correct but the black is remaining in a portion of the screen. This area is using the passive system with the feat.
https://picasaweb.google.com/S.Clark1117/NWN2?authkey=Gv1sRgCNGmgO6nt-LHWg#5571365547343663762

I have created the feat and it is working great. Just want to verify that passive mapping is suppose to be turned off during combat, it currently is. To change that it is based on the second global int.

Lance Botelle (Bard of Althéa) said...

Hi Shaughn,

I have been unable to duplicate either of these errors. However, I have not yet been in a position to test a scenario where the "active" and "passive" states change.

However, it looks as though you are trying to do the wrong system (Passive) with the Expert Mapping feat. The Expert Mapping feat should only really be used with the "Active" Mapping System. i.e. The version that updates only when the map is actively open. Your Expert Mapper feat overrides any "Active" setting to allow the equivilent of a "Passive" mapping mode. (You say you are "using the feat with the Passive system".)

If you still cannot get it to work, please send me all the scripts that you are using for the system and I will look at them. :)

The combat variable should be able to be used with either of the systems (Active or Passive), but again, I have not tested this out yet.

As I say, do send me your scripts and let me take a look. I can then see if there is a problem I have missed.

Lance.

Amraphael said...

WOW! That's very neat. I wish that OEI had put this into the game at the release. I think the way I plan to implement it fits the game style perfect. The decision to release part 1 early is also a good one. Keep up the spirit!

Lance Botelle (Bard of Althéa) said...

Hi Amraphael,

Thanks for the encouragement.

I think if this had been done officially, it would have been a lot better, but at least this does do the job reasonably well.

I still have mixed feelings about releasing Module 1, as it is only 1/3 of the whole game/campaign. Being able to break a game into modules within a campaign makes it easier to release, but does tend to mean more modules are being released only partly done, like this will be. I will really have to stress this when I do release the first part, as it may come to a nasty shock to many players when they "come to the end" just as its "starting". ;)

Lance.