TimeFrack: Now with fast forward and fast rewind

October 27, 2009

I got around to doing a bit more and you can now rewind at double speed or even make time move forward at double speed. Really any time speed works now but just for the sake of making it displayable on a progress bar or whatever you call it I capped it at -2 and +2. The game was already setup in a way that I could have made it rewind at any given speed already but it took a little more work getting time to move forward at a speed faster then regular real time well still having what happens during that time rewindable at any speed. It actually didn’t take any time at all to figure out how to do it but I got stuck on a small detail when implementing it which I’m still not sure why it was a problem. Anyways it works now.

I also made a bunch of other improvements though I don’t completely remember for sure what I did before and after the last time I posted so I might be forgetting things or mentioning stuff that was already in the game. Whats probably most noticeable is that slow rewinding is smoothed out and it doesn’t look like your watching a slide show anymore. I reworked the camera (again) so when in first person you can see your body/feet like you could at first and the third person camera is over the shoulder now so your character doesn’t block your view of your aim. The transition from first to third works a bit better also. I had to rework how the direction of your blasts where decided to make it functional with the over the shoulder camera which in turn improved first person aiming a bit (you might have noticed before that along with the intentional inaccuracy your shots also always hit lower then they should have). The time line is now a complete 30 minutes. Run speed is a bit faster. I think everything else was mostly just little tweaks.


TimeFrack: Now with slow motion

October 20, 2009

The game now has slow motion.

There is another bar on top of the timeline one that you can dial up and down using the mouse wheel to increase and decrease the speed of the game. All the way to the right means your playing forward at full real time speed, dead center means the games paused (there is a line down the middle to make it clear where that is), all the way to the left means your moving backwards in time at the same speed and anything between will make the game go at the appropriate speed (75% of the way down the line will for example leave the game moving forward at half speed).

Just like with rewinding there are some small and likely unoticeable things that arent yet being properly handled when messing with time but its pretty much fully functional and should take me to long to deal with the last few loose ends.

I increased the cap on the time line by 50 so you can play non stop for roughly 28 minutes and rewind all the way back. I also fixed up the transparency of the impact effect that shows up when a blast hits a wall which previously didn’t work correctly during a rewind. I also made some little changes and tweaks to gravity and shooting and a few other little things and added a cross-hair and reworked the camera a bit.


TimeFrack: Its a lot like TimeShift.

October 11, 2009

Screw it. I’m not really in the mood for writing tutorials and besides I’m not especially good at it. If anyone wants help with making a game just ask me in the comments. Now on with the game. Neither you or the other characters can be harmed yet but you can shoot and so can they and all of the movement collision detection is setup and most importantly rewinding time is functional.

For controls use WASD to move, hold shift to run, tap Q to switch from first and third person views, Hold E to rewind time (You cant rewind past the beginning and similarly the game wont let you play past the end of the time line which is visible at the bottom of the screen) and use the mouse to aim and any mouse button to shoot.

I’m really happy with the movement. I did a few things a little bit differently then I usually do and I’m really happy with the results. It probably isn’t particularly noticeable (though it likely will be more so later in slow-mo) but there is real momentum to your movement. So if your moving left and then start moving right it has to first slow down your momentum going in that previous direction and then build up more in the new one. Even completly changing directions doesnt take to long and the controls still feel responsive but when you compare it directly with another game that has exact controls it really does feel more natural. Also rather then leaving you in complete control of your movement well off the ground or making it based completly on momentum when you first jump/fall its actually a little bit of both (took a few tries to get the balance right but I think its good now) which i think worked out really well. Pushing enemy characters by bumping into them works fairly well also.


Tutorial: Making a game with DarkGDK part two

October 8, 2009

Part 2: Media

I’m not going to go into detail about making 3d meshes or textures right now but I will supply you with some to use.


Now lets get back to working on the game and use those art assets. Open up the project again and here’s what you’ve got to do in Main.cpp to load up everything and get your character moving round. I commented the hell out of it so even if you just copy and paste it all at once hopefully it will make sense. It will be easier to read from within the IDE.

//include DarkGDK and Sparky's collission detection which well be needing for later
#include "DarkGDK.h"
#include "SC_Collision.h"

//now declare the variables that we are going to need to use.
//I want to play in fullscreen without changing the resoltution and GetSystemMetrics is a good way to find out what the current desktop resolution is.
int screenx=GetSystemMetrics(SM_CXSCREEN);
int screeny=GetSystemMetrics(SM_CYSCREEN);
//dark gdk identafies 3d objects by a number and you cant assign multiple objects to the same number so I number them by the order there created in so you can check what the next available number is by keeping track of how many objects already exist.
int objcount=1;
//your going to want to remember what the object number is for your charecter since your going to be moving it around.
int youobj;
//isnt really neccessary but I like to record keypresses as variables
int up;int down;int left;int right;
//keep track of your movement speed and what angle your heading in.
//using double rather then int essentially means that it can deal with decimals rather then only whole numbers.
double movespeed;double moveangle=0;
//you will want to have a few multi purpose variables
double x;double y;double z;

