Lumberjack ignores player's vision range

Bug #585107 reported by Hans Joachim Desserud
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Low
Unassigned

Bug Description

Lumberjacks are currently able to go into dark areas beyond the player's vision range and find trees to chop down. This might also affect other workers, though I have only been able to find a reproducible scenario with lumberjacks.
1. Start a new game (map:Atoll, player:1)
2. Build a Lumberjack's hut in the southwest.
3. Speed up the game.
4. At first the lumberjack will cut down trees within the vision range.
5. Sometimes he moves to the edge, which reveals new parts of the map (along with new trees). (This seems fair to me)
6. When the visible trees are exhausted, he moves into the dark, somehow knowing a tree can be found there. (This seems a bit strange)

Expected result:
A worker should not be able to see beyond the player's vision range. Thus, the lumberjack should wait until the an area is revealed before being able to cut down the trees there.

Though I do not know the source code, could it be possible to reduce a building's workarea to what is within a player's vision range, and exclude the dark parts of the map. This would then be updated as the player expands the vision range.

Related branches

Revision history for this message
Chuck Wilder (chuckw20) wrote :

In my opinion, the lumberjack logic in this regard should behave like the hunter or soldier (or scout for that matter). Where any worker travels on the map should provide the player at least a temporary view of that area. Upon leaving an area that would normally be out of the player's vision, the area should either be grayed to show only topography (i.e. no bob animation) or returned to the blackened shade.

Revision history for this message
Nicolai Hähnle (nha) wrote :

The lumberjack already behaves that way, the bug that Hans Joachim mentions is about something else. The lumberjack (and, for that matter, also the hunter, if I'm not mistaken) can see that there are trees/animals, respectively, in places where the player herself can *not* see that those trees/animals are there.

Fixing this requires some new map search functions that honor a player's vision data. That's something that would also be good for "honest" AI, and possibly other things as well.

Changed in widelands:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

I have been thinking about this, and I think there may be three ways to handle this.

Approach A:
The lumberjacks cover the entire workarea of their building regardless whether it is a part of the player's vision (discovered) or not. This will cause workers to go into dark areas, to chop down trees they "magically" know must be there.

Approach B:
When a worker has exhausted all resources within the player's vision range, he checks out any dark parts to see if there is trees left within his workarea that have not been discovered yet. In contrast to A, the worker will not know if there are any resources in the undiscovered area. This will cause the worker to check the area even if there is nothing there. However, this might turn every building into a scout's hut light, making the real scout's hut less useful.

Approach C:
The lumberjack will only cut down trees in the parts of his workarea that have been discovered. The expection is if he discovers new parts of the map by being close to the edge (see point 5 in my original report). When the trees in the visible areas are exhausted he will not check any undiscovered areas.

I am not sure if the current way is A or B, since I haven't tested if the lumberjack would check out an empty area. To me, C seems the most sensible approach. Probably easier said than done, but I think this could be done by selecting the workarea, then excluding any undiscovered parts before the worker search for resources.

Revision history for this message
Nicolai Hähnle (nha) wrote :

The current way is A.

I also like approach C; only for the hunter it may make sense to use approach B instead, since animals are not visible under fog of war.

Revision history for this message
Jens Beyer (qcumber-some) wrote :

Approach C is now implemented in the linked branch, for all findobject program calls targetting an immovable

Changed in widelands:
status: Confirmed → In Progress
assignee: nobody → Jens Beyer (Qcumber-some) (qcumber-some)
Revision history for this message
Chuck Wilder (chuckw20) wrote :

An unadventurous lumberjack it is then. :) That is fine with me, if Approach B upsets the factoring.

Changed in widelands:
status: In Progress → Fix Committed
Changed in widelands:
assignee: Jens Beyer (Qcumber-some) (qcumber-some) → nobody
Revision history for this message
SirVer (sirver) wrote :

Released in build16-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.