When to start worrying about netcode? - c++

I'm currently working on a C++/SDL/OpenGL game. I've already made a few small games, but only local ones (no netcode). So I know how to make the engine, but I'm unsure about the netcode.
Can I firstly create the full engine for split-screen play and later on add the netcode or will this make everything complicated? Do I already have to take netcode into consideration while programming the basic game engine or is it also okay to just put it on top of the game after it runs fine on one machine?
It's a 2D shooter type game, if that matters. And no, I don't like to change my choice of programming language/window manager/api because I already implemented the bare bones of the game. I'm just curous how this issue is approached best.

In theory, all you need is a good enough design. Write enough abstract classes and BAM! you can pop out one user interface (i.e. local-only) for another one (networked). I wouldn't believe the theory, though.
It's possible to do what you want, but it involves taking into consideration all of the new issues you address when dealing with networked gameplay - syncing views for multiple users, what to do when one user drops their network link (how to detect when one user drops their network link, of course), network latency in receiving user input, handling lag on one side and not the other. Networked programming is completely different, and some of the aspects (largely ones dealing with synchronization) may impact your core engine itself. Even "just showing two views" gets a lot tougher, because you now have data on two completely different machines, and the data isn't necessarily the same.
My suggestion would be to do the opposite of what you're hoping for. Get the networking code working first with minimal graphics. In fact, console messages will be far more important than pretty graphics. You already have experience with making the graphics of other games - work the most questionable technology first. Get a good feel of all the things the networked code will ask of you, then focus on the graphics afterwards.

Normally for a network oriented game there are five concepts too keep in mind:
events
dispatcher
synchronization
rendering
simulation
Events. A game engine is a event software, that means over a state of each generic object in the game (can be a unit, GUI, etc), you do an action, that means, you call a function or do nothing.
Dispatcher take each event change and dispatch that change to another subsystem.
Synchronization means that over a change of event, all clients in network must be advised throw his dispatcher over that change, in this way all players can see the changes of other players, render and simulate same things at same time.
Rendering The render read parameters and relevant states for each object and draw in screen. For example, is you have a property for each unit named life_points, you can draw a normal unit if life_points>50 and a damage unit if life_point>0 and life_point<50 and a destroyed unit if life_point=0. Render dont make changes in objects, just draw what read from them.
Simulation read every object and perform some task taking on count states and properties, for example, if you have cero point of life, you mark the state of a unit as DEAD (for example) or change de GUI, or if a unit get close to another of a enemy team, you change the state from static to move moving close to that another unit. Plus this, here you make the physics of units, changing positions, rotations, etc etc... as you have all objects synchronized over network, everybody will be watching the same thing.
Best regards.

Add in netcode as soon as you can. If you don't do this you may have to overhaul a lot of the engine later in the dev cycle, so better to do it early.
It also depends on how complex the game is, but the same principles still stand. Best not to tack it on at the last second
Hope this helps!

Related

Can I make a multiplayer Phaser game using Lance?

How do I take an existing Phaser game and make it multiplayer?
Can I use the Lance library for this purpose? Both libraries control their own game objects so I don't know how to use the two frameworks together in the same game.
Disclaimer: I am one of the co-creators of Lance
Unfortunately, Phaser's 2.* architecture makes it hard to pair with Lance to make Realtime Javascript Multiplayer games.
The issue is that Phaser makes a lot of assumptions that don't hold for a multiplayer setting. For example, the rendering and game loop are tied together. The server, obviously doesn't need to render anything.
Phaser also assumes the existence of the DOM and the window object which also don't exist on the server. In addition, all of the data structures that hold the world game state objects, sprites, etc' are saved on an extended instances PIXI objects which don't make sense in a Server context. These limitations and tight-coupling aren't compatible with Lance's modular approach.
It is entirely possible to run Phaser on the server using libraries that emulate DOM and Canvas like JSDOM and Node Canvas however it does mean that there's a significant performance degradation by running PIXI on the server, and you also still have the problem of syncing PIXI data structures to contend with.
The good news is that Phaser 3.0 is an ongoing, complete rewrite of Phaser 2.0 in a much more modular approach will hopefully make it much easier to integrate with Lance. We have plans to make this integration easier ourselves in the near future.

Prevent dll from being modified

