Recently I'm playing PZ extensively with my Girlfriend and because I have 3 monitor's I always have the map (http://map.projectzomboid.com/) open on one of the other monitor's. One thing that annoyed me was that even in borderless window mode I had to click out of PZ to move the map to see everything I wanted. Finding the position of your player was also a bit annoying, so one night I sat down and started programming and PZTracker was the result. PZTracker connects the online map to the game. The map will follow your player position if you like and you can move around (arrow keys) or zoom in and out (num+ and num-) on the map by pressing the keys WITHIN PZ. No need to tab out of PZ. You really just need to press buttons ingame.
Little Preview: https://www.youtube.com/watch?v=sJEKmZ5Nrh0
I was faced with the problem of connecting two separated systems that had no connection whatsoever. PZ and an Website. I had to get information out of PZ and into the map website. At first I thought about memory reading, but I dropped that idea when modding PZ came to my mind. And so PZTracker currently consists of 3 "components".
Component 1: The PZTrackerMod
I had to get the information out of the game. I realized this by writing a simple mod. So the PZTrackerMod is just a typical mod written in lua (never worked with lua before, but was easy enough to get everything working in a few minutes) that prints out important information, like player position and keypress events to the PZ cmd.
Currently the PZTrackerMod has the following Shortcuts:
F - Enables or Disables follow mode. If disabled the map won't follow the position of your player.
Arrow Keys - Move the map up, down, left, right for easy navigation.
Num + - Zooms into the map.
Num - - Zooms out of the map.
Component 2: pz_tracker.exe
Now I had to get the data that gets printed by the PZTrackerMod out of the cmd, so I wrote a program in golang that starts PZ as a child process and reads and parses the stdout (the text stuff you see in the cmd). Now the program is able to get the data out of the game. To forward this data it also opens a websocket in wich all the data get's send if somebody is connected to it.
Component 3: inject.js
Just download the ZIP File of the latest release: https://github.com/BigJk/PZTracker/releases
Setup Video: https://www.youtube.com/watch?v=a4ycQgryxzw
Download the current Version and extract it somewhere.
Copy the "PZTrackerMod" to your "Mods" Folder (C:\Users\YOUR USERNAME\Zomboid\mods)
Copy the "PZTracker.exe" and "inject-min.js" to your "ProjectZomboid" Folder (With steam: C:\...\Steam\SteamApps\common\ProjectZomboid)
Start the "PZTracker.exe" and open the PZMap
Activate the "PZTrackerMod" in your running Project Zomboid.
Open the Developer Console in your PZMap browser window (Chrome: Ctrl - Shift - I).
Paste the code that is displayed in PZTracker after "Insert into development console:" into the development console and hit enter. (Should be something like: $.getScript('http://127.0.0.1:9090/js');)
Load a Singleplayer Game or join a Server that has "PZTrackerMod" enabled and hit F when you see your character. Now you should see the map moving. Use the shortcuts mentioned above.
If you start PZTracker for the first time it will generate a config filed called "pztracker_config.json". Open this file with a texteditor and you will find the settings for PZTracker. You should understand them just by the name, but in case an explanation of them will be added shortly.
Github Repository: BigJk/PZTracker
First of all I would really like to hear the opinion on this from you guys. Maybe you don't like the idea and it will just be a little tool for me to use when I play with my girlfriend, but in case you like it I will get it ready to release in a short while and think about possible future features. Any ideas? Maybe I can simplify the process of getting the data into the map and get away from this "hacky" way of doing it, even though I must admit that it works way better than I have ever expected xD
Thank you for taking your time and reading this and huge thanks to blindcoder for creating this awesome map website! I hope you don't mind my playing around xP