Git Product home page Git Product logo

Comments (3)

praydog avatar praydog commented on June 1, 2024

Yes. I had this video sitting around for a while from since I was working on that project. I haven't touched the code for it in a really long time, and yes it's real.

from reframework.

WoefulWolf avatar WoefulWolf commented on June 1, 2024

That's really interesting! Is it possible to release this code even if it's unfinished? I'd like to take a look at it if you don't mind. Syncing entities in N:A is a bit tricky and your approach appeared flawless? Amazing!

from reframework.

praydog avatar praydog commented on June 1, 2024

Unfortunately no. At least, not in its entirety. There's a private library it's using that I'm not willing to make public. I wasn't developing it with other people in mind at the time. If it was developed with all open source libraries, I'd have open sourced it a long time ago. If I end up coming back to the project, I'd probably end up remaking it with all open source libraries.

To answer a few questions:

  1. It uses enet for packets.
  2. Player syncing involves keeping track of key state variables for the player (buttons, position, facing, etc...), as well as any animations. This is easy if you know where to find all this stuff, but since this is a mod, there's hooks all over the place to keep track of this data. Just a whole lot of reverse engineering on this part.
  3. The last thing I was working on was syncing of NPCs. I managed to get them to spawn, and sync their position and health, but that's about it. I didn't know how to control their AI routines and whatnot. This part was also kind of unstable and would crash sometimes.

Here's a little snippet of what exactly is synced:

namespace nier_client_and_server {
    struct PlayerData : public PacketT<ID_PLAYER_DATA> {
        bool flashlight;
        float speed;
        float facing;
        float facing2;
        uint32_t weaponIndex;
        uint32_t podIndex;
        uint32_t heldButtonFlags;
        Vector3f position;
    };

    struct AnimationStart : public PacketT<ID_ANIMATION_START> {
        uint32_t anim;
        uint32_t variant;
        uint32_t a3;
        uint32_t a4;
    };

    struct ChangePlayer : public PacketT<ID_CHANGE_PLAYER> { };

    struct Buttons : public PacketT<ID_BUTTONS> {
        uint32_t buttons[Entity::CharacterController::INDEX_MAX];
    };
}

namespace nier_client {

}

namespace nier_server {
    template<uint32_t idT>
    struct EntityPacket : public PacketT<idT> {
        uint32_t guid;
    };

    struct EntitySpawn : public EntityPacket<ID_SPAWN_ENTITY> {
        char name[0x20];
        uint32_t model;
        uint32_t model2;
        EntitySpawnParams::PositionalData matrix;
    };

    struct EntityData : public EntityPacket<ID_ENTITY_DATA> {
        float facing;
        float facing2;
        uint32_t health;
        Vector3f position;
    };
}

from reframework.

Related Issues (20)

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.