Thursday, December 10, 2015

ODTUG APEX Gaming Competition - How'd They Do It? (Part 4)

At Kscope 15 this year we launched the first ever ODTUG APEX game competition. The APEX community responded with 15 entries! Each and every one of them left me thinking "How'd they do that?" So, let's find out more about the games and those who wrote them.

Today we feature Maxime Tremblay.

First off, tell me a little about yourself.
My name is Maxime Tremblay and I'm from Quebec City, Canada and I'm Currently working at Momentum Technologies. You can email me at or reach me on Twitter @maximet57537559

How many years of APEX experience do you have?
I have been developing with Oracle Apex for 8 years.

What motivated you to participate in the APEX Gaming Competition?
As soon as I saw the announcement, I couldn't wait to start developing my game application. I really liked the idea of making a game using Apex.

What is the name of your game?

Briefly describe your game.
The game is a single and multiplayer battleship game.

The starting point of my game is a chatroom. In there you can chat with the other players, you can also show your profile (from the profile screen, you can change the theme and replay completed games), or start a game versus the AI or versus another online user.

The game itself is played on four grids, two for each player. Before the game begins, each player secretly arranges their ships either vertically or horizontally on their primary grid. After the ships have been positioned, the game proceeds in a series of rounds. In each round, each player take a turn to select a target square in the opponent's grid which is to be shot at.

The first player to hit every square of every ship is the winner.

How long did it take you to develop your games?
I did not track how long it took, I'd say approximately somewhere near 30 to 40 hours

What was the most challenging element of your game design and how did you overcome it?
The thing that probably gave me the most problems was everything related to the AI. I had to come up with a way for the AI to determine the best square to shoot at. The approach I decided to take was to give every cell a probability and then have the AI choose the highest probability.

So basically, what I did was to loop for every column, for every row, for every active ship, for both direction, if the ship can be place using these parameters, then I'm incrementing the probability of every square that the ship takes. After that I needed to increase the probabilities around the hit squares. If there's only one square that is hit on the ship, I needed to increase top, bottom, left and right adjacent squares. Otherwise only top and bottom or right and left according to what square were hit for that ship.

I also needed to increase the probability of adjacent squares only if there was a way for the ship to be placed so that the adjacent square would be occupied in any way by the ship.

I also had to debug it multiple times when I tested everything. I have to say it took a long time to do.

Other things also gave me a hard time :)
  • Placing ships using drag and drop
  • Everything related to the user presence (have only the online users show up in the chat's user list, and to notify the user if the opponent leaves while playing a game)
  • Multiple themes that the user can switch to (you can change it from the profile screen)
  • Having the game display well on tablets and mobiles
  • Sound effects (especially on iOS devices)

Alright, how can I play?
Simply go to Signup using a valid email address and you're good to go.

Anything else you'd like to add?
I would like to thank everyone involved in the contest. I really had fun developing my game and it was also a great learning experience. Feel free to contact me if you would like to have more information on anything about my game. Thanks again!

Thanks, Maxime. I loved Battleship growing up. In the coming days we'll share more insight into the other games that were part of the contest.

...our journey continues

No comments: