KBattleship: almost ready

This week I’ve been hacking quite a lot on KBattleship, adding almost all required features: a decent AI, network play and sounds. While Riccardo is working on KWelcomeScreen, a library class inspired by this blog post by Johann, I’m going to make some minor adjustments, add small missing features like scoring, and if everything goes well I guess we can move the application to kdereview within next week.
This is a screenshot showing a game between the old KBattleship and my rewrite:
KBS4 screenshot


13 Responses to “KBattleship: almost ready”

  1. Bernhard Says:

    first i have to say that you’ve done really great work what i can see from the screenshot… at the moment i don’t have the possibility to test it 😦 but i wonder if the shots are animated or if they’re only flat pictures like in the old kbattleship

  2. Morty Says:

    I’m glad to hear it will have a decent AI. That’s sadly a neglected part of most OSS games. Network play is well and good, but more often then not opponents are not avaliable when you want to indulge in some timewasting.

    Looking good, and except for the explosion, everything looks better than the old version. The new explosion really looks like orangish bubbles, I hope it gets replaced with something better before release.

  3. Tackat Says:

    I think in the graphics you should treat ships and shadows seperated. Depending on how you rotate the ship right now, the shadows fall into different directions. By keeping ships and shadows in seperate files you could apply the shadow always into the same direction.

  4. Johann Says:

    I’m fully agree with explosions and shadows. These should be fixed if find some time 😉

  5. Mauricio Says:

    Great work, Paolo. As for moving it to kdereview, I do not think it is strictly necessary, as kbattleship is already in kdegames, and you just branched for your convenience. It is not like the games that start in playground. You can even play against the old client, as your post describes, so imo you should just merge it back, and we can start playing it as well 🙂

  6. Lans Says:

    Noo! My long reply disappeared, because I accidentally pressed a link. 😦

    Good to hear that the explosions will be improved and I look forward to see KWelcomeScreen in action.

    I though of an improvement, that would quite drastically change the game’s look; I don’t think it will be implanted in the near future, or at all. But it doesn’t hurt to post it here, does it?

    Right now, the both sides are quite identical: one side where your ships are located and the other where you try to sink the enemy’s ships. It’s great that the water now looks different, but I would like to take it a step further.

    Imagine the right side to look like a “radar screen”, something like this:

    Other inspiration could be Defcon (I love the simple style of the game):

    Not only because it looks kool, I also think there are other pros:
    a. More obvious for new users where to click to sink the enemy’s ships.
    b. More logical. Why can I see the fishes, but not the ships? Have they developed a “cloak ability” (think Starcraft)?
    c. When you play against a friend over network, and it’s the opponents turn, you could show a text: “Please stand by” or something similar. This feels like a logical reason to wait – you’re preparing missiles – and could make it less confusing for new players (“Why can’t I shoot?”).
    d. And yes, if done properly, the kool factor is pretty high, don’t you think?

    Please note that I haven’t played KBattleShip so much, and never over the network.

    As I wrote, I don’t think this will be implanted soon, or at all, but I would be very happy to hear you thoughts – both from the devs and the users. Why not give suggestions, point out problems etc? Thanks for reading this.

  7. pcapriotti Says:

    I like the radar idea, and I think it’s very easy to implemente, once you have a good artwork. It seems it is just a matter of using the radar picture as a background instead of the water (plus some animations, maybe).

  8. Lans Says:

    Yeah, it’s the artist that has to do some extra work. Not only the background, I thought about changing the ships, explosions etc. too.

    Animations that aren’t disturbing would be great!

  9. triplej123 Says:

    dude u r wierd

  10. Aniah Says:

    Hi, I found a bug in KBattleship. I’m using 3.90.1.svn672301-49.1@i586 in openSUSE 10.3. If I choose to play human on the right and computer on the left, when I destroy the computer’s last ship, an information dialog pops up with “You lose.” Thanks and I apologize for not filing this in the appropriate spot, but I didn’t know where that was.

  11. pcapriotti Says:


    Thanks for the report. I am aware that in the current svn version there are a lot of glitches and bugs. Everything will be fixed before the KDE release.
    In particular, the message box appearing when the game is over will be replaced by a less annoying notification.

  12. EricM Says:

    Very good work Paolo! I enjoy playing the game every weekend.

    Please allow me to suggest some improvements.

    [1] Consider having a submarine (only one) hunting in the opponent’s zone.
    [1a] Consider passive “listening” devices and range.
    [1b] Consider revealing complete position of single enemy ship after detection.
    [1c] Consider some movement factors and relative capability of different types of ships.

    [2] Consider movement bearing and speed factor of entire fleet.
    [2b] Consider using a hex grid instead of square (allows for 6 choices for fleet bearing).
    [2c] Consider offering canned “evasion maneuvres”, limited in that they must eventually lead to a re-orientation of the entire fleet in ONLY one new direction; however, movement of individual ships during the evasion maneuvre may be quite different from one canned maneuvre to another; they cannot be initiated until first contact; they could be initiated in response to a naval bombardment pattern.
    [2d] Consider “sub-chasers” with depth charges; limited number of depth charges; limited rate of drop of charges; consider number of sub-chasers (4?); “sonar” direction of charges/movement; limited number of grid “square” movement enemy exposed (6-9) after which their “depth” makes them disappear from sonar scans.

    [3] Consider a “scrolling” sea grid, always centred on the fleet, regardless of bearing of fleet.
    [3b] Except during evasive manoeuvers, all ships should be oriented on same heading.

    [4] Consider a larger sea grid (50 hex “dia”)

    [5] Consider more ships in fleet (20-30)

    [6] Consider assigning more value to capital ships, namely, 1 flagship, 1 sister ship (becomes flag if flagship is sunk), declare winner of an engagement when 2 flagships are sunk
    [6a] Come up with a “logic” whereby survivors of battle return to “home port”.
    [6b] Determine number of engagements comprise a war.
    [6c] One fleet is used for each engagement.
    [6d] Each fleet is assigned from a total limited set of resources; ships used in one engagement are not available for other engagements.
    [6e] Firepower of each fleet (simultaneous shots per turn) depends on number of battleships in each fleet; other ships in fleet are support ships or picket ships that cannot “project” seapower (i.e. shoot the enemy with shells)
    [6f] Naval shell grid targets selected individually for a turn, but results (hits or misses) shown simultaneously after end of turn (i.e. allows for shells from two opposing ships to actually pass each other in the air and clobber the opponent after their own shots are on the way).
    [6g] FINAL engagement in war will involve total fleet with all “surviving fleet elements”; criterion for victory of war is sinking of 2 flagships and at least 3/4 of battleships (not support ships) and at least 40% of support ships during this final engagement.
    [6h] Firepower is limited (each battleship can shoot only 2 shells simultaneously (possibly 2 different targets) and total number of shells is limited to 40-60 per battleship. (N.B. Naval air power is NOT suggested at this time; the level of complexity would be too great. However, aspects of air power could emerge from the eventual behaviour associated with hunter subs.)

    [7] Ships that are sunk disappear from the sea map while other ships continue on (movement).

    [8] Consider limits of firepower according to proximity of fleet with enemy fleet, and the need to maintain proximity in order to bombard
    [8a] Assume each of the 10 “engagements” begins when the 2 opposing fleets have just come into range and that they are heading toward each other.

    The above suggestions will raise:

    a) degree of challenge in the game

    b) degree of variety in the game, by varying size of fleet (between a max and min number of ships) for each engagement, adding the elements of chance and judgement to BOTH play an equal importance

    c) realism by incorporating real behaviours and conditions (movement, subs, chasers, evasion, headings, identical ship headings).

    Lastly, about the GUI,
    [9] Have two modes for GUI:
    Mode 1 is pre-engagement setup, and
    Mode 2 is Engagement Command and Control.
    [9b] Mode 1 allows the selection of “assets” for assignment to the 9 engagement fleets.
    [9c] Mode 2 emphasized the “battlefield” map, showing where the 2 fleets are positionned on the map.
    [9d] Existing 2 fleet windows will be replaced with 3 hexagons:
    – large hex above for enemy fleet disposition (always centred on enemy fleet)
    – small hex lower left (half size) showing battlefield sea map
    – small hex lower right (half size showing disposition of fleet assets
    – upper left has 3-wide hex grid to summarize assets that survive the 9 separate engagements.
    – upper right has table of “kills” during each engagement, tracking flagships, battleships, subs, chasers, transports and support ships.

    [9e] Fleet starting edge is randomly assigned by game adding additional element of chance of near/distant enemy fleet.

    [9f] Defined maximum range of engagement, if surpassed, will end the engagement automatically.

    There you go. In case you are wondering, I am NOT smoking dope or ingesting any other hallucinogen 🙂 .

    Good luck! I am not a “low-level” coder, but I have done a lot of SW integration, testing and support. I wish I could help here, but I don’t know what I could do.


  13. isuru anuranga Says:

    I try to compile kbattleship source code from kdevelop and try to run game form source code. It giving a error saying qmake not found. And asking for kbattleship.pro file.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: