Wednesday, January 12, 2022

DayZ Safe Zone Maker

I didn't see a tool for this out there, so I thought I'd write this as a mobile-friendly web page hosted on GitHub pages that can be used from a browser.  100% JavaScript.

DayZ community server admins sometimes create "safe zones" on the map where players can go to trade or buy a house.  Admins often want to remove all the hostile spawns from that safe zone but there is no easy way to find all the edits that need to be made.

I wrote a C# program to parse the XML files from Bohemia's GitHub repository containing hostile spawns into a JavaScript array which is used by the web page to find spawns that overlap with the safe zone specified by the server admin.

Initially the coordinates and radius are used to build a square from x1, y1 to x2, y2 for the specified safe zone and each hostile spawn.  These squares can be quickly compared to see if they overlap.  Once a list of overlap candidates is generated, this list can be checked again to see if they actually overlap as circles.  A simple right triangle Pythagorean Theorem calculation gives us the distance between the center of the safe zone and the center of an overlap candidate which we compare to the sum of each circle's radius to see if the two touch or overlap in any way.  This gives us a final list of hostile spawns that the server admin needs to remove from various XML files.

https://cgrote714.github.io/DayZSafeZoneMaker.html

Here's an improved "visual" version that incorporates the iZurvive map in the background and shows the threats as red circles.  Threats that were adjacent as a square but not as a circle are in green, and the safe zone appears in blue.  This version also supports querystring variables so you can bookmark or copy the link to send it to someone.

https://cgrote714.github.io/DayZSafeZoneMakerMap.html




No comments:

Post a Comment