INDIVIDUAL MID-SEMESTER PROJECT

BENCHMARK 3

CORRECTION: Before you start, as discussed in lecture, make sure you update the WStringTable class' getIndexOfWString method such that it properly updates the counter. So, the updated method should be:

unsigned int WStringTable::getIndexOfWString(wstring key)
{
	unsigned int counter = 0;
	vector<wstring>::iterator it = wStringTable.begin();
	while(it != wStringTable.end())
	{
		if (key.compare((*it)) == 0)
			return counter;
		it++;
		counter++;
	}
	unsigned int max = 0;
	max -= 1;
	return max;
}

Requirements: THIS IS A BIG ONE!!! In this benchmark, you will create your game's prototype. This means you will make something that looks and behaves somewhat like your final game. Specifically, you will gather much of your game's necessary artwork, and use it to draw your game world and main character. You will load your game world from a level file, and you will then tie your character's movements to the viewport such that scrolling works properly. You will also add a simple, pattern-based Bot. You do not yet have to implement collision detection, however.


Part 1: Gather your artwork - Draw and find (dare I say borrow?) all artwork necessary to draw your game world and your main character. You are strongly advised to pick up a digital camera and photograph various surfaces to use as background tiles. You are more than welcome to use completely original artwork to make a game that is truly your own, but Internet sources are fine for this assignment. You may use large or small (tiles) artwork, whichever fits in with your game design better.


Part 2: Load all level data from CSV files - In the DummyGame example that we have used so far, we have created a simple level with a tiled background and an animated main character who simply stands still. What's more, the game level is loaded by hard-coding the level creation inside the DummyDataLoader class. Instead of hard coding a level, you should put all level data inside a series of CSV files, and then load them into your objects. The format you choose to use is up to you.

For example, you may choose to have an initial csv file that points to other files for data concerning a particular layer or sprite type. Or you may choose to put all your sprite data in a single file, etc.

Part 3: Build and Scroll your World - Add code to your program such that when someone starts a new game your game world is drawn according to the following:

Part 4 - Main Character Animation States - your main character should be able to move about the level as the viewport scrolls. Note that we do not yet have gravity and collision detection, but if your character is moving left or right, the artwork should reflect that. In fact, add artwork and the appropriate animation states you'll use for your main character.

Part 5 - Simple Pattern-Based Bot - add a pattern-based bot that moves about the level using your own preset pattern. Note that this pattern should be somewhat interesting, not just moving back and forth on one axis. It should also periodically stop and sit idle. You'll need to provide art for this bot as it moves about. Note that I realize this may not be part of your original game design, but note that this bot does not need to be part of gameplay, it could simply represent background decor.

NOTE: in order for your bots to work, you will need to make them think each frame. The engine does not currently do this. So, you'll need to go to the SpriteManager's update method and after updating the bot's animation data via updateSprite method, add a call to the think method. So, the code you would add would be bot->think(game);. Note that this would only work if you add bots. I have provided a simple little bot type called RandomFloatingBot. Try including the SSSF_SourceCode\gsm\ai\RandomFloatingBot.h file and then add the following code to the end of your DummyDataLoader class' hardCodedLoadLevelExample:

	// LET'S MAKE ANOTHER TYPE OF SPRITE TO USE NOW FOR BOTS
	wstring BOT_FLOATING0_IMG = L"./textures/world/sprites/hex/Hex0.png";
	wstring BOT_FLOATING1_IMG = L"./textures/world/sprites/hex/Hex1.png";
	wstring BOT_FLOATING2_IMG = L"./textures/world/sprites/hex/Hex2.png";
	wstring BOT_FLOATING3_IMG = L"./textures/world/sprites/hex/Hex3.png";
	int BOT_WIDTH = 64;
	int BOT_HEIGHT = 64;
	wstring FLOATING_STATE = L"FLOATING_STATE";

	ast = new AnimatedSpriteType();
	vector<unsigned int> botImageIDs;
	botImageIDs.push_back(worldTextureManager->loadTexture(BOT_FLOATING0_IMG));
	botImageIDs.push_back(worldTextureManager->loadTexture(BOT_FLOATING1_IMG));
	botImageIDs.push_back(worldTextureManager->loadTexture(BOT_FLOATING2_IMG));
	botImageIDs.push_back(worldTextureManager->loadTexture(BOT_FLOATING3_IMG));
	ast->setTextureSize(BOT_WIDTH, BOT_HEIGHT);
	ast->addAnimationSequence(FLOATING_STATE);
	for (int i = 0; i < 4; i++)
		ast->addAnimationFrame(FLOATING_STATE, botImageIDs.at(i), 10);
	spriteTypeID = spriteManager->addSpriteType(ast);
	ast->setSpriteTypeID(spriteTypeID);

	// AND LET'S MAKE 100 OF THEM IN RANDOM PLACES WITH RANDOM TRANSPARENCIES
	for (int i = 0; i < 4; i++)
	{
		RandomFloatingBot *bot = new RandomFloatingBot(gsm->getPhysics(), 2, 20, 2);
		bot->setSpriteType(ast);
		bot->setCurrentState(FLOATING_STATE);
		bot->setAlpha((rand()%200) + 55);
		bot->pickRandomVelocity(gsm->getPhysics());
		PhysicalProperties *pp = bot->getPhysicalProperties();
		pp->setCollidable(false);
		int x = (i * 300) + 100;
		int y = (i * 300) + 100;
		pp->setX(x);
		pp->setY(y);
		pp->setAccelerationX(0.0f);
		pp->setAccelerationY(0.0f);
		spriteManager->addBot(bot);
	}

You'll just need to add the four image files to the proper directory, so try:

You should find 4 dumb little bots floating about the level ... that is if you provided four bot images and referenced them to the constants used for loading the textures. Note that while this bot is not exciting, we have to start somewhere. You'll start to add the interesting bots that follow patterns, and in the next benchmarks, do the stuff important to your game.


NOTE: You are permitted to use any source code from our textbook or examples we looked at in class. Please understand that students may not share code among each other. This is an issue that I take very seriously. This is an individual project, and so students must do their coding individually. I want to make sure that each student learns to code games in this course, and the only way to do this is to verify that everyone is doing their own work. Incidents of academic dishonesty will be taken very seriously, so please, don't be tempted this late in your academic career.


SUBMITTING YOUR HW: This should be done in two stages:


A LOOK AHEAD

For the next benchmark students will add collision detection and response and finish off the game.

GO BACK TO BENCHMARK 2

GO AHEAD TO PRESENTATIONS


SUNYSB CSWeb page created and maintained
by Richard McKenna