I'm coding a C++ WinAPI DLL for a game, it includes a small anti-cheat function, but it can be easily bypassed if someone decides to NOP (0x90) the whole anti-cheat (I'm not PRO in reverse engineering but I'm sure it's possible to do).
Is there anyway to prevent my DLL from being modified?
Even if you can stop people from modifying your DLL, there's nothing stopping someone from replacing your DLL with their own version that behaves just like yours in all aspects that your .exe can determine, but that does something different in some particular aspects - unless you keep an entire copy of the DLL in the .exe too.
It is better spending time and effort on making it hard to cheat than hard to change the .dll. Say for example that we have a Pac-Man game (because most people would be familiar with it), then we could send the number (and locations?) of all the "white pills" that Pac-Man ate on the path, and the time it took to get there. If the game then edits the .dll to give 10x the score for each white pill, or edits the game so that Pac-Man moves 10x faster, you can verify that it can't be right, because at each level you'd know how fast Pac-Man moved, and how many points per white pill Pac-Man should get. Number of times the player got killed and such could also be included in this information sent to the server.
A similar principle can be be applied to a "shoot-em-up" game, or a game that relies on buying and selling stuff, or whatever. If you have a detailed log of what the player did to get the score, you can validate that "this is possible" or "this is impossible to acheive, because you can't get that score from shooting down 10 space-ships in 1 second, as one space-ship takes 10 hits to shoot down, and it takes 1 second to fire each round".
I'd say you'll be better off moving any anti-cheat functionality to the server side, or if it's not a multiplayer game, then don't bother trying to stop cheats at all.
One thing you could do though is generate a hash of your DLL and check it in the application code against a known value or against a service or website. You could also use the hash value of the file for some other tasks as well essentially forcing the hacker to extensively modify the game code not just the anti-cheat function. That may deter people.
But the comments are right, with enough time and resources anything is hackable, you just need to make it not worth the time.