void DarkGDK ( void ){
//now to start with the rest of the pre game setup.
//set the game resolution to the current desktop resolution which we found out before.
//since the games in full screen people probable wotn see this but its good to label things.
//set it to full screen.
//set what color will be shown on screen where there arent any visisble objects.
//throutle the frame rate to a predetermend rate (in this case 30)
//keep DarkGDK for doing anything anoying with the camera.
//turn off the mouse cursore.
//start up Sparky's collission detection.

//now we start loading those objects.
//load the room.
//load the texture.
//apply the texture.
//update the object count so we know not to assign that number to anymore objects.

//load your charecter model.
//keep track of its oject number.
//update the object count so we know not to assign that number to anymore objects.

//now we run the loop that the actual game occures in.
while ( LoopGDK ( ) ){

//update the charecter object and camera rotation based on mouse movements so you can turn and aim.

//check what keys are down.
//now if more then one key is down we need to change your movement direction and speed based on what combenation of keys are being used.
if (up+down+left+right==0){
if (up==1)if(down==0)if(left==0)if(right==0)moveangle=0;
if (up==0)if(down==1)if(left==0)if(right==0)moveangle=180;
if (up==0)if(down==0)if(left==1)if(right==0)moveangle=270;
if (up==0)if(down==0)if(left==0)if(right==1)moveangle=90;
if (up==1)if(down==0)if(left==1)if(right==0)moveangle=315;
if (up==1)if(down==0)if(left==0)if(right==1)moveangle=45;
if (up==0)if(down==1)if(left==1)if(right==0)moveangle=225;
if (up==0)if(down==1)if(left==0)if(right==1)moveangle=135;

//update your position and reposition the camera just behind you.

//update the screen.
dbSync ( );
//complete the loop.
//exit the game (by default DarkGDK automatically does this when the esc key is hit).

You might have noticed there seemingly random numbers being used when checking what keys where being pressed. It isn’t actually at all arbitrary. Each key on a keyboard is assigned a scan code and the dbKeyState() command returns a one if the specified key is being pressed down and zero if it isn’t. Here’s a nice little diagram to check anytime you want to know what the scan code is for a key.

Tutorial: Making a game with DarkGDK

October 7, 2009

I’m stuck getting something working in They DoNotDie (I can read the file names of everything contained in a folder one by one and I can load map data from a pre determined specified file but I cant get the freaken thing to load from one of those files that I just read the name of which means unless I’m going to cap how many levels you can have and use predetermined names for all of them then I have no idea how to go about having multiple maps in the game) and getting kinda frustrated. Anyways I’ll go back and work it out later but right its got me feeling like starting something new so I figured I would make a basic shooter with some time controls (I always felt like Time Shift was cooler then people gave it credit for being) and I figured I would in the process write a game making tutorial showing how I did it to help anyone interested in making games get started. Basically everything here is based on the assumption that you want to make a 3D game and you want to make it with DarkGDK and I doubt there will be much that you can learn here that would translate to anything else. Also I should point out that this is how I do things which isn’t necessarily ever the ideal way to do things. Anyways lets proceed.

Part 1: The setup

First up if you don’t already have it then you should download and install Microsoft Visual C++. You can get the express edition free at the address bellow. You can use DarkGDK with other IDEs/compilers but I seriously recommend you get Microsoft Visual C++ 2008 Express.


next up download and install the DirectX SDK


Apparently there are problems with Using DarkGDK if you install it before compiling something so first open up visual c++ express and click file/new/project at the menu bar. Then under Visual C++/Win32 select Win32 Project and enter whatever you want for a name and select ok and just hit finish for the next window the pops up. then go to build/build solution (or hit F7) and it will compile the project that was just generated. Now you can exit out of Visual C++ express and if you want even delete that project.

Then go download and install DarkGDK.


Open up Microsoft Visual C++ 2008 Express again. Hit file/new/project. This time select wizard then Dark GDK – 3D Game and name it whatever you want to name your game (I’m going with Time Frack). Then go to build/configuration manger and set it to release. Now open up Main.cpp (it should be listed in the sidebar so just double click on it) so you can start making changes and your also probably going to want to read through it once to get a basic understanding of how to do things (anything with // before it which shows up as green will be ignored by the compiler and in this case that ignored text very well describes what everything is).

Now since DarkGDK’s built in collision detection is terrible if you want to check for collisions with 3d objects then your going to want to use Sparky’s collision detection which is pure awesome. So just slap #include “SC_Collision.h” right bellow #include “DarkGDK.h” near the top of into main.cpp.

Unfortunately it wont work now because SC_Collision.h doesn’t actually exist or at least not on your computer. So go get it. Remember you want the DarkGDK version. I think your also going to need to make an account at the Game Creators Forum to get the download but if anyone wants me to I’ll upload it here.


Once you have gotten the download and extracted everything from the rar file your going to want to put the SC_Collision.h file (found in the include subfolder) and SC_Collision.lib (found in the lib\VS8 subfolder) somewhere and leave them there undisturbed. Personally I just took the include and lib folders and dropped em into my Time Frack project folder (which in my case is at C:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\Time Frack\Time Frack\). Next up your going to want to tell your game where it can find those important files. So hit project/Time Frack properties. Then under Configuration Properties/ C/C++ / General your going to need to add the folder that SC_Collision.h is in (in my case “C:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\Time Frack\Time Frack\include”) to Additional Include Directories. Next you need to do the same for SC_Collision.lib only this time under Configuration Properties/ Linker / General and add the address to Additional Library Directories. Then hit ok and then file/save all.

For now I suggest just leaving everything else as is and first hit build/build solution so we can compile the game and see if everything is working. In my case the compiled and ready to use executable was generated at C:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\Time Frack\Time Frack\Release but that might be somewhat different for you.

If that newly compiled executable works and when you run it some round polygonal shapes spin on screen then do a little celebratory dance and be happy knowing that your at least as smart as the average modern day child and can successfully install pre made software. If that executable doesn’t work or wasn’t generated or you got stuck on anything I said to do then feel free to vent your rage in the comments and I’ll do my best to calmly apologize for my mistakes or poorly phrased instructions and try to rectify the situation. This is getting a bit long so I’ll stop for now and continue tomorrow.