Coder Social home page Coder Social logo

dfhack-client-python's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dfhack-client-python's Issues

Getting all tiles in local map

Hello,

First I would like to thank you for putting up this work. I am struggling a bit with the interface.

Basically I want to grab information about all ingame tiles of the currently opened Fortress with DFHack running in the background. Ideally, this would be a 3D matrix with each cell containing information about the type of the associated tile (air, rock, water, wood...), potentially with buildings, items and creatures in that tile.

I dug a bit in DFHack documentation and from what I understand tiles are gathered in blocks. So I was trying to use the GetBlockList function to see what I could get (and from what I see in https://github.com/DFHack/dfhack/blob/b954cd7a0d574fa92d7c9a26a9e2298ab9126959/plugins/remotefortressreader/remotefortressreader.cpp#L1395 it seems to access tile info).

Sadly the ouput has an empty field for the map_blocks and I don't really know if the interface is broken somehow or if I am doing something wrong.

I edited blendwarf.py with theses lines:

from RemoteFortressReader_pb2 import BlockRequest

from RemoteFortressReader_pb2 import BlockList
@remote(plugin='RemoteFortressReader')
async def GetBlockList(input: BlockRequest, output: BlockList): pass

and

    # Input argument
    blockRequest = BlockRequest()
    # Values based on what I saw in GetMapInfo
    blockRequest.min_x = 88
    blockRequest.max_x = 90
    blockRequest.min_y = 66
    blockRequest.max_y = 68
    blockRequest.min_z = -16
    blockRequest.max_z = -14

    # Reproducing the formulas of plugins/remotefortressreader/remotefortressreader.cpp
    center_x = (blockRequest.min_x + blockRequest.max_x) / 2
    center_y = (blockRequest.min_y + blockRequest.max_y) / 2
    nb_points = ((blockRequest.max_x - center_x + 1) * 2) * ((blockRequest.max_y - center_y + 1) * 2)
    blockRequest.blocks_needed = int(nb_points * (blockRequest.max_z - blockRequest.min_z))

    # Output argument
    blockList = BlockList()

    # Call to function
    print("Blocks: ", (await GetBlockList(blockRequest, blockList)))
    print(blockList)

I just see Blocks: map_x: 89 map_y: 67 so the funtion is well-called and returns values, but nothing for the blocks.

Do you have any idea about what is wrong?

Thank you for your help,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.