Friday, November 14, 2008
#
Recently I've begun programming a new game I'm trying to keep under wraps a bit, although most close friends know what it's about already. Although the game is quite new I'm already excited about the code.
In PongRPG, every sprite you see is positioned in code, there are lines that load each sprite personally and set them based on values in the code. So, if I wanted to change the position of some item on the pause menu, I'd have to go into the code, track down that line, and change the value. Not only that, but for each menu, I used a swapping method. For every menu item there were two sprites, one displaying the non-active item, and one as the 'highlighted' version of the item. When the user's mouse hovered within the sprite bounds, the non-active sprite would hide and the highlighted version would pop up. This required the code to load 2 seperate sprites for each menu item, which in turn had multiple lines of code that statically set their position.
So how is the new code any different? First off, I changed the way sprites are loaded. Specifically for this style of game, it's more 'level-based' whereas Pong was really just repeated instances of the same level (as are most puzzle games), I use a definition file created as an XML file to load each level. This way, I can create all my stuff in the XML and not have to change the code to load the items in. This allows me to load and set properties like position without ever having lines of code specific to any certain sprite. Also, the code will only load one instance of each sprite even if there are multiple uses for that sprite and I can continue to reference that sprite.
I've also heavily modified the way menus are created compared to Pong. A big problem with Pong was if I wanted to ever port it to Xbox it would be quite a decent amount of work to create a cursor or implement a focus style menu. I liked the idea of the focus style menu where each menu item has a focus and you can scroll through the items in the menu (similar to most all menus on the Xbox system). In the new code, I have XML documents defining each menu, specifically each menu item including their position, and other menu information like the style of the menu.
There are loads of other changes but those are the ones that really stick out from Pong. What really gets me excited is that I've designed code that is putting more and more of the game creation in the hands of the designers and content creators. Yes, the menus still need code behind them to do specific actions, but I can have someone working on designing a menu and simply send me the menu sprites and the XML and I can load it in without writing any positioning or layout code. Same goes for anyone designing Levels.
If I remember or get time, I'm planning on posting some code tutorials about the XML loading in XNA or some of the techniques I've described above.
Friday, November 07, 2008
#
Tomorrow is the first ever Chippewa Valley Code Camp in Eau Clare, WI. I'll be heading there to check out some awesome talks and am totally excited. Although registration is closed, you can find out more details about it and future CVCC's at:
Chippewa Valley Code Camp
P.S. Thanks To Chris Williams for the CVCC img :)
Tuesday, October 21, 2008
#
I've been struggling with this for probably the better part of a year and I feel it needs a bit of documentation. The problem is that in my past demos I needed all my model and texture files in the same location as the EXE because I didn't know how to read from a different directory. When loading something like a model, what you first do is store the current directory the computer is looking in (which is the base EXE directory). Then you can switch the directory (locally) and read that in. Then, when finished loading and doing whatever else you need, you can reset the directory to the original directory. Here's a code snippet used to store the current directory and set it to a subfolder:
TCHAR Buffer[MAX_PATH];
GetCurrentDirectory(MAX_PATH, Buffer);
std::string sData = "data";
SetCurrentDirectory(sData.c_str());
Now you can repeat the SetCurrentDirectory() call for any other sub folder you need to go into. In this case it goes into a subfolder named 'data'. Then after you're done doing whatever you need to do (load models, create files, etc...), you can call the following to restore to the directory you stored in Buffer:
SetCurrentDirectory(Buffer);
Monday, October 13, 2008
#
You can find the presentation for my TCCC HLSL talk below:
http://www.insidegamer.org/documents/Lights%20with%20HLSL.ppt
You can also find the code below:
http://www.insidegamer.org/documents/TCCCCode.zip
You will need DirectX 9.0c and may need the SDK which you can find on Microsoft's website. Also, before running the .EXE you can change the values at the top of the lightingshader.fx file to see changes in the demo.
So whats new with me? Well, currently I have a program due in class in one week so I need to build a function reader that can take in an inputted function and seperate it. Other than that I'm also working on learning WPF, which surprisingly seems easier since the last time I tried it. End quick update.
Saturday, October 11, 2008
#
Sitting here at TCCC I decided, why not blog it up for a few minutes? I had my presentation this morning and it was OK, I should have the slides and other info up in the next week for anyone interested.
So far I've listen to talks about BizTalk and XNA (both by fellow GWB's). Next is Silverlight followed by some ASP .Net stuff.
I might have to stop going to Chris's XNA talks, I always want to start creating games after seeing them!
Tuesday, October 07, 2008
#
Thursday, October 02, 2008
#
I won something for the month of September from Community-Credit! What glorious booty did I run off with? Feast your eyes...
Tuesday, September 23, 2008
#
I finally got around to posting up the actual TCLUG presentation on my site so you can find that at the link in the previous post or at my site.
Between school and just generally doing other stuff at school (clubs, meetings) I've had little to no time to update this blog which I hope to fix. I need to get back into more programming which will help me want to post more updates.
I don't know if I mentioned this, but I totally messed up the code to Pong RPG and can't release any updated versions until it's fixed. I'm looking at how to fix it but it'll take me a few hours at the least. Hopefully I can get it to a stable point where I can release a 'less-buggy' version of it soon.
In other news, I joined the Gym at school here and have started a fit blog for myself just to keep track of the progress. Oh how I love the internets, all of them.
Saturday, September 13, 2008
#
Thanks to everyone who came out to the Twin Cities Languages User Group meeting the other night to see my talk on HLSL. I promised I'd post the links to the powerpoint and the code.
PowerPoint
CODE
NOTES: The Powerpoint is a version of an older one that I will hopefully update in the next few days, the link will stay the same though. Also, that code is the full code of the demo I wrote so if you're only looking for the code I presented at the group, focus your attention on
Graphics.cpp and
lightingshader.fx.