The Game vs The Game Engine? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I was wondering if somebody could tell me how the game and the game engine fit into game development. Specifically what I mean is, the game engine does not actually have a game. So where I'm unclear about is basically, do game developpers build an engine, then create a new class that inherits from engine which becomes the game?
Ex:
class ShooterGame : public Engine
{
};
So basically i'm unclear on where the game code fits into the engine.
The distinction between the game and the actual game engine is architectural. The game logic is specific for one game whereas the game engine is something that can be reused. Much like an operating system provides utilities for applications the game engine does the same for the game code.
Game engines will typically have different APIs for:
Loading multimedia data like audio, textures, 3d models
Providing a game loop and firing off various events caused by the users input
Networking
Graphics rendering and various techniques to make the game look nice using lighting, particle effects or bump mapping
Audio
Artificial Intelligence
An API to allow for defining game rules, game play, and game logic
Most game developers do not write their own game engine. It would be too much work. Instead they'll reuse a game engine their company has or license one. For first person shooters, id Software, and Unreal are two popular choices.
Once they have the engine they have to start writing code to make their game. This is done using the API provided by the game engine. For example Valve makes developers use C++. If you wanted a monster you would extend off of the Entity class and define how this monster behaves in that base class.
I would recommend reading through the documentation and tutorials provided by the various game engine providers. Keep in mind some games are classified as "mods" and some as "total conversions." Typically, a mod does not change the engine of the game and the total conversion may add or remove significant features to a game engine.
Here are a few sources I would recommend:
http://developer.valvesoftware.com/wiki/SDK_Docs
http://udk.com
id Software releases their game engines as GPL after a few years. Reading through their code you'll learn a lot: ftp://ftp.idsoftware.com/idstuff/source/quake3-1.32b-source.zip. I would also recommend taking a look at Enemy Territory which was a based of quake 3 code: ftp://ftp.idsoftware.com/idstuff/source/ET-GPL.zip.
Actually, I can not tell the difference between engine and framework. It's just two different names.
What really odd is that game engine is all about client side, it seems like you do not need a server framework, whereas pure socket is enough for it.
But the reality is not like this, at least, there should be some framework like rails or django to ease your server development. Not to see game server is harder than web development in scalability, broadcast and other areas.
There is a commercial solution called smartfox server, and a new open source solution called pomelo framework, I've tried both, pomelo is much better. pomelo.netease.com is its home.
It also depends on the "level" of the Engine.
What I mean with that, is how abstract the Engine is from a certain gamestyle. There might be small things like a engine that is focused on a FPS might be built to be optimized for indoor areas, outdoor areas, that you fly at high speed. So even if a Engine might not be locked to a game, certain game types will be easier to implement certain Engines.
But as stated above, the game won't inherit the engine, it will more probably draw on it's functionality, and you will probably attach components to it's existing components. Or expand the components that are part of the engine.
class CoolDiscoLight : public Engine::Light
{
};
...
//and somewhere in the source
"CoolDiscoLight cdl = new CoolDiscoLight etc..."
EngineInstance.AddLight(cdl);
...
Even more probible is the fact that just by extending from light and overloading the correct functions the light will be accessible to a level editor etc so you won't actually create them trough the source at all.
A game engine is generally consider the code that can be pulled out and replaced with out changing the game it self.
Like has been stated already, how exactly you USE the code of an engine depends on the engine it self.
Commonly, you will instance class from the engine library and use them. The way you do this will be dictated by the engine.
Some might provide more features then other, some focus on module-ness.
Often an full game engine, will just tie together various sub engines, such as a graphics engine that handles actually drawing to screen. A physics engine for simulating your game world. a UI engine for the UI and menus. a network engine that handles entowrking things.
The 'game engine' may well have these components built in directly, or it may just be wrapping another engine/library so that you use it in a similar way to the rest of the engine.
do game developers build an engine, then create a new class that
inherits from engine which becomes the game?
It depends. Most of the time developers will make uses of existing game engines but sometimes they won't due to non-existence of wanted effects.
I have tried a number of different game engines. Most of them are behaving like this:
Defining sprites and sound elements by extending the class of it's basic entities
Defining groups for the ease of management
Defining a room or world for interaction between IO and the sprites
Program the logic in common functions like "update()" (the function will be called per frame)
Modify the entrance of the program to get into the first "room" or "world" (it can be a menu)
So a game engine is mainly do jobs of defining how the screen should display in a middle-layer, and the developer no need to worry about issues like will there be too many sprites loading outside the view-port? or When I press a key, where should the callback be located?, `Are they entity collided?" but focus on the higher level logic of the game.
Well I have been searching for game creation help and have found that an engine is the base of the entire game like the player creation is made easier as well custom graphics and physics or similar items. You also need to think of the next couple games that you plan to do and use the engine to build very little into your game which is already built for you.
If you want to learn what a game engine is, how if functions, or want to build one here is how is should go.
GLFW - For opening an OpenGL window. It's a great little C library
that opens windows on pretty much anything. Which is great because
that's one less thing to worry about.
GLEW - Managing OpenGL extensions. If you're gonna do OpenGL, there's really no getting around this one.
Lua - Scripting. Although not yet used in my game, it's pretty much the go-to language for scripting in the industry because of its
fast virtual machine implementation.
Protobuf - Managing external state. You can find a documentation it here. The short of
it is that you could use protobuf wherever you'd normally use XML.
Qt - For standard containers and string manipulation. you don't need to use the entire Qt set of libraries, only the QtCore one. This gives
you access to QList (std::vector), QHash (optimized std::map), QString
(std::string with multiple encoding support) and lots of other
goodies. Part of the reason you should go with it is because the
documentation is superb.
GLM - Math library. If you just want math in your game, this is the library for you.
freetype-gl - Text rendering. It's a very well-written library for rendering text in OpenGL, you could do
a whole lot worse.
libRocket - GUI library based on HTML and CSS. It's great when you just want a UI on the screen, but gets problematic if you want to
add animations.
Find the list here
These are great ideas for an engine just combine the libraries and build the game off of the engine you build from theses although it will take you sometime to finish if you dont have a fine team. Also I have read over this list and many others and this is the best 2d list. Also you don't need to build an engine UI because you only need the basics of the engine and build a separate project for each game. Here is how to do it right.
Engine.h
enginepart1.h
enginepart2.h
enginepart3.h (ect.)
(use .h not .cpp for engine because you can not reference engine.cpp but you can reference engine.h)
after building that
Game.cpp
gameresources.h (resources include referencing Engine.h)
gamepart1.h
gamepart2.h (etc.)
And build the engine in a fashion like this but not 100% like this would be optimal
Framework: Math, Random, Utility, Asset, Network, Window, Graphics, Audio, ...
Player: AbstractPlayer, Score, Input, Collision, Reaction, Skill, Inventory, ...
Map: AbstractMap, Area, Town, NPC, ...
Enemy: AbstractEnemy, Creep, Boss, BaseAI, FuzzyAI, ...
State: IntroScreen, MainMenu, LoginScreen, Game, PauseMenu, ...
Interface: Button, Text, InputBox, ...
Found this here
Build it like this kind of
Framework: Math, Random, Utility, Asset, Network, Window, Graphics, Audio, ...
Entities/Characters: Player, Enemy NPCs, Friendly NPCs, BaseAI ...
Map: Map/Level Editor (if you want), Map Objects (can be placed here), Special Map Features, ...
State Control: Intro Screen, Main Menu, Logic Screen, Game State, Pause Menu(s), ...
Interface: Button, Text, Input Box, ...
it often likes this
class ShooterGame
{
Engine anEngine;
public void Run();///run the world here
};
Yeah, what they said. I'd add though that game engines are usually designed for a style of game. A flight simulator needs are very different than Quake. Games like Oblivion are merging those needs together though, so this may soon not be the case.

Video Game Bots? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Something I've always wondered, especially since it inspired me to start programming when I was a kid, was how video game bots work? I'm sure there are a lot of different methods, but what about automation for MMORPGs? Or even FPS-type bots?
I'm talking about player-made automation bots.
To 'bot' a game, you need to be able to do two things programmatically: detect what's going on in the game, and provide input to the game.
Detecting what's going on in the game tends to be the harder of the two. A few methods for doing this are:
Screen-Scraping This technique captures the image on the screen and parses it, looking for things like enemies, player status, power-ups, game messages, time clocks, etc. This tends to be a particularly difficult method. OCR techniques can be used to process text, but if the text is written on top of the game world (instead of on a UI element with a solid background), the ever-changing backdrop can make it difficult to get accurate and consistent results. Finding non-text objects on the screen can be even more difficult, especially in 3D worlds, because of the many different positions and orientations that a single object may possibly exist in.
Audio Cues In some games, actions and events are accompanied by unique sound effects. It is possible to detect these events by monitoring the audio output of the game and matching it against a recording of the associated sound effect. Some games allow the player to provide their own sound effects for events, which allows the use of sound effects that are designed to be easy to listen for and filter out.
Memory Monitoring If the internal workings of the game are well understood, then you can monitor the state of a game by inspecting the game's memory space. Some cheat tools for console systems (such as the Game Genie) use this method. By detecting what memory the game updates, it is possible to detect what the game is doing. Some games randomize the memory locations they use each time they are launched in an attempt to foil this vulnerability.
Packet Analysis With appropriate drivers, you can intercept the game's data packets as they are sent to or retrieved from your network card (for games played online). Analysis of these packets can reveal what your game client is communicating to the server, which usually revolves around player/enemy actions.
Game Scripting Some games have a built-in scripting interface. If available, this is usually the easiest method because it is something the game software is designed to do (the previous methods would all typically count as "hacks"). Some scripts must be run in-game (through a console or through an add-on system) and some can be run by external programs that communicate through the game via a published API.
Generating input events back into the game is typically the easier task. Some methods include:
Memory "Poking" Similar to the memory monitoring section above, memory poking is the act of writing data directly into the game's memory space. This is the method used by the Game Genie for applying its cheat codes. Given the complexity of modern games, this is a very difficult task and can potentially crash the entire game.
Input Emulation "Fake" keyboard or mouse signals can be generated in lieu of direct human interaction. This can be done in software using tools such as AutoIt. Hardware hacks can also be used, such as devices that connect to the computer's USB or PS/2 port and appear to the system to be a keyboard, but instead generate fake keypress events based on signals received from the computer (for instance, over a serial port). These methods can be harder for games to detect.
Game Scripting As mentioned above, some games provide built-in methods for controlling it programmatically, and taking advantage of those tools is usually the easiest (but perhaps not the most powerful) technique.
Note that running a 'bot' in a game is usually a violation of the game's Terms Of Use and can get you suspended, banned, or worse. In some jurisdictions, this may carry criminal penalties. This is another plus for using a game's built-in scripting capabilities; if it's designed to be a part of the game software, then the game publisher is most likely not going to prohibit you from using it.
Once I wrote a simple MMORPG bot by myself. I used AutoHotkey.
It provides lots of methods to simulate user input -- one will work. It's tedious to program a working one in C++ by oneself (Or look into AutoHotkey's source).
It can directly search the screen for pixel patterns, even game screens (DirectX)
So what I did was to search the screen for the name of an enemy (Stored as a picture with the game's font) and the script clicks a few pixel below it to attack. It also tracks the health bar and pots if it is too low.
Very trival. But I know of an WoW bot that is also made using AutoHotkey. And I see lots of other people had the same idea (Mine was not for WoW, but probably illegal, too).
More advanced techniques do not capture the screen but directly read the game's memory. You have to do a lot of reverse engineering to make this work. And it stops working when the game is updated.
How does an individual person go about their day to day?
This is sort of the problem that AIs in games solve.
What do you want your entity to do? Code your entity to do that. If you want your monster to chase the player's avatar, the monster just needs to face the avatar and then move toward it. When that monster gets within a suitable distance, it can choose to bite the player avatar, and this choice can be as simple as AmICloseEnough(monster, player); or more complex or even random.
Bots in an FPS are tricky to get right because it's easy to make them perfect but not so easy to make them fun. E.g. they always know exactly where the player is (gPlayer.GetPosition()) so it's easy to shoot the player in the head every time. It takes a bit of "art" to make the bot move like a human would.
For FPS-style bots, you could take a look at the Unreal Development Kit. As I understand it, this has got a lot of the actual game source code.
http://udn.epicgames.com/Three/DevelopmentKitHome.html
bta gave a very good reply. I just wanted to add on saying that the different methods are suspectible to different means of detection by the gaming company. Hacking into the game client via memory monitoring or packet analysis generally is more easily detectable. I generally don't recommend it since you can get caught very easily.
Screen-scraping used with input emulation is generally the safest way to bot a game and not get caught. Many people, (myself included) have been doing it for years with no problems.
In addition, to add an additional step between detecting what's going on in the game and providing input, some games require extensive calculation before you can decide what kind of input to provide to the game. For example, there was a game where I had to calculate the number of ships to send when attacking the enemy, and this was based on the number of ships I had, the type of ships, and who and what kind of enemy it was. The calculation is generally the "easy" part since you can do that usually in almost any programming language.
It's called AI (artificial intelligence) and really isn't that hard to replicate, a set of rules and commands in the programming language of your game will do the trick. For example a FPS bot would work by getting the coordinates of your player's body and setting your enemy bot's gun to aim at that coordinate and start shooting when in a certain range.

Automated testing a game

Question
How would you go adding automated testing to a game?
I believe you can unit test a lot of the game engine's functionality (networking, object creation, memory management, etc), but is it possible to automate test the actual game itself?
I'm not talking about gameplay elements (like Protoss would beat Zerg in map X), but I'm talking about the interaction between the game and the engine.
Introduction
In game development, the engine is just a platform for the game. You could think of the game engine as an OS and the game as a software the OS would run. The game could be a collection of scripts or an actual subroutine inside the game engine.
Possible Answers
My idea is this:
You would need an engine that is deterministic. This means that given one set of input, the output would be exactly the same. This would inlude the random generator being seeded with the same input.
Then, create a bare-bone level which contains a couple of objects the avatar/user can interact with. Start small and then add objects into the level as more interactions are developed.
Create a script which follows a path (tests pathfinding) and interact with the different objects (store the result or expected behavior). This script would be your automated test. After a certain amount of time (say, one week), run the script along with your engine's unit tests.
This post at Games From Within might be relevant/interesting.
Riot Games has an article on using automated testing for League of Legends (LoL), a multiplayer online RTS game.
According to the developers, there are many changes to both the game code and game balance everyday. They built a Python test framework that is basically a simpler game client that sends commands to the Continuous Integration server that is running an instance of LoL's game server. The server then send the test framework the effect of the command, allowing the response to be tested.
The framework provides an event queue that records the events, data, and effect from a particular point in time. The article calls this a "snapshot".
The article described an example of a unittest for a spell:
Setup
1. Give a character the ability.
2. Spawn an enemy character in the midlane (a location on the map).
3. Spawn a creep in the midlane. (In the context of LoL, creeps are weak non-controllable characters that are part of each team's army. They are basically canon fodder and is a source of experience and gold for the enemy team. But if left unchecked, they can overwhelm the opposing team)
4. Teleport the character to the midlane.
Execute
1. Take a snapshot of all the variables (e.g. the current life from the player, enemy and normal characters).
2. Cast the spell.
3. Activate the spell's effects (for example, there are some spells that will proc on hit) on an enemy character.
4. Reset the spell's cooldown so it can be cast again immediately.
5. Cast the spell.
6. Activate the spell's effects on a creep (in the context of LoL, most spells have different calculations when used on creeps).
7. Take another snapshot.
Verify
Starting from the first snapshot, replay the events, and assert that the expected results (from a game designer's point of view) are correct. Examples of events that can be verified are: The damage is within the range of the spell's damage (LoL uses random numbers to give variance to attacks), Damage is properly resisted when compared with a player character and a creep, and spells are cast within its effective range.
The article shows that a video of the test can be extracted when the test server is viewed from a normal game client.
Values are so random within the gameplay aspects of development that it would be a far fetched idea to test for absolute values
But we can test deterministic values. For example, a unit test might have Guybrush Threepwood move toward a door (pathfinding), open the door (use command), fail because he doesn't have a key in his inventory (feedback), pick the door key (pathfinding + inventory management) and then finally opening the door.
All of these paths are deterministic. With this unit test, I can refactor the memory manager and if it somehow broke the inventory management routine, the unit test would fail.
This is just one idea for unit testing in games. I would love to know other ideas, hence, the motivation for this post.
I did something similar to your idea once and it was very successful, though I suspect it is really more of a system test than a unit test. As you suggest your random number generator must be seeded with the same value, and must produce an identical sequence each time.
The game ran on 50hz cycles, so timing was not an issue. I had a system that would record mouse clicks and locations, and used this to manually generate a 'script' which could be replayed to produce the same results. By removing the timing delays and turning off the graphic generation an hour of gameplay could be replicated in a few seconds.
The biggest problem was that changes to the game design would invalidate the script.
If your barebones room contained logic that was independent of the general game play then it could work very well. The engine could start up without any ui and start the script as soon as initialisation is complete. Testing for crashing along the way would be simple, but more complex tests such as leaving the characters in the correct positions would be more complex. If the recording of the scripts are simple enough, which they were in my system, then they can be updated very easily, and special scripts to test specialised behavior can be set up very quickly. My system had the added advantage that it could be used during game testing, and the exact sequence of events recorded to make bug fixing easier.
An article from Power of Two GamesGames From Within was mentioned in another answer already, but I suggest reading everything (or nearly everything) there, as they are all really well-written and apply directly to games development. The article on Assert is particularly good. You can also visit their previous website at Games From Within, which has a lot written about Test Driven Development, which is unit testing taken to the extreme.
The Power of Two guys are the ones who implemented UnitCpp, a pretty well-regarded unit testing framework. Personally, I prefer WinUnit.
If you are testing the rendering engine I guess you could render specific test scenes, do a screen captures and compare them to reference test renderings. That way you can detect if changes in the engine breaks anything, visually. You can write similar test for the sound engine, or even animation (by comparing a series of frames).
If you want to test game logic or scene progress you can do this by testing various conditions on the scripting variables (assuming you are using scripting to implement most of the scene and story aspects).
If you're using XNA (the idea could be extrapolated to other frameworks of course), you could use an in-game unit test framework that lets you access the game's state in the unit test. One such framework is Scurvy.Test :-)
http://flea.sourceforge.net/gameTestServer.pdf
This is an interesting discussion on implementing a full-blown functional tester in a game.
The term "unit testing" implies that a "unit" is being tested. This is one thing. If you're doing higher-level testing (e.g. several systems at once), usually this is called functional testing. It is possible to unit test much of a game, however you can't really test for fun.
Determinism isn't necessary, as long as your tests can be fuzzy. E.g. "did the character get hurt" as opposed to "did the character lose 14.7 hitpoints.
I have written a paper on that topic -
http://download.springer.com/static/pdf/722/art%253A10.7603%252Fs40601-013-0010-4.pdf?auth66=1407852969_87bc2e71ad5228b36738f0237084ebe5&ext=.pdf
This doesn't really answer your question but I was listening to a podcast on Pex from microsoft which does a similar thing to the solution you're proposing and when I was listening to it I remember thinking that it would be really interesting to see if it would be able to test games. I don't know if it would be able to help you specifically, but perhaps you could take a look at some of the ideas they use and apply it to your unit testing.