Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stand-alone client #5

Merged
merged 19 commits into from
Nov 26, 2015
Merged

Stand-alone client #5

merged 19 commits into from
Nov 26, 2015

Conversation

AlexanderDzhoganov
Copy link
Contributor

I've managed to parse the game database thanks to this document by NimVek (Huge thanks for writing that!). The JSON blob is pretty large and contains a lot of info. Here is an example JSON dump.

Also I've started work on a standalone client (standalone.js) as the mobile app makes my device get quite hot after a while and running the app for hours on end is painful.

Depends on https://github.com/rgbkrk/pipboylib/pull/10
Depends on https://github.com/rgbkrk/pipboylib/pull/14

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 23, 2015

Oooh awesome! Yes, we definitely need a standalone client. The relay was put up as a way to start figuring the protocol out without having to mess with packet captures.

var pipboylib = require('pipboylib')
var relay = require('pipboylib/lib/relay')
var pipboylib = require('pipboylib');
var relay = require('pipboylib/lib/relay');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amusingly, a friend of mine lambasted me for going the no-semicolon route while another praised it.. I actually prefer them in, so I welcome this. There's even a linter for this style with a presidential seal of approval.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent so much time removing semicolons :P I use them at work, it will take some time :P
Before obama there was semistandard (part of the same group of projects as standard)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I come from a C++ background and semicolons are the way of my people, though I am prepared to accept defeat and write w/o the semicolons if that's the majority decision 😃

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bring on the semi-colons!

I'm a bigger fan of them existing since that's how people tend to learn JavaScript and folks don't need to understand automatic semicolon insertion. Sorry about starting us off on a polar topic. 😄

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, obama is all semistandard under the covers. I made it in frustration of dueling linter wars.

var dbTypes = {};

var dbEntryType = ['Bool', 'Int8', 'UInt8', 'Int32', 'UInt32', 'Float', 'String', 'List', 'Dictionary'];

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually have these setup in pipboylib as a parser thanks to @nelix. Can we bring more of this type of functionality there, supplementing where possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure how you'd prefer to split up the functionality between the two projects. Feel free to split this up and move it around however you deem necessary.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, always happy to git cherry pick.

Perhaps I should have outlined it in each. My intention was that bits that would be useful by any node application would go to pipboylib while pipboyrelay is one cli tool that uses them.

@AlexanderDzhoganov
Copy link
Contributor Author

I've started a repo for a browser-based client to the socket.io server - https://github.com/AlexanderDzhoganov/pipboyclient

Got real-time world map working - screenshot here

@AlexanderDzhoganov AlexanderDzhoganov changed the title Experimental code for parsing the game database Parsing the game database & stand-alone client Nov 23, 2015
@nelix
Copy link
Collaborator

nelix commented Nov 24, 2015

This is very cool, I am stuck at work so I can't play with it yet.
Can't wait.

@@ -0,0 +1,32 @@
require('buffertools').extend();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you seen https://github.com/rgbkrk/pipboylib/blob/master/lib/parser.js

You seem to have implemented way more protocol though!

The api I would eventually like to have would allow piping the relay into the parser into websocket/filters/whatever into serialiser into relay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try to merge my code with the pipboylib parser and make a PR to the other repo.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you like, I am happy to explore a few different directions.
We could try a few different angles on the parser and the cli.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mattbaker
Copy link

I've managed to parse the game database thanks to this document by NimVek (Huge thanks for writing that!). The JSON blob is pretty large and contains a lot of info. Here is an example JSON dump.

Hot damn. Well done.

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 24, 2015

Looking through both this PR and your really excellent client @AlexanderDzhoganov - it would make a lot of sense to make it be an Electron app. You wouldn't have to use socket.io (direct node-to-browser just fine in Electron) and user's won't be running servers on their machines, just a full native app they can download.

@AlexanderDzhoganov
Copy link
Contributor Author

I have done some clean-up and moved most of the code to a separate PR in pipboylib. I have removed all of my changes to cli.js for the time being.

io.listen(SOCKETIO_PORT);
console.log('Socket.io server listening on port ' + SOCKETIO_PORT);

pipDecode.on('db_update', function(data) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! This looks much easier to manage. Nice work! 👍

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 25, 2015

Wow I finally looked at that JSON dump. Definitely huge. 😄

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 25, 2015

Ok, yeah this is looking really nice. I went through and reimplemented this locally using pipdb and pipdecode and it made me realize where the relay fell short. If I connect, disconnect, connect, I end up putting the state of the last expectedSize out of whack, causing it all to crash.

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 25, 2015

Awesome. I think this is ready to at the very least be part of the current relay right now.

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 25, 2015

As in, I'm using this and it's pretty awesome.

screenshot 2015-11-24 21 30 01

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 25, 2015

screenshot 2015-11-24 21 51 43

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 25, 2015

Definitely wondering if we should be doing some post processing of the db to turn all the arrays of {value: 8000, text: "Caps Found", showIfZero: true} into "Caps Found": {value: 8000, showIfZero: true}. This would be under the assumption that there are no collisions on the keys there.

Tradeoffs are that we're currently mirroring the actual format vs. something friendly to reach into programmatically in JavaScript (assuming order may change).

@landongn
Copy link

@rgbkrk If you implement it as some kind of mapping, I could see that being nice. Flipside though, if this ends up being used by other services expecting parity with the wire protocol, it could cause some divergence. Maybe once there's specific needs?

@rgbkrk
Copy link
Owner

rgbkrk commented Nov 25, 2015

Yeah, that's definitely the tradeoff. You'd think that if folks expect true parity with the wire protocol that we would just saw the raw bytes at that point. Way more compressed, certainly.

@landongn
Copy link

Since the work for implementing eventEmitters is happening, that extra event would be a pretty easy way to grab it rather than the other events.

🚲

@NimVek
Copy link

NimVek commented Nov 25, 2015

If you change the order or style of the Tree, you should remember that updates always have an index in the db. So you must always trace back how you changed ist. Better is a type of overlay to the db.
Second thing is that under sortedIDS, stimpackObjectID and radawayObjectID are indexes to the db are stored as values.

@AlexanderDzhoganov AlexanderDzhoganov changed the title Parsing the game database & stand-alone client Stand-alone client Nov 25, 2015
@rgbkrk
Copy link
Owner

rgbkrk commented Nov 25, 2015

Now that rgbkrk/pipboylib#14 is merged, think this is ready?

AlexanderDzhoganov added a commit to RobCoIndustries/pipboy that referenced this pull request Nov 25, 2015
@rgbkrk rgbkrk mentioned this pull request Nov 25, 2015
@AlexanderDzhoganov
Copy link
Contributor Author

Yes, we should probably merge this now.

rgbkrk added a commit that referenced this pull request Nov 26, 2015
@rgbkrk rgbkrk merged commit 4978b67 into rgbkrk:master Nov 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants