I got introduced to Neptune’s Pride a little while ago by a friend… It is a simple 4X game, with small games for 8 players in each in the free ones.
The game uses some simple math to calculate the outcome of battles, and since I am lazy I got tired of doing that math and started working on a battle calculator.
This is my first attempt on php, and it is a work in progress… so feedback is appreciated.
Try it out here: Neptune’s Pride Battle Calculator
UPDATE:
I have ditched php, and gone for javascript in v0.2 of the calculator… Now the workflow is more streamlined since you don’t have to go between different pages to get to results. Seems to be some css-problems though. And javascript issues with IE. Working on it.
…And apparently IE doesn’t care about height / min-height unless you add an !important to it.
the old version can still be found here
Related posts:
11 Comments
Very handy application. I never quite got how to calculate these battles myself so I find this amazingly useful. Good work!
Thanks….this has helped in developing my strategy and for that last minute…”oh wait do I have enough ships to do X?”
Appreciate that!
If you have any wishes for improvements, let me know
This is a very neat little site. I like the nice java that comes to the side of the input data, v.nice.
Have you thought about extending and making a more complicated calculator… almost like a simulator, you enter star resources, what your economy, industry and science is, then it tells you how much you can afford and which star to spend it at. Reading that back doesn’t make sense, but if you do understand me, do you think its possible?
I do it on scraps of paper which takes a long time to do right now. I’m speaking to another player in game who says he has got a table to do it!
Thanks again,
Rob
Thanks
The animated javascript thing is just a very very basic jQuery .show(“slow”); on the result div… It’s my first time with jQuery, so wanted to do something a little bit fun.
I’m not really sure what you mean… There is funtionality to find the cheapest stars to build stuff on within the game. Hmm.. do you mean for a single star, how many industry upgrades you could do on that one? That should be possible yes, just have to figure out what algorithm they use to convert from star resources to amount of $ per level. I’ll look into it
It seems your calculator is bugged, or I’m not getting the calculation.
For “how many ships to survive?”, if I put in 48 ships attacking with WS 6, and defender WS 5, it tells me I need 49 ships to survive. According to my very manual calculation of this based on the concept of “defender gets +1 and hits first, then attacker, then defender, then attacker, etc. until “the receiver of damage” goes <= 0. So if we look at losses "attacker defender" we get this:
0 0 <- attacker reaches defender, no losses at this point
6 0 <- defender gets initiative and hits attacker
6 6 <- attacker hits back
12 6 <- defender hits back
12 12 etc
18 12
18 18
24 18
24 24
30 24
30 30
36 30
36 36
42 36
42 42
48 42 <– attacker has 0 left, defender has lost 42 ships, thus 43 should cover "surviving"
Or am I missing something?
You are absolutely right, thanks!
It was a simple matter of a “<” instead of a “<=” in the border cases. Nice catch!
It is now fixed in both versions
Cheers!
This calculator has been very helpfull & much appreciated. Thank you.
I made a battle calculator in C#. This was the very first thing I have made in C#. I did use your while statement tho, after spending hours on trying to figure it out
.
http://pastebin.com/xrthmMZS
Nice! I’ve never coded in C#, have mainly kept to Java since that’s what we use at uni… But the two languages are very similar. Glad to hear what I’ve done can be helpful
The while-loop is really a very dirty hack.. The calculation can be done in constant time with some simple math in stead of the linear time the while-loop gives.. But I haven’t been bothered to implement it yet. Not that it would make any big difference in performance with the small numbers we usually use here
Thanks alot for the help tho
. The only thing I had to change was the boolean part at the start of the while loop. I was going to do it round by round but then that brings up the problem of if people have huge amounts of ships fighting each other. Im doing software development at college starting in September so I wanted a head start
.