Enabling super fast build time; all hail pre-compiled header files
Posted: August 25, 2009 Filed under: Uncategorized | Tags: c++ techniques Leave a comment »Recently, I was exploring Boost (the c++ library) and I started out writing a simple program where it would recursively return the files and directories in a given directory. Boost is great, but my biggest rant was: its just too slow when I compile it. It was taking a lot of time for a program as simple as I had written. And, all I was including was:
#include "boost\filesystem.hpp" // includes all needed Boost.Filesystem declarations #include <iostream> // for std::cout #include <string> #include <vector>
Thats all! A quick google search on this, made me realize that this is something that a lot of people despise about Boost. Somebody, then recommended me looking up “Pre-compiled Header files”. Oh man, it worked like a charm and guess what, after my first build, the build time dropped from 0:11 to 0:02 seconds, Nhaaice!
There are some nuances that I am exploring, but am convinced, its a good thing to use in a big project where you are including big and heavy header files like windows.h or STL stuff.
Here is a great article at Fractal eXtreme, that says it all.
Some of the in-general quick tips that I learnt from there: (MS VS express 2008 c++)
- Seeing your build time: In the VS IDE; goto: Tools -> Options -> Projects & Solutions -> VC++ Project Settings -> Build Timing :: Set it to yes
- See the list of header files that get included: goto Project properties -> C++ -> Advanced -> Show Includes :: Set it to yes
Here is my sample code listing:
template <class Type>
vector<Type> CFileUtility::FilesInDirectory(const bfs::path &dirPath, bool recursive)
{
vector<Type> fileList;
if( !exists(dirPath) )
{
throw new exception(string(dirPath.string() + " not found!").c_str()); ;
}
else if( bfs::is_regular_file(dirPath) )
{
throw new exception(string(dirPath.string() + " is a File!").c_str());
}
else
{
bfs::directory_iterator iter(dirPath), iter_end;
for(;iter != iter_end; iter++)
{
if( bfs::is_directory(*iter) )
{
if(recursive)
{
vector<Type> list = FilesInDirectory<Type>(*iter, recursive);
fileList.insert(fileList.end(), list.begin(), list.end() );
}
continue;
}
else
fileList.push_back( iter->string() );
}
}
return fileList;
}
Exploring XNA and XML jazz
Posted: May 19, 2009 Filed under: Uncategorized Leave a comment »In my process of exploring XNA with XML, I came across the following:
- XNA Content pipleine
- IntermediateSerializer @ Shawn Hargreaves blog
- XML & Content pipleline @ Shawn Hargreaves blog
- Serializing and Deserializing XML Documents
- How Serializers work @ Shawn Hargreaves blog
- XML DOM @MSDN >> What is DOM all about
PS: I will be adding/deleting more as I read and find better articles!
Art Assets List
Posted: March 26, 2009 Filed under: Uncategorized | Tags: Art Assets, Ladder, ToDo Leave a comment »Here is the list of art(graphics) assets that I think I would be needing for the game:
(All tilesets are to be (48 X 48 pixels) unless otherwise stated)
World Assets:
- Jungle background ( I dont have a scrolling background, so if I integrate the scrolling background, we can change this to scrolling background )
- TileSheet for the world:
- Dirt tiles
- Swamp Tiles
Enemy Assets:
- Turret: Ape :: Darts
- Frogger: Frog sprite :: Slimey Blotch
- Murtle: Green Snail :: Does not fire
- Smurtle: Furios Eel :: Does not fire
- Ceiler: Screaming Monkey :: Pointed Bananas
- MadAx: Bear with fairy wings(he can fly) :: Axes
- MoFoBoom: Orangutan (Louis from Talespin) :: Boomerang
Player Assets:
- Fat man and animations
Resource Assets:
- Shield :: Different color of clothes
- Health pack :: Cheese Burger
- Ammo pack :: Big Flame torch
- Bullet :: 1 flame torch
- Weapon ::
- Coin ::
HUD: UI Assets: (These need not be 48 X 48 each, they can be of different dimensions)
- Face-eyes
- Lives:
- Coins:
- Ammo left:
Game State Screens:
- Introduction Screen:
- PJ Games logo screen
- Rating Screen
- Game Name splash screen
- Background screen for all menu screens: Flintstones themed
- Game Win/Loose Screen
- Thank you for playing screen
What audio content/instance to use with XNA?
Posted: March 25, 2009 Filed under: Uncategorized | Tags: audio, faq Leave a comment »I am trying to add sound to my mario-game. I was trying to find out the stuff out there which I can use as a programmer:
(here is my question:)
I am not sure where to post this, but here!
So, I am at the stage, where I am planning ahead to add sounds to my game. As of now, I just want to learn what all options I have and be ready with the code to integrate it.
I was going through a bunch of tutorials, but from a programmer’s perspective, I could not decide what to use and to what extent.
Broadly speaking; here are the effects that I have in mind:
- background in-game sound
- sound effects like whenever a player takes a hit or an enemy fires a bullet.
- (if I can make it happen tho..) I have a enemy unit called frogger. I want the volume to grow as I approach it( some would recognise it as doppler effect), the way u have the noise of flies/ croaking of a frog in a swamp.
The options, that I am aware of are::
- SoundEffectInstance
- MediaPlayer.Play(Song)
- using XACT
The first two options let me use mp3, while XACT only allows wav format.
My concern is: I dont know which one is good from a memory perspective or what should i use in what situation? Both can play the sound..but what would be a better way…are there any memory leaks that I need to think about or what? I am also interested in exploring the intent behind these three ways, as in, are they custom made with something specific in mind.
I would appreciate any suggestions as to what should i go ahead with..
I posted it at Gamedev.net and Gamecareerguide.com and got some some useful replies as well.
My conclusion:
for the background looping music, MusicPlayer.Play() would be the way to go.
Also, depending on the complexity of when the sound is to be played or some other criterion:
if its simple and lame, SoundEffectInstance is my friend
else
XACT is there for my rescue
In my search, I found this article that actually discusses stuff from a technical aspect:
http://blogs.msdn.com/etayrien/archive/2008/09/22/audio-input-and-output-formats.aspx
And, as for reading how to implement stuff, Id recommend following this tutorial:
RB Whitaker’s Wiki audio tutorial
Also, if you have any questions regarding audio with XNA, please let me know. I am still not the music programming guru, but in my experience, I might have experienced the same problem and could possibly save you some painful hours.
Feel free to comment on this post and let me know if you are aware of some more stuff/tutorials that I can add for audio.
Game state and menus
Posted: March 21, 2009 Filed under: Uncategorized | Tags: Ladder, Progress Leave a comment »I just wrote a pretty generic game state and menu system. I am hoping to reuse it in my future projects
Also, I’ve integrated the game within this, so now, I just need to replace the right background images. With that out of the way, the next major thing that is left is defining the level. As soon as that is in place, and a couple of tweaks here and there, it should be in a pretty good shape.
Lines&Curves update
Posted: March 9, 2009 Filed under: Uncategorized | Tags: Ladder, Progress Leave a comment »From the Todo list, I’ve got the following down:
- Limited ammo for weapons.
- Checkpoints implemented.
Next, I think I want to work on the HUD and defining the level.
Stay tuned
Tasks needed to be done to complete Lines & Curves
Posted: March 9, 2009 Filed under: Uncategorized | Tags: Ladder, ToDo Leave a comment »First off, the game needs a change in name
Here is the ongoing To-do:
1. Should I make the ammo for player’s gun limited? Thus, I feel I should make the ammo limited, but I wanted some opinion.
2. Next, we need to think what all do we need to show up on HUD. For instance,
- Health
- Lives
- Coin count
- Ammo available to the player
- Enemy health
3. Do you think, we should have checkpoints in the game ? (If a player dies, instead of starting from the beginning of the game, player starts from the last crossed checkpoint).
4. What kind of particle effects would be apt for different events. I define events as:
- Enemy firing a bullet.
- Enemy taking a hit.
- Player taking a hit.
- Player firing a bullet.
- Maybe something for coins (like a sparkle) / different type of pickups that we have.
5. I think we need to also think about a name/logo for the game.
6. Menu System
7. Sound effects, we can see what kind of sound effects we want (we can use the same list of events to guide us).
8. When the player is shielded and a bullet hits him, do you think the bullet should reflect back or should the player just take less damage instead?
9. Refine/Define the level.
Extras:
- Scrolling background
- Shoot through tiles and the player can walk through them.
- Coins rotate (effects)
- Mip-maps for overlay HUD in gamePlay to support different video resolutions
Sound Assets Needed
Posted: March 6, 2009 Filed under: Uncategorized | Tags: Ladder, Sound Assets Leave a comment »A list of the sound assets I might need:
- Turret fires a shell
- low volume, swamp noises as the frogger becomes active
- When the frogger shoots those slime blotches
