Welcome to the Browser-Base Game Zone forums!
Game mechanics tend to have random elements specifically so that you won't know the result of an action in advance...
function hit(attacker, defender, random) { ...}
"I have a solution, now I need a problem"
Try balancing items, monsters and attributes. You want to let player progress 1 level each day. Generate several sets of monsters/items/exp formulas and run bots that will slay enemies and buy equipment. Select the set that was nearest your desired progress pacing (be aware of overbalancing, if you make a perfect balance the game will be boring since player won't be able to discover the "best method" if all methods became equal).Of course this is purely theoretical, autotesting via real players who play your game is far superior, simplier and cheaper
I don't know much about automated tests and such but using it for game mechanics sounds like trying to automate the stock market. It doesn't have the human feel, the fun factor or the designer's insight.
Quote from: dsheroh on July 15, 2010, 07:44:56 AMGame mechanics tend to have random elements specifically so that you won't know the result of an action in advance...The first though that enters my head is to have function somewhere that generates your random numbers, this way using reflection you can just replace the random number generator with a "return 15;" job, or alternatively always pass in your random number, so your functions look like...Code: [Select]function hit(attacker, defender, random) { ...}Though this falls down when you need lots of random values, so I think using reflection to replace the random generation function is best.
The automated/unit tests I'm talking about are to ensure that the code works, that it works correctly, and that any changes I've made have not introduced any bugs.
QuoteThe automated/unit tests I'm talking about are to ensure that the code works, that it works correctly, and that any changes I've made have not introduced any bugs.It is almost useless for BBGs.
Unfortunately, automated tests tend to rely on knowing the expected results when the test is written. While this is fine for business applications and infrastructure code, where there is One Right Answer that should always be produced, it doesn't work so well for game mechanics.
Does anyone know of a good solution for this which will allow for automated testing of game mechanics which produces results more meaningful than "well, it didn't crash..."?
Quote from: Chris on July 15, 2010, 12:11:59 PMQuoteThe automated/unit tests I'm talking about are to ensure that the code works, that it works correctly, and that any changes I've made have not introduced any bugs.It is almost useless for BBGs.I think you might have missed the point of automated testing - it's not so that you can make sure that your game is perfectly balanced and the layout works, it's so that you can avoid the 'emergency situations' you described.Tests aren't there to make you do more work or spend more time - they're there to remove the fear from deployments.
Quote from: dsheroh on July 15, 2010, 07:44:56 AMUnfortunately, automated tests tend to rely on knowing the expected results when the test is written. While this is fine for business applications and infrastructure code, where there is One Right Answer that should always be produced, it doesn't work so well for game mechanics.You may not know the One Right Answer for game mechanics, but you can often (always?) define the bounds within which the answer should fall. Rather than test for "exactly right", test for "not wrong". Unit testing at the module/class/method levels is still perfectly relevant to games.
For overall game mechanics testing, I find it interesting to try to write a bot or AI to play a game. Granted, you can never create an AI to rival the unpredictability of human testers, but even a crude AI can be useful for finding edge case bugs (stuff overflowing or loopholes in game play) as well as verifying the overall game balances remain in the right ballpark.1. Change some code.2. Run unit tests looking at limits and bounds.3. Set a couple AIs to play many times overnight, logging activity.4. If #2 passed, and #3 stats didn't go crazy, release to a test server and some humans.
Tests aren't there to make you do more work or spend more time - they're there to remove the fear from deployments.
Nothing is going to remove the fear from deployments for BBG owners
Automated unit tests are great because once you code the test, it's there forever.