uojs2 icon indicating copy to clipboard operation
uojs2 copied to clipboard

We need to get a package with information about the tile.

Open lamo2k123 opened this issue 8 years ago • 55 comments

lamo2k123 avatar Dec 16 '16 21:12 lamo2k123

I'm working on this now. :)

Right now, I have a script that integrates with servuo and it returns map data, tiledata, and art.

kevinhikaruevans avatar Dec 16 '16 22:12 kevinhikaruevans

@lamo2k123 do you think it is better to get JSON map data & tile data with REST API or through websockets?

Example:

  • If you need to get tile IDs at (x, y), you call up GET /map?x=123&y=123. Response is JSON. Good because async, but bad because of new connection needed.

  • With the websocket, you send {"type": "map", "data": {"x": 123, "y": 123}} to websocket. Websocket responds with JSON string. Good because single persistent connection.

kevinhikaruevans avatar Dec 17 '16 19:12 kevinhikaruevans

Websocket

lamo2k123 avatar Dec 17 '16 20:12 lamo2k123

tile texture gives the server? or server gives texture id?

lamo2k123 avatar Dec 17 '16 20:12 lamo2k123

Both.

  • GET /land?id=168: PNG of land
  • GET /static?id=1: PNG of static
  • GET /map... or websocket: JSON of map data, looks like this:

Example map request at (1, 1):

[{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5},{"ID":168,"Z":-5}]

Right now, returns the 8x8 block (http://wpdev.sourceforge.net/docs/formats/csharp/maps.html)

Need to clean up response, so it is easier to use and read

kevinhikaruevans avatar Dec 17 '16 20:12 kevinhikaruevans

png gives the game server?

lamo2k123 avatar Dec 17 '16 20:12 lamo2k123

Yes... The game server runs the image and data server.

The image/data server runs through ServUO. It can run independently too though.

kevinhikaruevans avatar Dec 19 '16 21:12 kevinhikaruevans

I thought that all the static is stored in the client.

lamo2k123 avatar Dec 19 '16 21:12 lamo2k123

It is, but it would make more sense to have a server that can serve images for the game client.

Trying to move the images to the client would add too much complexity and wouldn't be as efficient.

kevinhikaruevans avatar Dec 19 '16 21:12 kevinhikaruevans

Hmmm....

lamo2k123 avatar Dec 19 '16 22:12 lamo2k123

Static content is over 1GB, so the client would need to download it every load.

The server can send images as needed... so many smaller requests vs one big request...

kevinhikaruevans avatar Dec 19 '16 22:12 kevinhikaruevans

how much more work on this task?

lamo2k123 avatar Dec 20 '16 06:12 lamo2k123

I'll try getting something up tonight after work :)

kevinhikaruevans avatar Dec 20 '16 17:12 kevinhikaruevans

Here's an example of the map data:

http://107.161.24.129:2590/map?y=500&x=500

I can't get images working. It looks like Mono/libgdiplus doesn't support ARGB1555, which is needed for Ultima.dll to get images. 😞

Right now, everything is written in C#. In the future, I want to use nodejs OR nodejs+node-gyp+libpng or something.

kevinhikaruevans avatar Dec 20 '16 18:12 kevinhikaruevans

😞

lamo2k123 avatar Dec 20 '16 20:12 lamo2k123

I'm updating Ultima.dll to use ARGB8888 instead of ARGB1555 later tonight, so we should be able to get images working.

~~I also need to update it so it returns a 32x32 square instead of a 44x44 rectangle... That way we use a texture in THREE and just map the image directly without the need for rotations.~~ - this probably can't be done...

kevinhikaruevans avatar Dec 21 '16 22:12 kevinhikaruevans

Loads with ARGB8888 👍

http://107.161.24.129:2590/land?id=4 http://107.161.24.129:2590/land?id=168

kevinhikaruevans avatar Dec 22 '16 16:12 kevinhikaruevans

@lamo2k123 - should I wait for you to finish the refactoring before starting implementing the graphics?

kevinhikaruevans avatar Dec 23 '16 02:12 kevinhikaruevans

Mmm... Use branch 'refactoring'.

lamo2k123 avatar Dec 23 '16 06:12 lamo2k123

Hmm.. Origin client size textures 64x64 and 128x128. And rotate 0

lamo2k123 avatar Dec 23 '16 17:12 lamo2k123

In 'refactoring', I npm installed history, hook-redux, and react-router-async.

Any other packages needed?

In console:

[HMR] Waiting for update signal from WDS... index.js:111 Object {length: 2, action: "POP", location: Object} core.js:97 action @ 20:12:34.197 @@router/START_TRANSITION (in 0.20 ms) index.js:291 Uncaught (in promise) TypeError: route.action is not a function at Router. (index.js:291) at step (index.js:40) at Object.next (index.js:21) at fulfilled (index.js:12) (anonymous) @ index.js:291 step @ index.js:40 (anonymous) @ index.js:21 fulfilled @ index.js:12 client?8505:38 [WDS] Hot Module Replacement enabled. client?8505:38 [WDS] Warnings while compiling.

kevinhikaruevans avatar Dec 25 '16 04:12 kevinhikaruevans

I'll commit today with corrections

lamo2k123 avatar Dec 25 '16 09:12 lamo2k123

Sweet, thank you. :)

kevinhikaruevans avatar Dec 25 '16 20:12 kevinhikaruevans

Have you used https://www.npmjs.com/package/request before?

I need to grab JSON and wondering if this is good to install or not. Could also just use XMLHttpRequest too.

kevinhikaruevans avatar Dec 26 '16 00:12 kevinhikaruevans

Use the 'window.fetch'

lamo2k123 avatar Dec 26 '16 07:12 lamo2k123

which package contains data on the location of the character on the map?

lamo2k123 avatar Dec 28 '16 16:12 lamo2k123

I think it is either packet 0x1B or packet 0x20:

https://github.com/kevinhikaruevans/uojs2/blob/master/src/client/state/player/actions.js#L34

https://github.com/kevinhikaruevans/uojs2/blob/master/src/client/state/player/actions.js#L54

kevinhikaruevans avatar Dec 28 '16 17:12 kevinhikaruevans

http://107.161.24.129:2590/map?y=3503&x=2574 here are the coordinates I got

lamo2k123 avatar Dec 28 '16 17:12 lamo2k123

there mapId need?

lamo2k123 avatar Dec 28 '16 17:12 lamo2k123

it's using blocks, so you'll need to do 3503/8 = 437, 2574/8 = 321, so you'll get:

http://107.161.24.129:2590/map?y=437&x=321

There is a map ID but I need to implement it still. Right now, it's using Felucca.

kevinhikaruevans avatar Dec 28 '16 17:12 kevinhikaruevans