Jump to content

PZTracker - Connects the online PZ Map to your running game.


BigJk

Recommended Posts

mqDrQKQ.png

 

 

Hello Guys!

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

 

 

 

dXx9ruV.png

 

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

Now we come to the last part. We got the data that we can get through the websocket from the pz_tracker.exe. Now we have to get the data into the map. Currently I solved the Problem with a small javascript code that I lode into the running map website via the "Chrome Development Console". It,s just pasting the code into the console and hit enter, so even somebody without coding experience should be able to do this. What the code does is to connect to the websocket and read the data that get sent to him. It then uses the data to move the map to the player location or respond to key press events and move or zoom the map.

 

 

 

oW61Nz1.png

 

Just download the ZIP File of the latest release: https://github.com/BigJk/PZTracker/releases

 

 

 

12P1cWf.png

 

Setup Video: https://www.youtube.com/watch?v=a4ycQgryxzw

 

Step 1:

Download the current Version and extract it somewhere.

 

Step 2:

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)

 

Step 3:

Start the "PZTracker.exe" and open the PZMap

 

Step 4:

Activate the "PZTrackerMod" in your running Project Zomboid.

 

Step 5:

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');)

 

Step 6:

Load a Singleplayer Game or join a Server that has "PZTrackerMod" enabled and hit when you see your character. Now you should see the map moving. Use the shortcuts mentioned above.

 

Advanced Stuff

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

 

 

 

5FEQAUM.png

 

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

Edited by BigJk
Link to comment
Share on other sites

2 hours ago, blindcoder said:

Wow, that's awesome! I always wanted to make something like that, but was always too lazy to :-)

 

I'm currently on vacation but will have a look in about a week or two when I'm back!

 

Glad to hear that you and the others like the idea :D

 

Is there a possibility to maybe integrate this into the map to get away from the manual "injecting" the code? Because it would just need a button that opens a connection to a local websocket and waits and responses to certain packages. The Javascript code is just 35 lines long. So nothing too huge and fancy :P 

 

Just leave me a pm when you are back :D (I'm also German)

 

Link to comment
Share on other sites

Tada! First Release!

 

So, I added a download link to the current version, wrote a little setup guide and made a little video about it. Unfortunately I won't be home from tomorrow on til next week. I can answer here but if this release contains any bugs or is broken for the majority of people I can't do much about it. This is the first release and only tested on my machine. So don't expect wonders and bugs are possible even though I never noticed any. 

 

I'm also a bit nervous. I'm not really used to releasing anything, so don't be to hard on me :-(

 

If there are any questions just ask and I will try to do my best to answer everything :-)

 

EDIT: Also added a link to the PZTracker Github Repository, so everybody can take a look at the code. It still needs to get some more structure and cleaning even if it's not that long.

Edited by BigJk
Link to comment
Share on other sites

Just as a question here. Could you use a similar concept to make an extension for team speak that would provide location based voice?

 

Grab player location --> Send player location to TS server --> Server checks distance to other players --> adjusts volume accordingly

 

Awesome job! I like the idea of this because it makes sense that you would know your way around the town you live in.

 

Link to comment
Share on other sites

14 hours ago, Leond said:

Just as a question here. Could you use a similar concept to make an extension for team speak that would provide location based voice?

 


Grab player location --> Send player location to TS server --> Server checks distance to other players --> adjusts volume accordingly

 

Awesome job! I like the idea of this because it makes sense that you would know your way around the town you live in.

 

 

That's an awesome Idea. I will definitly take a look into this when I'm back! :-D

Link to comment
Share on other sites

7 hours ago, BigJk said:

 

That's an awesome Idea. I will definitly take a look into this when I'm back! :-D

Yay! Also just want to say your code is really easy to read! One could say "Functional and elegant" ;-)

Again great job!

 

Did some quick looking and it might be a bit easier to do with mumble.

https://wiki.mumble.info/wiki/Positional-Audio

here is some info about the positional audio system in mumble. The very bottom of the page has a link to info about making plugins for it.

 

I made a separate post to discuss the possibility of this as not to clutter your mods post

 

Edited by Leond
Added information about mumble
Link to comment
Share on other sites

New and easier Version out!

(Edited the "Setup Guide" section of the top post to fit to this version)

 

New Features:

  • Now adds a red dot to the map for better navigation
  • Simplified injection process to one line of code
  • Start parameter of Project Zomboid and settings of PZTracker can now be easily changed via a automatically generated config file

 

New Setup Video: https://www.youtube.com/watch?v=a4ycQgryxzw

 

Download: v1.3

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...

Someone had asked about a in game map and i mentioned this, even tho i havent played around with it yet.

 

Well i just got done taking a look and it appears its broken now, atleast with build 36.4

 

Looking at the console it says it connects, arrow keys and zoom in/out works from in game, but it doesnt track at all.  I turned on debug and nothing shows up. Well it does show user bob so it is connecting, just not tracking.

 

Ive tried with steam and without (by changing the config file) with the same results. With a zerg of mods and with it just by itself. Code might be easly fixed since ya share it all on git, but not by me as i cant code.

 

Hopefully you are still semi around and this can be fixed up or maybe someone else can branch it out.

Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...

As of version 40.43, this still works. However, there is an issue with being able to use the steam workshop mods, it doesn't show up when opening through the PZTracker.exe

I found a workaround, however. I had to get all the zomboid workshop mods from the workshop content folder, and had to paste the mods inside C:/Users/NAME/Zomboid/mods

Link to comment
Share on other sites

  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...