Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

6. December 2016

 

A couple years ago I did a detailed text tutorial on how to use a debugger which oddly is a massively important skill that simply isn’t taught.  Given that this article is still popular two years later I’ve decided to follow it up with a video version.  This video, Debugging 101, walks through the basic tasks involved in debugging.  It used Visual Studio 2017 and C++ but should be applicable in most languages and IDEs.  The video shows how breakpoints and conditional break points work, how to step into, over and out of your code, how to use the local and watch window, call stacks, how to do memory debugging and more.  Basically the video shows you how to get started using a debugger.

 

The following is the code used in this example.  There is nothing special to this code, it’s extremely contrived, but it enabled me to show the various features available in most debuggers.

#include <iostream>

// These two functions are used to illustrate how the call stack works
// As well as how step into and step out of behave.
int innerFunction(int input) {
	int meaninglessCounter = 0;
	for (int i = input; i > 0; i--) {
		// First show stepping through the loop
		// Set a conditional breakpoint that breaks when i is a certain value.
		meaninglessCounter++;
	}
	return input;
}

int outerFunction() {
	int i = 42;
	return innerFunction(i);
}


class Demo {
	std::string stringValue;
	int intValue;
	bool booleanValue;

	public: 
		Demo(std::string a, int b, bool c) : stringValue(a), intValue(b), booleanValue(
		c) {};
};

int main(int argc, char ** argv) {
	// Callstack demo, jump into, jump over example
	int someVal = 0;
	someVal = outerFunction();

	// Data example -- simply create a char buffer, fill it with 'a' then null 
	terminate it so 
	// it can be treated like a string.
	char * data = new char[1000];
	for (int i = 0; i < 1000; i++)
		data[i] = 'a';
	data[999] = 0;
	std::cout << data << std::endl;

	//set a watch on d.  Demonstrates watches and drilling into complex object
	Demo d("Hello", 42, true);
	
	std::cout << "End of demo" << std::endl;
	delete[] data;
	// delete[] data;  Calling delete again will trigger an exception
}

Programming , , ,

24. November 2016

 

Every year there are a large number of great Black Friday deals of interest to game developers.  This list is an attempt to capture as many of them as possible in one place.  If you see a great Black Friday or Cyber-Monday deal of interest to game developers that isn’t on the list below, please let me know in comments below. 

This list will be constantly updated so be sure to check back regularly!

 

Deals on Amazon

Software

 

Hardware

 

Deals on Steam – Autumn Sale

 

Deals on Unreal Engine

 

Deals on Unity

 

Misc

allegorithmic

udemy

Microsoft Store

Dell

HP

tsugi

 ClipStudio

3D Coat

Reallusion

ASoundEffect

GameMaster Audio

Smith Micro

Adobe

Corel

AutoDesk  -- Something Fishy with this promo.  Seems no longer available in Canada and never Available in the US.  BOO

Daz3D

Blender

PaintStorm

GameSalad

News, General ,

4. May 2016

 

Mixamo is a great animation resource, that enables you to quickly (and currently freely) add animations to your 3D models.  However, if you want to incorporate the results into your Blender workflow, it can be a bit non-intuitive.  The Mixamo documentation recommend using Collada, which simply does not work well.  There instructions also skip completely the process of actually using the resulting animations...  a rather key component.  The following workflow is perhaps the easiest with the best results.

 

First off, when exporting your animations from Mixamo, use the following settings:

image

 

This will result in a zip file containing your model, as well as several animations, like so:

image

 

If you haven’t already, load Blender.  Next go to File->Import->FBX.  The next part is critical, in the Import FBX settings select Manual Orientation and Apply Transform

image

 

Your model and it’s armature should now load fine, with full proper textures showing up.  I suggest you rename your armature something meaningful, as each animation is going to come in with the same name (Armature, Armature.001, etc.).

 

Next do the import again, with the exact same settings, this time bring in one of your animations.  If you only need to wire up a single animation, you are nearly done.  Just bring up the DopeSheet, switch to Action Editor

image

 

You can now toggle between any animation available in the Blend file:

image

Keep in mind, I renamed my main character Timeline, then the walk animation armature was renamed Walk, etc...

 

If however you need to use multiple animations, or want to create a single timeline with all of the animations on it, you are now going to have to break out the NLA Editor.  It is simply a matter of Add Action Strip to your main character, for each animation in the timeline, like so:

image

 

And, the end result:

GIF

 

I glossed over part of the process, but never fear... I also did a video!

Art , ,

5. January 2016

 

Ok, this one is a bit off the topic of game development, but I figured I would share it here for other people struggling with slow renders in Camtasia.  I use Camtasia Studio for all of the video tutorials here on GameFromScratch and while I enjoy the program, rendering speeds vary between awful and OMG!MAKEITSTOPBURNBUUUURRRRNNNN.

 

It pains me to say I never thought about this as a way to speed things up until now.  As of Camtasia Studio 8, they started supporting CUDA rendering on GPU.  Problem is, if you like me are running an Optimus GPU, it uses the wrong one and the results are way slower.  Telling it to run on the dedicated GPU resulted in a 3x increase in speed for me.

 

Simply right click the shortcut or executable and select the high performance GPU:

image

 

This is standard behavior on trying to get all sorts of games to run correctly, but sadly it never occurred to me to try it with Camtasia.  This setting can also be permanently set using the nVidia Control panel, but I’ll leave that as an exercise for the reader, there are a few thousand documents covering this already.

 

If your machine doesn’t have Optimus, it might still be a good idea to try rendering with GPU support off and seeing if you get an increase, simply go to Tools-options and untick the appropriate setting

image

 

I’m amazed that Camtasia support aren’t making this exceedingly to start with.   This little fix is going to save me about 2 hours a week on average!

 

There is a video version of this process available here or embedded below.

Totally Off Topic

4. January 2016

 

I was recently working with a tool that exported it’s level data as a directory full of obj files, literally hundreds of them.  You can import them into Blender using File->Import->Obj, unfortunately there is no way to do a select all.  Apparently in Blender 2.4x if you held SHIFT while selecting OBJ import, it would import an entire directory, but this doesn’t appear to work in modern Blender.  You can also SHIFT+Click multiple files to do multiple selection, but this gets tedious when you have hundreds of them.  Unfortunately CTRL + A doesn’t work…

 

Thankfully Blender is extremely scriptable, so let’s turn to Python for a solution.  The following script will import a directory full of OBJ files into the current scene.

import bpy
import os

def fileList(path): 
    for dirpath, dirnames, filenames in os.walk(path):
        for filename in filenames:
            yield os.path.join(dirpath, filename)

for f in fileList("C:\\file\\path\\here\\"):
    if f.lower().endswith(".obj"):
        bpy.ops.import_scene.obj(f)


Be sure to change the path to your directory and if on Mac OS or Linux, to change the path format /to/this/style. Otherwise this script will chug away importing the OBJ files for you. Hopefully at some point Blender gives you the ability to select all while importing and the need for this script goes away completely.

Art, Programming , ,

Month List

Popular Comments