Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Dwarf radar v.1 release  (Read 3658 times)

seyedaed

  • Bay Watcher
  • In honor of Zutthan Govoslorbam
    • View Profile
    • Twitchin
Dwarf radar v.1 release
« on: September 22, 2018, 02:54:41 am »

Hihi all,

I've been a long time player and lurker here.  Before I talk about the app - let me say I really appreciate everything everyone does for df.  The game and all the mods have given me so much joy in my life.  :)   

Anyway Introducing an updated release.  Now with windows exe

Dwarf radar v.1 (until I think of a better name)

http://dffd.bay12games.com/file.php?id=14025

11.4.2018 release
Changelog

  • Radar now shows more detailed information
  • A windows exe is included so no need for python on win
  • Lots more detail included
  • Can now monitor a location by passing coordinates
  • Included a script to stop radar and monitor a location

Spoiler (click to show/hide)

About
Dwarf radar is a hacky script I threw together based on other ppls and my code.

The radar will display a scene from another part of the current game map. This can show things not displayed on the main screen including on different z-levels. Please note the screen is in no way complete. The main thing I wanted to show was some of the critters, walls, and some other main structures like stairs, etc.

The radars basic operation is to show a single scene based on the info submitted to it. However, I also included a script that I use to follow a dwarf or critter around.

The radar is pretty stable but might be a memory or cpu hog. I haven't had any issues with it, but I haven't really tested its performance.

Spoiler (click to show/hide)

Package info

This package includes several files that can be used to run the dwarf radar. The list of files included follows:

bmods/radar.exe - This is a windows version of the interface that listens on network port for incoming radar information and displays data

bmods/radar.py - This provides an interface that listens on network port for incoming radar information and displays the data

hack/scripts/radar.lua - This script is the main file to run the radar. It queries the game to try to determine the location of a unit based on a unit id passed into it.

hack/scripts/radarfollow.lua - This script will send a repeat command to radar.lua with the id of the unit to show, essentially following it around

hack/scripts/radarcurrentlocation.lua - This script will stop the radar on the current coordinates and track whatever is in that location

hack/scripts/showdwarves.lua - This script will print to the dfhack screen the names and ids of all the dwarves in the fort

hack/scripts/showcritters.lua - This script will print to the dfhack screen the names and ids of all the critters in the current game (not world)

Requirements

Dfhack .44.12-r1 (last tested on but works on .44.10)
Dwarf fortress -.44.12 (last tested on but works on .44.10)

Windows
-------
Just run radar.exe

Python
-------
Python 2.7
PyQt4 (windows wheels included)

Note: Versions should all be the same. If using 64bit df - you might want to use 64 bit python, etc.

Installation

Install dwarf fortress.
Install dfhack
Unzip file in your dwarf fortress root directory.
Install python 2.7
From a console navigate to bmods folder under installation directory
If using 32bit type:
pip install PyQt4-4.11.4-cp27-cp27m-win32.whl
Else if using 64bit type:
pip install PyQt4-4.11.4-cp27-cp27m-win_amd64
Congrats you have installed everything.

Usage

The scripts only work in game and has only been tested in fort mode.

In the dfhack console you can type:
showdwarves
This shows all dwarves in fort, profession and id

Spoiler (click to show/hide)

In the dfhack console you can type:
showcritters
This shows all critters around fort, their species and id.

Spoiler (click to show/hide)

To activate the radar in a command console navigate to the bmods directory and type:
python radar.py

If using windows just double click:
radar.exe

A blank window will display.

To show something in the radar in the dfhack console type:
radar unit_id
Where unit_id is the unit id of the unit. For example:
radar 4517
A screen showing the unit and its surroundings should show

To follow a dwarf/critter with the radar in the dfhack console type:
radarfollow UNIT unit_id

Where unit_id is the unit id of the unit you want to follow. For example:
radarfollow UNIT 4517

To follow a Location with the radar in the dfhack console type:
radarfollow LOCATION x y z

To monitor the current radar location in the dfhack console type:
radarcurrentlocation

Spoiler (click to show/hide)

Other notes
Yes I realize the code isn't great. This is my first df project and first with lua and python. Not that my code will get any better, this is just done for fun.

The radar uses a network connection to communicate between dfhack and python.  You will need to enable localhost on port 9999 to your firewall.

