Friday, July 19, 2013

Game Programming and 2d Art, Part 3 (Texture Atlases)

Welcome to the final part of my series on game programming with 2d art assets!

The previous 2 entries are here:
Part 1
Part 2

If you don't know already, a texture atlas (also known as a spritesheet) helps game developers to display neat 2d graphics in to their games.  There is usually some sort of organization sanity happening with them as well, for example, all of the frames of animation for a player character would be in one atlas and its file name could be "herowalking.png" or something like that.

Of course, this isn't limited in any way, I've often used atlases that are just a collection of User Interface components usually in a file called "gui.png" -- it has all the buttons, graphs, meters, check marks, and all sorts of doodads, all conveniently packed in to one GUI atlas file.

At any rate, assembling a texture atlas can be extremely tedious.  You have to make sure nothing overlaps anything else, that all your texture objects can fit, you will even need to remember where you put each object so that a game engine can subsequently extract each object.  It is so much planning and tracking!

Thankfully, there is a program out there called Texture Packer.  It is a commercial product, but all in all, it's a nice, convenient tool to have in your tool belt.  I'll even go so far to say that if you make 2d games commercially, you probably shouldn't be without it!  It's reasonably priced as well for how much time and money it would save you.

Let's put it this way, I spent about 2 weeks making a command line program to extract texture sizes and coordinates and it was a pain to deal with.  On top of that, I was still relying on manually entering texture coordinates in to our games from that program's output.  If an artist changed any graphics, it would be a nightmare changing things all over the place.

This program keeps track of all that stuff, and allows you to output all that relevant information in to various game engine formats; or for us, even a generic XML data format!

Below is a screencap of what it looks like:





Honestly, it's pretty good.  There are a couple of features that would be nice to have; like manually being able to move texture objects around (or swap places with each other), but what the tool does is automatically find a place for your sprites in the empty atlas for you, so you don't have to sit around with a magnifying glass lining pixels up manually!

There are quite a few neat features as well about it, like automatically generating different scaled versions of your atlas (click AutoSD) for catering to different resolutions, being able to specify atlas geometry (like powers of two, max width/height, etc), and it can even import SVG files.

It takes a little while getting use to, but all in all, it's a pretty useful tool and saves us quite a bit of time dealing with artwork.

I have noticed that the windows and linux ports are a little behind the mac port, and again, it is missing a couple neat features, but all in all, it is useable and useful.

They offer a trial version of the program also, so you can check it out without having to buy it first.

Friday, July 12, 2013

Help, Windows Update is Missing in Control Panel!

Though our focus is on game development and things like this, I occasionally take on the role of IT support for friends and family.  After battling with a nasty collection of virii on a family members computer, I realized that Windows Update on their win7 system was gone from control panel!

Long story short, it, as well as the Background Intelligent Transfer Service (BITS) was just gone.

Naturally, I send systems home after a windows update to get the latest and greatest updates installed, so this had to be solved.

Googling around showed me a couple suggestions, some showing I needed to reinstall the operating system (or at least do a repair).  SFC /scannow didn't fix anything either.  I thought, that's dumb, why can't I manually add this stuff back in.

Well, we can!

Our happy command to do such is called "sc".

Before I get too far in to this, windows update DEPENDS on BITS to be running, and started to operate correctly (forcing an update while BITS is unavailable or not started will freeze your system pretty hard indefinitely).

For me, both "Windows Update" and "Background Intelligent Transfer Service" was missing from services.msc!  So, first order is to get BITS back and working.

The command on an admin command prompt (yes, those are SPACES AFTER THE EQUAL SIGNS):

sc create BITS type= share start= delayed-auto binPath= "C:\Windows\System32\svchost.exe -k netsvcs" tag= no DisplayName= "Background Intelligent Transfer Service"

Should create BITS in the services registry, but wait, we're not done yet.  BITS has some dependencies that should be added!

sc config BITS depend= RpcSs/EventSystem

This will add the dependencies for BITS.

Unfortunately for me, one of the viruses really messed up the registry settings for this service as well, so here is a "good" version of the part of the registry I had to import from a functioning WINDOWS 7 system as well.

bits.reg

Ok, with that done, I could get back to adding Windows Update again!

The same idea applied to this:

sc create wuauserv type= share start= delayed-auto binPath= "C:\Windows\System32\svchost.exe -k netsvcs" tag= no DisplayName= "Windows Update"

and again, to add the dependency...

sc config wuauserv depend= RpcSs

Both BITS and Windows Update should now be in the services window now and you SHOULD be able further configure them.

If you get access denied errors make sure you ran the command prompt as an administrator.

If you still get access denied, then you probably have malware and/or a bad virus problem.  You may have to resort to safe mode, run virus scans, possibly do recovery console stuff, etc.

Personally, I ran CCleaner, AVG anti-virus, then Malware Bytes Antimalware, mostly in safe mode, and that cleaned up the problems on this system.