Chrome Extension - Neptune's Pride Agent

I wrote an extension for myself that I thought others might find useful.

It adds a HUD with a battle calculator for fleet movement. That looks like this (the green text):

If a battle is happening at the destination it will give the battle summary but understanding how accurate that is requires a little more explanation

Aside from the HUD, it adds links to fleets in messages, the same as [[0]] would link player 0 or [[star name]] would link star names. Linkification seems to stop working if the message is really long but it works great for moderately sized messages.

It also adds three keyboard shortcuts, ‘*’, ‘^’, and ‘&’. These each put useful info into your clipboard so that you can mail it to another player. ‘*’ is a summary of star data. ‘^’ is a summary of fleet movements. ‘&’ is fleet movements plus battle calculations. The output looks approximately like this:

fleetmsg-0

In the sample shown above, the player’s name ‘Loroughe’ is clickable, as are his fleets and the star in question. You can see the fleet calculator takes into account ship growth at the star, and it also takes into account arrivals of prior fleets.

The battle calculator should be pretty accurate if the situation is one fleet arriving at the star per tick. If multiple fleets arrive at the same tick, that does not work totally accurately, but you still get a fairly good idea what’s going on if you look at the outcome of the last combat. I separately have a thread to work out how to properly calculate this case and might fix it up; as this situation occurs rarely for me I am not sure how motivated I am to add all the required complexity.

Feedback is welcome but no promises that I’ll actually do much more than this. It fills my needs and gets rid of a lot of tedious computation for me.

Osric

3 Likes

Love the battle calculator, not sure I’ll use the other features.

It seems to go a bit weird when you have 2 ships landing at the same time - this shows the first ship dying and then the 2nd (right) surviving with 152, rather than splitting the losses between them:

image

Thanks for trying it! That’s what I was trying to say about landings in the same tick - they are done sequentially which is wrong. To do it right, I have to group the attackers into a team, run the combat, and then repeat until only allies are left. This is quite a bit more difficult than what’s in there now which just does a series of 1-1 battles. Also, all the attackers get the WS of the best ally; but the 1-1 battles will use each attacker’s WS.

If there’s enough interest I can fix it. The thing that’s best about the battle calculator is it takes into account any defense arrivals you can see as well as prior battles at the star and star growth due to industry. So it really eliminates a lot of calculation for me in the majority case which is one carrier arriving at an enemy star.

The alliance email features are for me the second most useful thing. Being able to share the scan data (potentially after editing it to remove irrelevant bits or for more nefarious reasons) is very helpful; and being able to see the battle outcomes spelled out is nice to check their accuracy.

Osric

Got you, that makes sense. TBH it’s still very useful even with this issue, and you can just correct for it mentally while looking at the thing so it’s not the end of the world.

For scan data… common practice is to take a screenshot and host it on an image website, which is generally easier to make sense of - although doesn’t calculate the industry gains.

I guess another thing that would be nice is if it gave you the HUD when you clicked on the waypoint for the first time (i.e. should i attack? Computer says no…)

I guess another thing that would be nice is if it gave you the HUD when you clicked on the waypoint for the first time (i.e. should i attack? Computer says no…)

Actually this should work, as long as it’s the carrier’s first waypoint. Maybe when editing waypoints I should do the HUD also for the last waypoint in the journey. I avoided doing this initially because in order to do it correctly all the intervening stops have to be calculated (i.e. when I go through [[Achird]], do I pick up or drop off ships? How many are there at that moment?). In fact this is also a flaw in the current battle calculator, that if you have a friendly ship flying through a planet that’s under attack and scooping up all the ships, the battle calculator will not notice that, and tell you that you’re safe from attack. In fact, if you do scoop up those ships, you’ll lose.

Getting it perfect amounts to programming the entire game on the client side … I could get sucked in, but it seems better to play the game :smiley:

Osric

It does work when setting first waypoint you’re right - not sure how i missed that. I think i was looking for it at the waypoint rather than the carrier.

I had a problem today where I was vacating a planet but the reports weren’t taking that into account, so in v0.6 I added code to deduct ships departing this tick from a planet’s garrison. Now, if you have departures happening, the battle calculator will take that into account, as long as they are on the first leg of the journey (that is, it still doesn’t look through all future orders; only at the next order for each fleet).

Osric

image

Now the real test begins…

Out of curiousity (and because it effects what happens next) what do you do with the fraction of ships produced?

The fractional ships are left in the star’s state and contribute to future growth.

The order of operations in the game proper is:

  1. Your 167 arrive, and battle happens.
  2. Ownership is assigned
  3. Industry produces

So if you lose the battle, the fractional ships that remain should be credited to this tick’s production. If you use the & report, you can see what the fraction is for this fight – find where it lists your fleet arriving and the combat, and you can see the growth projected there.

Osric

To use the ‘&’ report, hit & when you’re not in mail. Then go to mail and compose and send a message with no recipients; paste. Send the message. Then you have a message from. yourself to nobody in your inbox with the report in it.

Osric

I know how they work in game, i jsut wasn’t sure if this accounted for the fractions - but yeah it seems you do

Fair enough; to be clear the calculator can’t be perfect because the fractional ships aren’t sent to the game client, so the fraction that pre-exists is missed. This can make the calculator off by one and there is no way to fix that except by knowing the entire game history which it doesn’t (it needs to know in what tick the opponent built from 3 to 5 for example).

Osric

Gotcha. So in essence: it rounds down the fraction that exists on the turn that the fight is landing, so the off-by-one error will always be in the same direction

No that’s not quite what I meant. The game state goes from the server to your client each time you load the page or each time you click the status countdown between the hamburger menu and the inbox button in the UI. The server sends you the state of each star but the ship count is truncated, even though the server knows the remaining fraction from last tick’s production. The battle calculator uses that truncated value plus the ship growth per tick times the number of ticks to just before the fleet lands to calculate how many ships are at the star.

Battle ensues, but I do not truncate the number, even though for 100% accurate battle I need to. So in this case, it is important to look at the & report to figure out what will actually happen, as you’re hitting the edge case where I might be allowing the defender to hit you an extra time with fractional ships. The server will not do that (edit: unless of course the fraction the server knows about plus the fractional growth add up to more than 1; it is unknowable whether those fractional ships should count or not, so I count them).

Osric

So essentially, it will essentially be assuming the defender has 1 more ship than they really do (assuming there is a fraction)?
(PS in this case i bought another industry to make sure it didn’t matter :wink: )

Yes, that’s right. If you’re on the defending side, an extra industry is a good idea, though a costly one, because you can’t know if you needed it or not until after the battle.

Osric

I added a scanning HUD to v0.7. When you select another player’s star, it will show you fleets that are going to enter that star’s scanning range. The scanning HUD is green if the player currently cannot see your carrier, and grey of they already can see your carrier. A green indicator does not mean you’ve selected the first star to see you, though.

Osric

Thanks, I’m using it.

I completely revamped the combat calculations to handle simultaneous arrivals of multiple competing fleets properly. The code provided assumes no alliances as I personally don’t play games with formal alliances, so simulated combat will continue until only one player is left standing.

The only edge case that I am aware of that this doesn’t handle is simultaneous arrival of multiple players at an unoccupied star. This case is supposed to grant the star to the player who owns the fleet that traveled the least distance in the last tick to reach the destination, and the code doesn’t do this calculation but assigns the star more or less arbitrarily.

Osric