[Zscript] Map Exploration %

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Collegia Titanica
Posts: 83
Joined: Thu Jan 25, 2018 1:37 pm

[Zscript] Map Exploration %

Post by Collegia Titanica »

I'm sure you all know that shroud that gets revealed in RTS games as a unit moves.

I'm thinking of implementing a statistic feature:
-How much has the player explored the map ?

We have "secrets" but that doesn't tell much.

Brainstorming right now:
-Player actor emits linetrace rays often and in many directions, but with limited Range. If one and/or multiple linetraces hit walls, the sector that has those lines is added to an array or something.
In effect, player has a shroud-like-revelation that is used for sector mapping.
I guess the end result would be
total sectors - revealed sectors ... percentage wise. Thoughts ?
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: [Zscript] Map Exploration %

Post by m8f »

I've done this here.

Basically, I count the sectors with Sector.SECMF_DRAWN flag. The sectors that are found at level start are not counted as foundable (declaring the map 15% explored right on the start makes no sense).
The one problem is large inacessible areas. It can be monster teleport rooms, and special deathmatch areas in singleplayer maps. I deal with this by declaring the map explored when about 90% of the sectors are drawn.
Spoiler:
Post Reply

Return to “Scripting”