Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

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

Open
lamo2k123 opened this issue Dec 16, 2016 · 55 comments
Open

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

lamo2k123 opened this issue Dec 16, 2016 · 55 comments
Assignees

Comments

@lamo2k123
Copy link
Collaborator

No description provided.

@kevinhikaruevans
Copy link
Owner

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
Copy link
Owner

kevinhikaruevans commented Dec 17, 2016

@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.

@lamo2k123
Copy link
Collaborator Author

Websocket

@lamo2k123
Copy link
Collaborator Author

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

@kevinhikaruevans
Copy link
Owner

kevinhikaruevans commented Dec 17, 2016

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

@lamo2k123
Copy link
Collaborator Author

png gives the game server?

@kevinhikaruevans
Copy link
Owner

kevinhikaruevans commented Dec 19, 2016

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

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

@lamo2k123
Copy link
Collaborator Author

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

@kevinhikaruevans
Copy link
Owner

kevinhikaruevans commented Dec 19, 2016

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.

@lamo2k123
Copy link
Collaborator Author

Hmmm....

@kevinhikaruevans
Copy link
Owner

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...

@lamo2k123
Copy link
Collaborator Author

how much more work on this task?

@kevinhikaruevans
Copy link
Owner

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

@kevinhikaruevans
Copy link
Owner

kevinhikaruevans commented Dec 20, 2016

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.

@lamo2k123
Copy link
Collaborator Author

😞

@kevinhikaruevans
Copy link
Owner

kevinhikaruevans commented Dec 21, 2016

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
Copy link
Owner

@kevinhikaruevans
Copy link
Owner

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

@lamo2k123
Copy link
Collaborator Author

Mmm... Use branch 'refactoring'.

@lamo2k123
Copy link
Collaborator Author

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

@kevinhikaruevans
Copy link
Owner

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.

@lamo2k123
Copy link
Collaborator Author

I'll commit today with corrections

@kevinhikaruevans
Copy link
Owner

Sweet, thank you. :)

@kevinhikaruevans
Copy link
Owner

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.

@lamo2k123
Copy link
Collaborator Author

Use the 'window.fetch'

@lamo2k123
Copy link
Collaborator Author

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

@lamo2k123
Copy link
Collaborator Author

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

@lamo2k123
Copy link
Collaborator Author

there mapId need?

@kevinhikaruevans
Copy link
Owner

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
Copy link
Owner

We'll probably need to create a system to detect as the player moves, preload each map block when they move near it.

@lamo2k123
Copy link
Collaborator Author

screen
playerg_12-29_00 06
8x8 block small :(((

@kevinhikaruevans
Copy link
Owner

Yeah, block is too small, so we'll have to load multiple blocks at once.

I'm trying to import THREE: refactoring...refactoring-map-additions

but import * as THREE from 'three' doesn't seem to work. Any ideas? 😕

@boberski666
Copy link

Do you commit the res server for me to hook up on my vps? :)

@kevinhikaruevans
Copy link
Owner

kevinhikaruevans commented Dec 29, 2016

In ServUO's Scripts directory:

UOJSServer.zip

Then in Data/Assemblies.cfg, I'm including these:

Newtonsoft.Json.dll
websocket-sharp.dll

(you'll need to download the binary dlls)

You might be able to run it as a standalone application (it has a Main function) but you'll need to compile it.

It's just easier to use http://107.161.24.129:2590/ for now, or at least until I can get it as a standalone application in javascript...

@lamo2k123
Copy link
Collaborator Author

And where you can view the source code for parsing files map.mul

@kevinhikaruevans
Copy link
Owner

kevinhikaruevans commented Dec 29, 2016 via email

@lamo2k123
Copy link
Collaborator Author

can nodejs to try to parse map file and make the api?

@kevinhikaruevans
Copy link
Owner

Yeah, but it'll take a long time to do.

@lamo2k123
Copy link
Collaborator Author

I would like to just getting the tiles to rewrite.

@kevinhikaruevans
Copy link
Owner

It's just a matter of porting over Ultima.dll to nodejs. Should I work on doing that?

https://github.com/ServUO/ServUO/tree/master/Ultima

@lamo2k123
Copy link
Collaborator Author

I want more convenient and flexible API to obtain data on the surrounding tiles. But we need to understand how to read the map file map (x) .uop

@kevinhikaruevans
Copy link
Owner

It's being done here: https://github.com/ServUO/ServUO/blob/master/Ultima/TileMatrix.cs#L414

Should I create repo for nodejs port package?

@lamo2k123
Copy link
Collaborator Author

created. I think it will take much time.

@kevinhikaruevans
Copy link
Owner

Do you have a link for it?

@lamo2k123
Copy link
Collaborator Author

I did not create. you create the repository.?

@kevinhikaruevans
Copy link
Owner

@lamo2k123
Copy link
Collaborator Author

nice 👍

@kevinhikaruevans
Copy link
Owner

Should it use uodatareader in server/index.js and send map responses through the websocket? Then we can send map JSON data and stuff through it.

@lamo2k123
Copy link
Collaborator Author

of course yes

@kevinhikaruevans
Copy link
Owner

What about things like the images? Do we need to setup a separate webserver (like Express) to host this?

@lamo2k123
Copy link
Collaborator Author

hmm.. I do not know yet. I would like to work in the production is not static nodejs distributed. I have not had time to look 'uodatareader' :) and I can not yet imagine the interaction of components.

@lamo2k123
Copy link
Collaborator Author

how do you plan to implement threejs Z Index tiles?

@kevinhikaruevans
Copy link
Owner

I'm just setting the z in the position on the tile. We get the map data [{id: 123, z: 10}, ...], then use that z in the coordinate (tileposition = new THREE.Vector3(someX, someY, tile.z)).

It gets set here:

const z = tile.z;

I need to figure out the camera rotation for it to look better here:

this.cameraRotation = new THREE.Euler(0.05, 0, Math.PI / 4);

It's rotating the camera along the Z to 45-degrees, but then it's rotating it along the X axis to give the Z axis depth.

@kevinhikaruevans
Copy link
Owner

kevinhikaruevans commented Jan 25, 2017

Right now, it's looking like this for me:

image

I still need to change the X & Y rotation but still leave the Z rotated at 45 degrees.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants