jimjkelly / missile-defense

http://missile.exchange
1 stars 0 forks source link

Number of Warheads Does Nothing #10

Closed jimjkelly closed 7 years ago

wslafoy commented 7 years ago

I think we should go with the simple option for now: User provided Warhead Numbers. For this section, P(miss)==probability of one warhead missing and W= # of warheads P(miss)=1-TKP P(OffensiveSuccess)=1-(P(miss))^W

For a more complicated option, let me know if this is possible, and if so, we can explore if it is a better/worse option: Desmos can be embedded into pages: https://www.desmos.com/api/v0.7/docs/index.html Do you think it would be possible to embed the graphing portion and pull from the user's inputs? UI wise, the graph would be fairly small (thinking >1/10 of screenspace at any time).

jimjkelly commented 7 years ago

It looks like that could work. Alternatively we could graph the results using a library like Victory: http://formidable.com/open-source/victory/. That might give us a bit more flexibility on sizing and responsiveness.

Where/how would we display the result? Would it always be displayed or require some interaction from the user?

How would the variable number aspect be relayed when say doing the mouseover on layers thing we discussed? Perhaps a pop up with a graph there could work?

wslafoy commented 7 years ago

Victory looks good to me. I was thinking the graph could be loaded in the bottom right of the screen, keeping it in the data bar so it never messes with the map. A pop up graph sounds excellent as well! I like that idea. It prevents unnecessary data from being displayed at inopportune times

jimjkelly commented 7 years ago

Okay, so there's part of this issue up - the bit with the actual graph itself. Playing with this has sort of had me thinking a bit about the offensive layers. Having a graph like this gets a bit tricky because if we allow more than one offensive layer type then how do we order the graph... simply iterate over available warheads for each offensive layer type until we exhaust them? Should we allow the user to select the layer and then switch out the chart, and just make it per layer, independent? Pop up charts like I had mentioned?

jimjkelly commented 7 years ago

Oh, also, there's no label on the chart just yet because there's a bug with Victory regarding labels. If they aren't quick about getting a fix out I can do something else to work around it, but I figured I'd give them a bit of time to perhaps get a fix on it.

jimjkelly commented 7 years ago

Here's a link which I believe implements the numbers from your latest Desmos link, btw:

http://missile.exchange/?link=eyJtb2RlbEluZGV4IjoiMCIsInRhcmdldCI6eyJsYXRpdHVkZSI6MzcuNzU3NywibG9uZ2l0dWRlIjotMTIyLjQzNzYsImhhcmRuZXNzIjoxMDB9LCJsYXllcnMiOnsib2ZmZW5zaXZlIjpbeyJuYW1lIjoiTmV3IG9mZmVuc2l2ZSBsYXllciIsInR5cGUiOiJub3Rpb25hbCIsInNzcGsiOiIwLjk5IiwicmVsaWFiaWxpdHkiOiIwLjkifV0sImRlZmVuc2l2ZSI6W3sibmFtZSI6Ik5ldyBkZWZlbnNpdmUgbGF5ZXIiLCJzc3BrIjoiMC45IiwiaW50ZXJjZXB0b3JzIjoiMiIsInRyYWNraW5nIjoiMC45In1dfX0=

wslafoy commented 7 years ago

1) The link looks good, the graph implementation is awesome. 2) That is a really good point on the graphs. This is now where that single target point from before makes sense, but it detracts from other simulation elements... Let me know if this is doable: Have no graph appear initially, but have the graph generate based on a point where the User clicks?

So example, on this map: http://missile.exchange/?link=eyJtb2RlbEluZGV4IjoiMCIsInRhcmdldCI6eyJsYXRpdHVkZSI6MzcuNzczNDcwNTgwNDc3NDY1LCJsb25naXR1ZGUiOi0xMjIuMzU0NDY2MTg3OTk4MSwiaGFyZG5lc3MiOjEwMH0sImxheWVycyI6eyJvZmZlbnNpdmUiOlt7Im5hbWUiOiJOZXcgb2ZmZW5zaXZlIGxheWVyIiwidHlwZSI6Im5vdGlvbmFsIiwic3NwayI6IjAuOTEiLCJyZWxpYWJpbGl0eSI6IjAuOTkiLCJyYW5nZSI6IjAxMDAwMCJ9XSwiZGVmZW5zaXZlIjpbeyJuYW1lIjoiTmV3IGRlZmVuc2l2ZSBsYXllciIsInNzcGsiOiIwLjkiLCJpbnRlcmNlcHRvcnMiOiIyIiwidHJhY2tpbmciOiIwLjkiLCJyYW5nZSI6IjEwMDAwIn1dfX0= (pretend the circles are in other places. The seem to reset when the link is loaded)

