karellodewijk / wottactics

Wot tactic planner for CW
MIT License
29 stars 34 forks source link

Just asking random stuff. Maybe not right place, but.. #6

Closed NikoGrano closed 7 years ago

NikoGrano commented 7 years ago

So, what are you doing right now? Focusing to stats or clanportal or just overall stability?

Btw, what what calculates WN8 values?

NikoGrano commented 7 years ago

Do you have any ideas, I'm geting 404 errors when I'm trying to access

http://127.0.0.1/stats/player/500633058?field=all

karellodewijk commented 7 years ago

Hi Niko

If I'm honest I'm not doing a lot on wottactic atm I recently started a new job.

The total stats are calculated client side:

https://github.com/karellodewijk/wottactics/blob/master/public/javascripts/ stats.js https://github.com/karellodewijk/wottactics/blob/master/public/javascripts/ clan_stats.js https://github.com/karellodewijk/wottactics/blob/master/public/javascripts/ calculate_stats.js

The history is just pulled from the app, for example

http://wottactic.com/stats/player/505943778 http://wottactic.com/stats/clan/500057508

Now what puts those stats in the db. Well that part is basically just a script I run locally that goes over all players, downloads their stats, and builds those summaries. If you want I can send it to you, but it's a bit of a mess and uses considerable bandwidth, with the sort 2 updates a week I'm doing atm about 1TB/month. The summaries I upload to the server are rather small though.

I have been pondering to create a similar tool sort of catered to the proffesional/eduction market. Something like https://sketchboard.io/, I think I can do better. My new job does include angular 2/node development, so I'm fairly familiar with that at this point and i think it would well. I might go for the three.js as the rendering engine, it would drop canvas2D fallback, but all modern browsers support webgl.

Well let me know if any of this interests you.

kind regards

Kalith

On Mon, Jun 5, 2017 at 6:20 PM, Niko notifications@github.com wrote:

So, what are you doing right now? Focusing to stats or clanportal or just overall stability?

Btw, what what calculates WN8 values?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/karellodewijk/wottactics/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3uDxaNr-CRyvbGG4Nck7X214sBFiTNks5sBCrQgaJpZM4NwQrW .

NikoGrano commented 7 years ago

It's good to be honest. I will do some stuff, maybe there, but you are master, so you will review before anything goes to master branch. =P

Thanks for information! Thanks, but I don't need (or want) that script yet. Will ask for it later if needed.

karellodewijk commented 7 years ago

Well, basically that info needs to be pulled from the db, which you don't have, I'll upload a dump and/or the scripts to populate it.

Also, feel free to point to http://wottactic.com/stats/player/500633058?field=all, it doesn't take a lot of extra bandwith probably, I don't mind. I think you would need to change stats.js/clan_stats.js to point to wottactic.com.

On Mon, Jun 5, 2017 at 7:05 PM, Niko notifications@github.com wrote:

Do you have any ideas, I'm geting 404 errors when I'm trying to access

http://127.0.0.1/stats/player/500633058?field=all

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/karellodewijk/wottactics/issues/6#issuecomment-306244971, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3uD6LjvQCkOAHd1CKoL7-lGTYAiSA0ks5sBDVsgaJpZM4NwQrW .

NikoGrano commented 7 years ago

Nah, it won't take much bandwidth if I'm just right now using wottactic in my closed development environment.

NikoGrano commented 7 years ago

I had Idea to create clan management panel, I was just wondering, if I could "copy" some stuff from here, like live map. Also I was wondering how to get stats from players....

I will be using PHP (Because it's my "Main" language) to create it.

karellodewijk commented 7 years ago

https://github.com/karellodewijk/wottactics/blob/master/license.txt

If you're interested in implementing a stat module take a look at this example: http://wottactic.com/wn8_standalone.html. It's a very short and concise piece of code that downloads the stats for a player from the wg server and calculates wn8 and wn9.

As for recent stats they really are just calculated from taking snapshots of player's stats and calculating the difference.

On Mon, Jun 5, 2017 at 7:31 PM, Niko notifications@github.com wrote:

I had Idea to create clan management panel, I was just wondering, if I could "copy" some stuff from here, like live map. Also I was wondering how to get stats from players....

I will be using PHP (Because it's my "Main" language) to create it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/karellodewijk/wottactics/issues/6#issuecomment-306251765, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3uD_j1R8Wq3bRfZBVPeGbiJwAybGgeks5sBDtfgaJpZM4NwQrW .

NikoGrano commented 7 years ago

Thanks for showing me the path!

NikoGrano commented 7 years ago

To be honest, I don't know anything, how you have done that map.

I have to integrate it to another php page, do you have any info to tell me before I will try do it on my own? So, is there just websocket server where map connects or...?

NikoGrano commented 7 years ago

And I just want to be direct also. I'm going to make this project anyways, but I just don't want repeat this all code, so I ask permission to use it.

I will make sure your name is visible on the project.

karellodewijk commented 7 years ago

You're free to use any code.

Yes, the map tool connects to the backend using socket.io, which uses websockets.

The relavant parts are:

The backend, (a node/express/socket.io server)

https://github.com/karellodewijk/wottactics/blob/master/app.js

It hots the webpages from templates, handles login, stores/retrieves tactics. And handles websocket connections to communicate. The backend is not so complicated really, it's a glorified echo server that takes messages from clients and broadcasts them to clients. For people familiar with node, it should look pretty standard.

The ui (mostly html with a little ejs, which is server side javascript between <%%>)

https://github.com/karellodewijk/wottactics/blob/master/views/planner2.ejs

And the most important and complex part, the frontend js:

https://github.com/karellodewijk/wottactics/blob/master/public/javascripts/planner.js

This is the part that communicated through websockets and updates the map. It uses pixi.js as a rendering library.

Planner.js is where the bulk of the application is and it's grown a bit out of proportion over time, and is poorly documented.

Anyway I'm sure what you're trying to so and which parts you want to use.

NikoGrano commented 7 years ago

So, think this like, I have random stuff on website (eg. Blank website) and I want put tactic map there.

That map have to be always same when it's opened, so map sessions need to be saved somewhere.

HTML is served via PHP (Using Twig template engine) and clientside javascript connects to to node only for live map functionality.

karellodewijk commented 7 years ago

It really depends on how much you want to customize the experience. The easiest way to roll something out would be:

You would be stuck with my ui though.

Now if you want to customize the ui, you'll have to take planner2.ejs, rip out/fix everything that's between <%%> and host it on your php backend (make sure you include planner.js and not combined.js, which is all libraries rolled into 1 and minified), try and get that working first.

Now if you're going to change the html you'll probably break some things along the way, then you'll need to dive into planner.js and see where that ui element is referenced and how you can fix it.

NikoGrano commented 7 years ago

Well, that's very helpful! I will give try to modify ejs and broke all and then rebuild it to twig format. If I can say so... =P If I have some problems, I will post them here.

Thank you for helping me!

NikoGrano commented 7 years ago

@karellodewijk Is your website under attack? It's slow as shit at this moment.

karellodewijk commented 7 years ago

There were indeed some issues. It was overusing the disk and amazon started throttling the vps for exceeding the io budget. I'm not sure why actually, as the site is pretty quiet atm with no CW going on in wot.

I've restarted mongodb and moved the redis server to the second vps to spread the load a little and it's recovering. I'll keep a closer eye on it though.