WebHaven

Forum for alternative clients, mods & discussions on the same.

Re: WebHaven

Postby Razikus » Tue Nov 12, 2024 8:56 am

rfxDarth wrote:
Razikus wrote:Maybe!

Pong just started to walk!

Image


Nice! Looks just like what I had before moving over to 3D. Good lord, it's been 5 years and I haven't yet made the thing public...

Hit me up if you hit any barriers though, maybe I could be of help overcoming some things. Or let me know if you figure out the last byte in clicking gobs wdgmsgs... or if have any idea how to handle code in resource objects, as I still haven't.



This is cool!
So you have this client in 3d version?

So at the moment I'm exactly working at decoding meshes and clickable objects - like a door on a house
I successfully mimic right click - because I debugged it from original client

Currently I'm working on it - so decoding and understanding how these clickables works

When right clicking a door on a house it sent "16" as last argument, and from what I so far understood - this is related to meshID extracted from mesh layer
So (probably) client tries to find a mesh, around click that you do, get its id and set as last argument

My current approach will be to extract mesh ids from the underlying resources and save it
then if I spot something that I can't click - I will think about how to proceed further


Code: Select all
                switch (layerType) {
                    case "mesh":
                        currentMeshId = extractMeshId(layerMsg);
                        layerMsg.skip();
                        break;

    private static int extractMeshId(LimitMessage buf) {

        int fl = buf.uint8();
        int num = buf.uint16();
        int matid = buf.int16();
        if((fl & 2) != 0) {
            return buf.int16();
        } else {
            return -1;
        }

User avatar
Razikus
 
Posts: 27
Joined: Sun Apr 10, 2011 8:04 pm

Re: WebHaven

Postby merlin4 » Tue Nov 12, 2024 1:15 pm

Amazing stuff.
I'll probably contribute with some groovy scripts :)

Related to gates and meshes : can you interact with spits?
Also that doesn't seem to be a fork of Loftar's client, how will this project be kept alive?
merlin4
 
Posts: 30
Joined: Tue Sep 30, 2014 8:05 pm

Re: WebHaven

Postby Razikus » Tue Nov 12, 2024 3:10 pm

merlin4 wrote:Amazing stuff.
I'll probably contribute with some groovy scripts :)

Related to gates and meshes : can you interact with spits?
Also that doesn't seem to be a fork of Loftar's client, how will this project be kept alive?


So yesterday I did the right clicks on gob -> but realised that under the hood system is more complicated
So I unfortunately have to touch the Resources

I already have downloader and first extractor of meshes ID, NEG (still dont know what in reality it is)

Because Mesh ID is the thing gob click requires in order to click for example on doors

Im not sure yet how to get boundaries of mesh, but we will see


That's good point

Maybe in next release I will fork the client, and then remove all the stuff

In general it's compatible right now - I only removed stuff, not added
All the connection and underlying protocol is the same

My implementation is really an addition and I'm just using what is here
User avatar
Razikus
 
Posts: 27
Joined: Sun Apr 10, 2011 8:04 pm

Re: WebHaven

Postby merlin4 » Tue Nov 12, 2024 3:36 pm

Razikus wrote:My implementation is really an addition and I'm just using what is here


Yes and that's something I love about your botting platform.
You use original code, so this may live forever.
I've spent a lot of time coding bots around union and purus pasta, and they all end up dying.

Forking original client, making a "webhaven" branch where you replace all the original GUI with your web one could be a very reliable way to ensure the perenniality of your project.
And that's definitely something that wizards will enjoy.
merlin4
 
Posts: 30
Joined: Tue Sep 30, 2014 8:05 pm

Re: WebHaven

Postby rfxDarth » Tue Nov 12, 2024 10:00 pm

Razikus wrote:This is cool!
So you have this client in 3d version?


Yeah. Here's my attempt at rendering the entirety of W15 WB in my latest client (ignoring OD_REM and walking around the city)

https://i.imgur.com/fVqXItE.jpeg
https://i.imgur.com/SdmLGFx.jpeg

How it started
https://www.youtube.com/watch?v=oxYn4pvJJnY

And how terrible my fps got by the middle of it
https://www.youtube.com/watch?v=DE021UOGHcw

As you can see it's not very stable, only rendering at best maybe half the gobs correctly, but I haven't touched it since W12 I think, but now I'm back and you've probably heard player alerts blaring from me doing some shenanigans in between working on this client. Hopefully I'll polish it enough for at least a closed beta this world.

Razikus wrote:So at the moment I'm exactly working at decoding meshes and clickable objects - like a door on a house
I successfully mimic right click - because I debugged it from original client

Currently I'm working on it - so decoding and understanding how these clickables works

When right clicking a door on a house it sent "16" as last argument, and from what I so far understood - this is related to meshID extracted from mesh layer
So (probably) client tries to find a mesh, around click that you do, get its id and set as last argument

My current approach will be to extract mesh ids from the underlying resources and save it
then if I spot something that I can't click - I will think about how to proceed further


I rarely look at the code, instead employing a man-in-the middle server in front of vanilla client and parsing the network packets because for me it's easier than navigating the java code.

The actual code I'm using, mostly unchanged since the 2D client is literally

Code: Select all
    //TODO: remove
    clickGob(wdg_id, gob, mouseButton = 1, where = null) {
        if (!(gob.res && gob.res.name))
            return;
        console.warn(`Clicking ${gob.res.name}#${gob.id} with ${mouseButton}`);
        let coords = gob.c;
        let to = coords; // [(coords[0] / POSRES).toFixed(0), (coords[1] / POSRES).toFixed(0)];

        if (where === null) {
            where = to;
        } else {
            where = new Coord(where[0].toFixed(0), where[1].toFixed(0));
       }
        console.error(to, where);

        let list = [
            new Coord([0, 0]),
            where,
            mouseButton,
            0,
            0,
            gob.id,
            to,
            0,
            gob.res && gob.res.name.startsWith("gfx/terobjs/arch") ? 16 : -1,
        ];
        this.emit('clickgob', gob);
        this.wdgmsg(wdg_id,'click', ...list);
    }


:lol: :lol: :lol: You can probably guess why I'm too ashamed to do any public release yet.

I'll try that mesh approach, though, I see that there's this mesh

Code: Select all
{
    "type": "mesh",
    "data": {
      "id": 16,
      "fl": 11,
      "num": 640,
      "matid": 6,
      "rdat": {
        "vm": "3"
      },
      "ref": -1,
      "ind": [ ... ]
    }


in the parsed res code for timber house, but I'm not even sure where to store it, and for which object to send it or not, admittedly it shouldn't be sent for individual tree leaves or something...
User avatar
rfxDarth
 
Posts: 69
Joined: Tue Mar 09, 2010 4:13 pm

Re: WebHaven

Postby Razikus » Wed Nov 13, 2024 9:35 pm

rfxDarth wrote:
Razikus wrote:This is cool!
So you have this client in 3d version?


Yeah. Here's my attempt at rendering the entirety of W15 WB in my latest client (ignoring OD_REM and walking around the city)

https://i.imgur.com/fVqXItE.jpeg
https://i.imgur.com/SdmLGFx.jpeg

How it started
https://www.youtube.com/watch?v=oxYn4pvJJnY

And how terrible my fps got by the middle of it
https://www.youtube.com/watch?v=DE021UOGHcw

As you can see it's not very stable, only rendering at best maybe half the gobs correctly, but I haven't touched it since W12 I think, but now I'm back and you've probably heard player alerts blaring from me doing some shenanigans in between working on this client. Hopefully I'll polish it enough for at least a closed beta this world.

Razikus wrote:So at the moment I'm exactly working at decoding meshes and clickable objects - like a door on a house
I successfully mimic right click - because I debugged it from original client

Currently I'm working on it - so decoding and understanding how these clickables works

When right clicking a door on a house it sent "16" as last argument, and from what I so far understood - this is related to meshID extracted from mesh layer
So (probably) client tries to find a mesh, around click that you do, get its id and set as last argument

My current approach will be to extract mesh ids from the underlying resources and save it
then if I spot something that I can't click - I will think about how to proceed further


I rarely look at the code, instead employing a man-in-the middle server in front of vanilla client and parsing the network packets because for me it's easier than navigating the java code.

The actual code I'm using, mostly unchanged since the 2D client is literally

Code: Select all
    //TODO: remove
    clickGob(wdg_id, gob, mouseButton = 1, where = null) {
        if (!(gob.res && gob.res.name))
            return;
        console.warn(`Clicking ${gob.res.name}#${gob.id} with ${mouseButton}`);
        let coords = gob.c;
        let to = coords; // [(coords[0] / POSRES).toFixed(0), (coords[1] / POSRES).toFixed(0)];

        if (where === null) {
            where = to;
        } else {
            where = new Coord(where[0].toFixed(0), where[1].toFixed(0));
       }
        console.error(to, where);

        let list = [
            new Coord([0, 0]),
            where,
            mouseButton,
            0,
            0,
            gob.id,
            to,
            0,
            gob.res && gob.res.name.startsWith("gfx/terobjs/arch") ? 16 : -1,
        ];
        this.emit('clickgob', gob);
        this.wdgmsg(wdg_id,'click', ...list);
    }


:lol: :lol: :lol: You can probably guess why I'm too ashamed to do any public release yet.

I'll try that mesh approach, though, I see that there's this mesh

Code: Select all
{
    "type": "mesh",
    "data": {
      "id": 16,
      "fl": 11,
      "num": 640,
      "matid": 6,
      "rdat": {
        "vm": "3"
      },
      "ref": -1,
      "ind": [ ... ]
    }


in the parsed res code for timber house, but I'm not even sure where to store it, and for which object to send it or not, admittedly it shouldn't be sent for individual tree leaves or something...



It's very cool anyway. Great job! In general - it's not anyone full-time job so :D

I just finished forking and adjusting project to be compatible with original client
https://github.com/Razikus/WebHaven/tree/master

This repo is named as old one

So taking suggestion from @merlin4 I decided to not touch the code of haven, but just do a wrapper around underlying connection
This requires me to include some graphic libraries, but still everything works headless - its just needed for compilation time
And it's compatible with future changes

The only changed line so far is https://github.com/Razikus/WebHaven/blo ... t.java#L47
This cert I've extracted to not touch it, maybe I will make it again original at some point

Now the docker build is slower, but I can live with that
All the compilation is done with maven (except original ant download external libraries) which I'm also happy about
So new steps to compile are
Going back to coding main stuff


Btw this also gave me something - instead of loading resources myself I will reuse the loader from haven
User avatar
Razikus
 
Posts: 27
Joined: Sun Apr 10, 2011 8:04 pm

Re: WebHaven

Postby merlin4 » Thu Nov 14, 2024 1:03 am

Razikus wrote:So taking suggestion from @merlin4 I decided to not touch the code of haven, but just do a wrapper around underlying connection
This requires me to include some graphic libraries, but still everything works headless - its just needed for compilation time
And it's compatible with future changes


Dude you rock!
merlin4
 
Posts: 30
Joined: Tue Sep 30, 2014 8:05 pm

Re: WebHaven

Postby rfxDarth » Thu Nov 14, 2024 8:21 am

Razikus wrote:
I just finished forking and adjusting project to be compatible with original client
https://github.com/Razikus/WebHaven/tree/master

This repo is named as old one

So taking suggestion from @merlin4 I decided to not touch the code of haven, but just do a wrapper around underlying connection
This requires me to include some graphic libraries, but still everything works headless - its just needed for compilation time
And it's compatible with future changes


Holy bajeezus... that was possible all along? Without spending countless nights decoding haven protocol, and many more nights to come to port resource and widget code, but just wrapping around original client? Hats off, that's really clever, really looking forward to see what you'll be able do with it.

Razikus wrote:The only changed line so far is https://github.com/Razikus/WebHaven/blo ... t.java#L47
This cert I've extracted to not touch it, maybe I will make it again original at some point


If that's what I think it is, then it'd be a good idea bully loftar into pulling this upstream, those certs are a massive headache...
User avatar
rfxDarth
 
Posts: 69
Joined: Tue Mar 09, 2010 4:13 pm

Re: WebHaven

Postby Razikus » Thu Nov 14, 2024 5:12 pm

So the new update - finally I decoded all meshes and visioner bot is able to open and close the interiors
i also draw obstacles - surprisingly not all of the objects have obstacles :(
Like drying frame

Image

I will probably soon release the new version - also I successfully decoded the map so maybe soon I will be able to draw tiles under objects, we will see

But maybe first I will handle some more widgets - to be able to open inventory etc

I don't know yet, but its really fun
User avatar
Razikus
 
Posts: 27
Joined: Sun Apr 10, 2011 8:04 pm

Re: WebHaven

Postby pagsiu » Thu Nov 14, 2024 5:25 pm

Really cool project, keep up the great work. Visioner has that 90s roguelike aesthetics, which I adore.
In-game name: Balin. Hearthlands resident since World 2.
Skipping W16 :cry:
User avatar
pagsiu
 
Posts: 198
Joined: Fri Feb 25, 2011 3:14 am

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: Semrush [Bot], Yandex [Bot] and 106 guests