If the user were to click inside a space that had no offensive range circle over it, the graph would pop up with every Y value being 1, as they are totally safe (no offensive system attacking).

If they clicked a place within the offensive circle that did not intersect with the defensive circle, they would get a 1- PW^(number of warheads) graph, as their survivaiblity P(0) would be just the compliment of the probability of the warheads hitting.

If they clicked a place within the intersection of the offensive and defensive circles, they would get the full P(0) equation.

Is that too off base? I figured that would basically have a systemic relationship with the pop-up probabilities, so hopefully it would be a similar solution?

jimjkelly commented 7 years ago

No, not off base at all - that's actually a great idea and it resolves a few issues I was having trouble reconciling, regarding the geographical component of all this. Awesome!

wslafoy commented 7 years ago

After this gets set up and bug tested and whatnot, I'm going to do a larger scale test with a few colleagues. Looking forward to it!

jimjkelly commented 7 years ago

Made some good progress with this today. It works, generally. Just need to do some clean up and testing, hopefully I can deploy it tomorrow.

jimjkelly commented 7 years ago

Just to update on this - there were some features needed for this in the latest version of the mapping library, and sadly that ended up breaking some other stuff. Trying to track down a fix. Just wanted to let you know the reason for the delay.

jimjkelly commented 7 years ago

Hey Scott, just wanted to drop by and say I've been a bit busy and each time I sit down to crank some stuff out I've not gotten past the bug mentioned above. I should have some more time in the next couple days, sorry for the delay.

wslafoy commented 7 years ago

No worries! Thanks for the heads up, good luck with bug quashing!

jimjkelly commented 7 years ago

Okay, got this going finally, and it's pushed up live. I need to fix the drag and drop stuff for the circles, it's clunky to say the least, working on that now. But you can see the behavior of how the probability chart acts when you click in different areas now. Let me know if this is different than you envisioned.

Basically I have no chart to start, and if someone clicks inside the overlapping circles it is P(0) as you said. If someone clicks in an offensive circle that has no defensive layer in the same spot, it's as you said, the probability of that offensive layer. If someone then clicks in an area that has no offensive circle but does have a defensive circle, it's just 1, an all blue chart. If someone clicks in an area with neither offensive or defensive capabilities, the chart goes away (as when the page loaded).

Let me know if there are any changes you want in that, it's easy to change these behaviors.

wslafoy commented 7 years ago

I'm not getting any chart changes on my end unfortunately. I only get the P(0) chart, regardless of where I click.

One option for dealing with the clunkiness of circles: while I don't know how to help them move more smoothly/occasionally get stuck on the mouse, it may be helpful to have a Lock option next to each Layer name which, upon click, makes that layer unmovable. Since the different charts will be shown upon a user mouse click of a region, this may prevent unintentional circle moving as well.

one additional small thing: Would it be possible to not generate a circle until a range has been added? I've found that the rangeless circle that is generated doesn't tend to play well with users, particularly when they move it at farther levels of zoom. Thank you! This is coming together very well, I'm really happy with it

jimjkelly commented 7 years ago

Blah. There were some linting failures. I added an issue to make sure I catch those before committing. Anyway, fixed, and verified it's deployed.

The lock idea might be good, because it definitely gets tricky when the circles are on top of each other. The big thing is just working out the kinks regarding the tracking, it's getting steadily worse as I add more stuff on. I have some code to that end, but still need to work out some kinks.

And yeah the circle now showing up until the range is added makes sense. I'll add an issue for that.

jimjkelly commented 7 years ago

Okay, the layer dragging issues should be fixed now.