Git Product home page Git Product logo

fallout4-pipboy's Introduction

Fallout4-PipBoy

Library to use the TCP communication mechanism/protocol from PipBoy Android/iOS app with .NET

[WIP] Sending commands

see branch CommandSending

Library usage

The game state can be tracked with the GameStateReader class and accessed via a dynamic object:

static void Main(string[] args)
{
    using (var streamProvider = new PipBoyStreamProvider())
    using (var stream = streamProvider.Connect("192.168.0.5", 27000))
    {
        var gameStateReader = new GameStateReader(stream);
        while (gameStateReader.NextState())
        {
            Console.WriteLine("Player X position: " + (float)gameStateReader.GameState.Map.World.Player.X);
        }
    }
}

Instead of connecting to the game, the data can also be read from file for easy debugging:

    // ...
    using (var stream = streamProvider.ReadFile("data.dump"))
    // ...

See PipBoyTest/Program.cs for an example.

Events

It is possible to register for the Changed event of a game object:

var gameStateReader = new GameStateReader(stream);      // get stream from network or file
gameStateReader.NextState();                            // read first state

var playerPosition = (GameObject) gameStateReader.GameState.Map.World.Player;
playerPosition.Changed += PlayerPosition_Changed;       // register for Changed event

while (gameStateReader.NextState())                     // event are raised before NextState returns
{
    // do nothing
}

// ...

private static void PlayerPosition_Changed(object sender, GameObjectChangedEvent e)
{
    foreach (var changedChild in e.ChangedChildren)
    {
        Console.WriteLine("position changed: " + changedChild.ToString(true));
    }
}

Prints:

...
position changed: [32827: Map::World::Player::Rotation] = 89,26334
position changed: [32826: Map::World::Player::Y] = -47776,65
...

Command line tool to dump data

To record data that can be used with the StreamProvider::ReadFile method, execute via command line:

> PipBoyDump.exe -c 192.168.0.5 -r raw.dump

Objects can be dumped on the fly:

> PipBoyDump.exe -c 192.168.0.5 -r raw.dump -g objects.txt

Objects can also be created from file:

> PipBoyDump.exe -f raw.dump -g objects.txt
Options
 -c, --connect        Host to connect to.
 -p, --port           (Default: 27000) Port to connect to.
 -f, --file           Input file (instead of ip/port).
 -r, --raw            File to write raw data received via network.
 -g, --gameobjects    File to write the structured game objects.

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.