Does anyone try to Break their Game?

Started by
21 comments, last by This is no one 10 years, 3 months ago

I was wondering if there is anyone here that tries to break their game like me. What I mean is that I will deliberately press keys, or perform actions in-game that should freeze the game. I had a toggle feature in this one level and I kept toggling really fast to see if it would freeze.

The reason I do this is so that I can test whether or not the code is solid and the game runs fast. I think I have found out that booleans make things run faster. Toggling variables on and off to trigger functions seem to work faster than just changing functions (correct me if I am wrong.)

Anyone have any good tips on how to make an unbreakable game (programming-wise)?

They call me the Tutorial Doctor.

Advertisement

Before any game ships the publisher and console manufacturer will send it through a tough round (or even multiple rounds) of QA testing where they intentionally try to break your game. They'll do things like push buttons really fast, hold buttons forever, toggle things quickly, walk into every wall looking for collision bugs, pull the disc out a weird times, yank the network connection, put the console in a microwave, play the game underwater, etc, and make sure everything either works or fails in the correct way (for example by showing the right error popup when the disc has been removed).

I don't have any hard and fast rules for writing unbreakable code. Code is going to have bugs. That's a fact of life. Some people might suggest writing meticulous unit tests, though I've never found that to be particularly practical/helpful in games. The buggiest areas of games tend to be the areas that are the least friendly toward automated testing, unfortunately. I think what's worked best for me in the past is to make sure the game is tested thoroughly (by a human) throughout development, so you aren't overwhelmed when QA time comes. Keep a database of open bugs and prioritize them, making sure to keep the total number of bugs to an acceptable level.

If I test my game under extreme conditions 1,000 times and it fails once, it is broken.
If I test my game under extreme conditions 1,000 times and it never fails, it is broken, but I don’t know where. 1,000 more tests needed.

Anyone who is serious about game development tests not only as much as you, but more than you. Since last year’s end-year party I have been playing a game I won in a company lottery almost every day for the whole year since then.
It took about 8.52 months before I finally found a lock-up, after it handled thousands of similar cases just fine before that.
Approximately 4.17 months before I found a bug that was not serious and caused some laughter.


Yes, people are testing more than you.
Does that actually matter? To some degree but generally no. Bugs found due to investigation. Bugs still overlooked. It is a fact of life.
The only unbreakable code is code that is never run. If you are truly so paranoid, don’t write code.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Yes, of course.

Even though I write unit tests according to TDD (test driven development) most of the time and run regression tests when new features are introduced, there are lots of functionality (and non functional requirements) that are hard (or impossible) to test automatically. There are also cases where it is possible, but preferable to test by exploratory testing. Almost all "ility" requirements, such as usability, availability, operability, stability etc. are best tested using exploratory testing, and exploratory testing done right means trying to break your application any way you can think of (and not think of by performing random actions).

One lecture that I find very motivating and interesting on the the topic of exploratory testing, and "testing to break" is this one by James Bach:

It is not about testing games in specific, but rather about testing in general. He knows what he is talking about when it comes to testing and he is fun to listen to, even if he comes across as a bit odd at times.. xD

All the time. As a programmer, you are not only a designer, architect, detective but also a vandal. You want to break your games before other players do.

Breaking your game is actually a good idea because it not only makes you a better programmer but also better at logic.

From my experience, I remember when I was programming a character to move in 4 directions. Weirdness ensues when I pressed all four arrow keys.

Long story short, my movement code was button dependent when it should have been dependent on a character state and direction of the character.

A lot of the time, your initial code might work in terms of "English" but when you apply English directly to logic, that is where the bugs can actually happen quite often.

Bugs are all learning experience. Learn from them and embrace them all!

Usually a game can break because of faulty logic.

It is more important to question the coding style of your code and think about how it can affect your future code in the long term.

This was my old code for character idle animation:


if(direction.equalsIgnoreCase("right") && !rightPressed
&& !castingMagic && !attacking || 
(rightPressed && (upPressed || downPressed || leftPressed))
&& !castingMagic)
 
{
 
g.drawImage(idleRightAnim.getImage(0),(int)position.getX(),(int)position.getY(),null);
}

The old code was so bad. Eventually i had to scrapped it and re evaluate my logic. Here is the new code


else if(state == State.IDLE && direction == Direction.RIGHT)
{
soraIdleRightAnimation.draw(g2D);
}

My learning experience was if my code is hard to read there is probably a better approach that takes fewer lines. It is important not to over think it. My old code involves so much over thinking that it became a pile of mess.

This is actually a very common practice, especially in enterprise software. It's called Penetration Testing!

Cheers :)!

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !


put the console in a microwave, play the game underwater

oh dear...haha. That's a funny one.


, pull the disc out a weird times, yank the network connection, put the console in a microwave, play the game underwater,

Haha! Never thought about that type of testing. Hahaha.

I think I understand now why IOS is so stable, and why, when/if you get an error, it happens gracefully. It is good to not only predict the best conditions, but the worse conditions, and then program with that in mind.

They call me the Tutorial Doctor.


It is a fact of life.
The only unbreakable code is code that is never run. If you are truly so paranoid, don’t write code.

Hmm. good point. I really don't like bugs, and I thought I could make a program so solid it would never have an error. But when things are variable, then errors can occur, even if it is a limit.

Speaking of limits. I think that limits should be established beforehand. Whether the limit be an integer value or the area in which a 3d character can move. The reason limits make sense is because we are used to it. I mean, the surface area of the earth is a limited space. It is harder to move around in a space without limits, mainly because we are so limited.

I think the world is the perfect system though, because it was made with limits, though it has many variables. All the limits were taken into consideration beforehand. There are even laws that establish limits. This reminds me of another post I commented in about having a law system in games.

Hmm, something to consider.

They call me the Tutorial Doctor.


Long story short, my movement code was button dependent when it should have been dependent on a character state and direction of the character.

Right! I had the same issue! Someone suggested that I learn co-routines. The whole state-dependent idea is the best idea I have seen. Of course you use booleans to create states. I actually submitted an article a while ago about how to code in an english type grammar. It was rejected though because I only use my alias Tutorial Doctor and not my real name (the thrill of secrecy).

It also makes things run faster. I could type something like:


happy = false
sad = false
neutral = true

if happy then
...
end

if sad then
...
end


etc.

They call me the Tutorial Doctor.

This topic is closed to new replies.

Advertisement