The code can be buggy too. I've only tested it on my stream.

There is a lot of stuff missing and some stuff might be coded with wrong characters, etc.

However - there is a lot of potential. It could possibly serve as a window for a multiplayer feature or monitoring those pesky assassin dwarves or vampires. Maybe it could eventually show graphic content or be hacked for adventure mode. idk - lots of possibilites if it doesn't break more stuff.
glhf - and thanks to everyone whose code I stole - creators of everything df that have given me so much fun - much love. :D

« Last Edit: November 05, 2018, 12:47:10 am by seyedaed »
Logged
We honor Zutthan Govoslorbam: "For having one of the most exciting, yet boring lives ever."

Gitlab:   https://gitlab.com/deadeyesisnewb/
Twitch:   https://www.twitch.tv/seyedaed/
Twitter:  https://twitter.com/adwarfslife

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Dwarf radar
« Reply #1 on: September 22, 2018, 07:35:55 am »

Yeah, secondary display to see the progress of multiple simultaneous things (i.e. in current fort simultaneously digging around magma sea and ice-casting and constructing in the sky) is quite attractive.

seyedaed

  • Bay Watcher
  • In honor of Zutthan Govoslorbam
    • View Profile
    • Twitchin
Re: Dwarf radar
« Reply #2 on: September 22, 2018, 12:41:14 pm »

Yeah, secondary display to see the progress of multiple simultaneous things (i.e. in current fort simultaneously digging around magma sea and ice-casting and constructing in the sky) is quite attractive.

Thanks for feedback!  Right now it just follows a unit or zooms in on a unit, but you gave me a great idea for a tweak. 
Logged
We honor Zutthan Govoslorbam: "For having one of the most exciting, yet boring lives ever."

Gitlab:   https://gitlab.com/deadeyesisnewb/
Twitch:   https://www.twitch.tv/seyedaed/
Twitter:  https://twitter.com/adwarfslife

seyedaed

  • Bay Watcher
  • In honor of Zutthan Govoslorbam
    • View Profile
    • Twitchin
Re: Dwarf radar v.1 release
« Reply #3 on: November 05, 2018, 12:35:01 am »

Ok this is a new release of the radar. 

11.4.2018 release
Changelog

  • Radar now shows more detailed information
  • A windows exe is included so no need for python on win
  • Lots more detail included
  • Can now monitor a location by passing coordinates
  • Included a script to stop radar and monitor a location

Here is an example tracking the elusive magma crab in its natural habitat


« Last Edit: November 05, 2018, 12:37:42 am by seyedaed »
Logged
We honor Zutthan Govoslorbam: "For having one of the most exciting, yet boring lives ever."

Gitlab:   https://gitlab.com/deadeyesisnewb/
Twitch:   https://www.twitch.tv/seyedaed/
Twitter:  https://twitter.com/adwarfslife

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: Dwarf radar v.1 release
« Reply #4 on: November 05, 2018, 07:11:26 am »

Cool. Will be handy for keeping an eye on wayward FBs when they decide they'd rather go for a swim.

Will it be possible to monitor multiple locations?
« Last Edit: November 05, 2018, 07:14:25 am by Bumber »
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

seyedaed

  • Bay Watcher
  • In honor of Zutthan Govoslorbam
    • View Profile
    • Twitchin
Re: Dwarf radar v.1 release
« Reply #5 on: November 05, 2018, 12:01:52 pm »

Cool. Will be handy for keeping an eye on wayward FBs when they decide they'd rather go for a swim.

Will it be possible to monitor multiple locations?

This is a great idea!

It should definitely be possible but probably require additional scripting.  You can probably set multiple repeat timers on a single radar. 

This is the code I use in radarfollow to follow a unit:

    dfhack.run_command("repeat -name radarjob -time 10 -timeUnits ticks -command [ radar \"UNIT\" "..unitId.." ]")

You can probably set make another run command and create a script that switches between the two. 

I'll create a sample when work slows down this week.  :)
Logged
We honor Zutthan Govoslorbam: "For having one of the most exciting, yet boring lives ever."

Gitlab:   https://gitlab.com/deadeyesisnewb/
Twitch:   https://www.twitch.tv/seyedaed/
Twitter:  https://twitter.com/adwarfslife