• Advertisement
Sign in to follow this  
  • entries
    8
  • comments
    5
  • views
    5209

About this blog

The development process of the android game Power Pong

Entries in this blog

After many hours debugging I finally fixed it!

There are many reasons for a segmentation fault, but for mine I will try to list what I did to help those who face similar problems.

First of all I was building my game for an Android device. In order to debug, make sure you have debugging settings turned on on your phone (under developer settings).

Then, play your game until the crash happens. After, go to the sdk folder on your computer and find the program-tools folder. Open the command prompt (I was using Windows) CMD, and set the 'cd' current directory, to that folder.

Then type: adb logcat>myLogFile.txt

and then press enter. the text file can be named anything. Within the file is a huge chunk of data. To save scrolling, you can use ctrl F to search for Unity, which singles out all the Unity messages.

Eventually you will find a crash log with some small details (but not much).

If it is a segmentation fault, then the chances are your game isn't optimised enough for the device.

Have a look at the following:

Are you using foreach loops in start functions? If yes, take them out. Perhaps manually add the items in the inspector or use a for loop.

Are you duplicating anything? Such as having the same audio source over two scripts etc.

Are you using GetComponent a lot? If so, then cache them at the start instead. And use that reference instead of creating new GetComponents every time.

In coroutines, are you using Yield wait return new WaitForSeconds() ? If yes, then cache the WaitForSeconds up the top as well. Then in the coroutine you can write: Yield wait return _variableName;

If you have strings that stack together, consider using a Stringbuilder instead.


These are just some of the things that I did to keep the memory consumption down. Hopefully you all find this knowledge useful!

Optimisation. Due to the game being on a mobile device, it is even more important, and I recently got faced with a segmentation fault error. This usually happens when something is trying to access a piece of memory it isn't allowed to.

For my game, it's more down to the fact that I need to take better care of memory management. Unity takes care of a lot of it for you, but there are many things that we can consider in order to keep the game running smoothly and efficiently.

One main concern in my game is the amount of objects that I create during runtime. I must overhaul some code in order to reduce this. Hopefully after that it wont randomly crash!

Game is still on schedule, however!

The majority of the game is in place, it has taken around 3 months of development time to put it all together from scratch. There have been many bugs along the way, some that randomly appear when others get fixed, and others that persisted for weeks. It feels rewarding though now that it's nearly done. The important thing is to set small goals each day. A to-do list for the day. If things don't get finished, keep those on the list for the following day, but keep it visible.

Currently tweaking some values for the AI. It's quite difficult to get right but on the whole I'm happy with the results.

Expect the game to be released on Android by the end of the week!

So here is the breakdown of the skill list.

The skills are separated into three categories, offensive, defensive, and utility. All of which have 2 different ultimates to choose from:

All skills cost MP and have a cooldown. MP increases slowly over time and when you score against your opponent.

Offensive

- Fire: Sets the ball on fire to deal additional damage. Your bread and butter damage skill. Minimal MP cost and cooldown for a slight increase in damage. Also applies damage when it hits the opposing paddle.

- Firelake: Another damaging skill that places a lake of fire somewhere on the board. If the ball moves through it, it'll set alight.

- Ultimate 1: Firestorm: Creates columns of fire to guarantee damage for a set period.

- Ultimate 2: Fire Frenzy: Creates additional fireballs to deal damage. Opponent must deal with 3 balls on the field for a set period.

Defensive

- Wall: Creates a blockade on the board that takes 3 hits to destroy. Can disrupt the opponent's plays and lead to unpredictable gameplay.

- Heal: Heals yourself for a set amount but at a high cooldown. Can save you in a pinch, or be used to control the flow of the game.

- Ultimate 1: Ironheart: Renders your shields impervious to damage, thereby delaying your opponent's ultimate. You can still be damaged, however.

- Ultimate 2: Invincibility: Protects your HP from damage. Your shields can still be damaged though.

Utility

- Haste self: Speeds up your paddle to allow for quicker deflections

- Slow Opponent: Slows opponent down for a set period, allowing for easier scoring. Can be used to counter "Haste self"

- Ultimate 1: Freeze Opponent: Completely freeze opponent's movement. A well timed move can lead to a swift victory.

- Ultimate 2: Freeze Ball: Freezes ball on the player's paddle, allowing for the player to move and aim their next move.


The uploaded image shows "Firestorm" in action. Debugging the skills takes time, and I am currently making sure that there aren't any bugs!

Game Mechanics

The goal of the game is to deplete your opponent's life before they deplete yours. In order to deal damage you must score against your opponent.

Both players begin with 100 life. They also begin with 4 shields. These shields are vital for accessing your ultimate ability, if your opponent scores against you, you lose a shield. Lose all 4 and your opponent will unleash a special attack for 5 seconds. After which your shields will regenerate and the game continues.

Both players also have access to a set of skills that can also deal damage, disrupt the opponent, or defend the player. Due to the array of skills available, the player can customise their skillset to their playstyle, opting for a full on aggressive, or a more defensive, drawn-out play.

The main mode - Arcade Mode - will present a total of 9 stages for the opponent to complete. The computer will have a different set of skills in each stage, with its difficulty slowly ramping up.

In the next post I will detail the skills available to the player!

Welcome back!

In this entry I will be discussing the AI of Power Pong. A decision was made early on as to how the AI would work. Would it cheat? Would it be an instant professional? No to both. Instead, I opted to draft a more adaptable AI approach.

The AI has a few rules to consider when decision making

- Where is the ball heading?

- How much do I need to move?

- Do I need to use my skills?

- How good is my opponent?

With these rules in mind, the AI will begin (depending on the difficulty set), rather jittery, as it does not know how far to move in order to successfully deflect the ball. Furthermore it never cheats, it does not know ahead of time where the ball will land. It will only attempt to keep up with where the ball is going and make decisions based on that.

If the AI is losing too much, it will slowly start to adjust. It will start to alter its movements over time, becoming more and more accurate at deflecting the ball. The AI is not perfect, and there will always be a chance for it to miss, now matter how much it's mastered the game.

If its opponent is losing, however, there is a small adjustment that affects its learning rate, as to not exponentially increase the difficulty into the AI's favour.

Hopefully this new approach brings a more exciting gameplay experience, allowing for a more realistic AI to battle against.

The next post will discuss the mechanics of the game in more detail!

Welcome to my devblog!

Power Pong is a game being developed for Android mobile devices. The aim of the game is to reduce your opponent's HP to 0 using a set of skills at your disposal. Each player has access to two regular skills and one ultimate ability which can be used after you have destroyed your opponent's shields.

Shields recharge after a set period which will need to be destroyed again in order to activate your ultimate.

The game will feature

- an Arcade mode with a slowly increasing difficulty

- Classic mode for those who wish to play regular ping pong

- Enhanced mode which pits the player against the computer using the new gameplay system

- Wall mode for an endless rally

The game is being developed using the Unity Game Engine.

Stick around if you wish to see upcoming posts!

Sign in to follow this  
  • Advertisement