Neptune’s Pride Battle Calculator

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:

  1. Neptune’s Pride Battle Calculator v0.3
This entry was posted in JavaScript, web and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

12 Comments

  1. Karl
    Posted March 12, 2010 at 22:30 | Permalink

    Very handy application. I never quite got how to calculate these battles myself so I find this amazingly useful. Good work!

  2. Glenn
    Posted March 15, 2010 at 17:42 | Permalink

    Thanks….this has helped in developing my strategy and for that last minute…”oh wait do I have enough ships to do X?”

  3. admin
    Posted March 15, 2010 at 17:53 | Permalink

    Appreciate that!
    If you have any wishes for improvements, let me know

  4. Posted March 18, 2010 at 10:35 | Permalink

    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

  5. JosteinB
    Posted March 19, 2010 at 15:41 | Permalink

    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 :)

  6. Kalle
    Posted March 22, 2010 at 22:07 | Permalink

    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? :)

  7. admin
    Posted March 22, 2010 at 22:18 | Permalink

    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!

  8. Chris
    Posted March 23, 2010 at 16:15 | Permalink

    This calculator has been very helpfull & much appreciated. Thank you.

  9. Posted April 8, 2010 at 21:26 | Permalink

    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

  10. admin
    Posted April 8, 2010 at 21:40 | Permalink

    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

  11. Posted April 8, 2010 at 22:29 | Permalink

    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 :) .

  12. Nick
    Posted November 23, 2010 at 19:21 | Permalink

    A defense version complement to your attack code would be nice. It would calculate two items:
    1.) At what hypothetical level would I win as defender
    2.) What level of defenders give the best enemy loss/my loss ratio
    3.) What are the “tiers” in which I cause additional enemy losses

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>