About this blog
but he always comes back.
Entries in this blog
I've created a simple semi-flexible class to manage indexed geometry buffers. It allows the client to choose between hardware buffers or local buffers which it manages and defaults to when hardware buffers aren't available. This is all new to me having been in DirectX world for so long. Hardware buffers are not mapped to local pointers rather I opted to force the client to keep a local copy. I did this because from what I can tell it will be a faster solution. To keep things simple the class enforces vertex attribute order. Attributes available are vert, color, uv, normal, tangent, and bi tangent which are interleaved into the vertex buffer. It is able to pass these vertex attributes to shader programs though this is as yet untested. Index buffers are made of 16 bit indices.
Next up I'll create an .OBJ loader that takes an initialized IGB as a parameter with storage offsets.
To please those of you who belong to the cult of gameplay and/or are easily fascinated with bright pixels, I bring you a brief description of an old game I created named KaBa. It is important to take a look at KaBa as it is the foundation for the game I am currently building - Path of War.
KaBa was developed for the PocketPC. I never had any intention to sell it or profit from it, I just wanted something to play whilst I took bathroom breaks. Of course that's not entirely true... Unless you think me the sort of person who takes a 2 player bathroom break. Which I am not.
Ka and Ba are two Egyptian words with some esoteric meaning I am too rational to understand. The two characters in KaBa are none other than Anubis and Ra (not the ones from Stargate SG-1). Anubis and Ra are upset at each other and decide to have a fight to see just who's more upset at the other.
Elements on the screen include two opponents, a cursor, an action button, and 4 actions to take. The cursor moves from left to right under each possible action. When a player presses the action button the cursor stops. The action the cursor is underneath can now be taken by the player. To decide who goes first, one player presses the action button and the player closest to the stopped cursor goes first.
Each player has a max of 15 Health points and 1 Power point to start. Each action will now be described below.
Power Up - The player increases their power points by 2.
Magic - A player may cast spells which require and use up a given amount of power points.
Pass - Do nothing, skip turn.
Heal - 2 pp, Increases health between 2-4 points.
Lightning - 3 pp, Attack opponent with 3-5 damage.
Shield - 3 pp, Absorb an attack from opponent.
Cage - 4 pp, Freeze your opponent for 2 turns.
Shining Sun - 6 pp, Mega attack causes 5-9 damage and cut-scene.
Summon - A player can summon one of the four elements or power up 1 power point. Each element gives special powers to the player. An element can only be held by one player at a time. If an element is summoned while the other player holds it, then it is stolen from the opponent.
Fire - 50% Chance to heal 1 health point per turn.
Water - 50% Chance to power up 1 power point per turn.
Air - Maximize all attacks.
Earth - 50% Chance opponents attack will be blocked.
Attack - The player attacks the opponent with 1-4 damage. Attack requires but does not use up 1 power point.
Players take turns until one player's health points are
Here are some images of the game in action.
Path of War will share certain gameplay elements with KaBa. I will be increasing the number of things to be summoned, spells, attacks, etc. Also I'll be adding levels and experience into the mix. 3D scenes and characters will replace the temple and gods. Network play is a must with this game. Tournaments should be an option as well as team battles.
I'll continue to work on Path of War, though it might be some time before I make another gameplay journal entry. I know this is sad to some of you who feel engine tinkering is a waste of time, but it's fun. And, for me, having fun is what making a game is all about.
I'm using OpenGL to push the pixels around. Enter GLUT. I've never used it before but it seems to be an easy way to get an app window and drawing surface on a lot of platforms. I've integrated it into my engine lib (dll on win32 and shared object on ubuntu). I'm happy to say the whole thing is compiling and linking on both platforms. Here are screen dumps of my test app running on both systems.
I need an x-platform image loading library that works well with OpenGL (any suggestions?). I was thinking of Devil.
The Path of War engine is coming together. It is built to compile on x-platform. Which means that a lot of operations are abstracted to allow different implementations depending on the target machine. It is so far compiling without problem on windows x86 and linux(ubuntu) x86. Mostly there are only math objects and functions in the engine. I've built a couple of debug trace functions and a RNG as well. Below is a list of math objects currently in place:
Most of the work was pulled from an existing x-platform project I've developed (and not talked about MUAHAHAHAHA) during the past year. So it was very little work to get the POW engine this far. The rendering engine is a dynamic library (dll, so) so all tools and programs don't get bloated with a static lib.
I've received my prize pack from John Hattan. It's a bunch of crap he pushed off on me for drawing a logo. Remember? The contest none of you participated in? Suckers! There were some good finds in the box, a movie about the atomic bomb narrated by Shatner (gotta find a VCR to watch it), some rocky & bullwinkle episodes, and the best is a wooden castle model which I'll be blowing up with firecrackers at the start of July.
I've been browsing around for some cheep, already rigged, 3d characters to use during early development and have come across a couple on TurboSquid by Kvakling. Leaning towards one of the skeletons. It's 10 bucks and rigged in Max.
I'm going to start crafting some 3d models of different sided die which will be used in the ui.
Shame on me! In the entire 3 years of keeping a "Game Dev" journal I haven't documented the development of a single game. The games I did make were before I started keeping a blog.
Of the three games I've made there is only one that I play often. It is a Pocket PC game called Ka Ba. Ka Ba is a turn based combat game between Anubis and Ra. It's simple to play and random enough so that every game is unique. I'm going to create a version of this game for the desktop environment. It will be called...
Path of WarTM
Anubis and Ra probably won't be in it and I'm hoping to have a larger number of characters and classes. Also I'd like to add group battles and network play.
I want the game to be platform independent. I'll be testing with Windows and Ubuntu (I don't own a Mac.. yet). I'll be writing some small rendering code first then I'll get to work on a series of editors. Of course I've already started on the design doc and I'll be constructing a physical board version played with dice. I did this during Ka Ba development and it really helped smooth out the gameplay.
It is my goal to post every couple of days with an update. I will be following through on this project. Stay tuned.
Here is a link to a function which converts a Magick::Image to a HBITMAP. I figure it'll be useful to anyone trying to get Magick++ Images working in MFC.
Here is the basic usage of the function:
// Get a pointer to the image control and resize it to 200 x 200
CWnd* pImageControl = m_MFCImage_Control.GetWindow(0);
// Read in the Magick::Image file and resize it to the same size as the MFCImage
// Convert it and set it
m_Bitmap = CreateBitmapFromMagick(m_MFCImage_Control.GetDC()->m_hDC, m_Image);
// Don't forget to delete the HBITMAP when you're done using DeleteObject(m_Bitmap);
I couldn't let it go. I'm usually in bed by now but I couldn't get this nagging problem out of my mind.
My previous solution was way too complicated. And no it turns out I WAS missing vertices. So I added those, reconfigured the face maker thingy, then calculated u coord like so (1.0f/slices * current_slice) * u_tile; The v was something like ((current_z - low_z) / (high_z - low_z)) * v_tile;
My normal calculations aren't yet taking the new verts into consideration so there is a hard shaded line down the side. I think I can sleep with that one though. [smile]
I'm building a class that dynamically generates a 3d cone. It has functions for computing normals, tangents, etc. I've gotten to texture coordinates and have decided to use a cylindrical mapping algorithm because the general structure of the cone will eventually be modified using noise functions.
Here is my first attempt in OpenGL. It's ugly, but I thought I'd post it to show progress. u,v coordinates are calculated per vertex and I think I'm missing vertices. I guess I wasn't thinking about texturing when I created the geometry. So much for having an optimal cone structure. [rolleyes]
I'm just sitting here looking at this. I'm pretty sure I DID generate enough vertices. There must be something wrong with my cylindrical mapping alg. Oh well, I'll get back to it tomorrow.
I figure I should talk a bit about the book I won here at GameDev call The Daemon. I victoriously conquered many HAIKU masters and was awarded a free copy of this book as part of a promotion the publisher had worked up with GameDev.
First you should read the reviews John Hattan and his wife wrote on GameDev.
I finished the book in a couple of days. There was a point when I couldn't put it down. Something about this book just pulled me in. If your a tech bloke or a "gamer" then you'll probably like this book. It's easy to read and nearly believable. A warning though, there will be another book. My wife just finished it and now she's walking around with that hungry look in her eyes as though she's hearing an eternal diminished 7th chord. No resolution man!
The book has some captivating things to say about our world and I'm quite interested to see where the author takes it. Maybe I'll figure out which side I'm rooting for.
Yesterday, I left the confines of my manufactured womb to see Henry Rollins. I don't get out much and I pretty much selected to go see this guy at random.
Knowing little about Mr. Rollins, my wife and I sat down to a three hour rant. We loved it. That guy is funny, and his Christopher Walken impression made life worth living for a little while longer. His plan for global jihad against humans using carnivores dropped from planes was a refreshing perspective as well.
I noticed a strange phenomenon occurring as I looked at him. There were sometimes 3 or 4 of him on stage. At times there seemed to be a beam of light coming out of the top of his head. So... yeah... I'm pretty sure I need glasses... or he's an incarnation of Brahma. Take your pick.
I can kill a yak with mind bullets from 50 miles.
I've been reading the book "Cross-Platform Game Programming" and have decided that anything I build from here on out should be system and future friendly. Just the first couple of chapters contain enough information to move me towards this goal. Most of the book is intended for building a complete game engine and so it goes into great detail about memory, cpu, audio, etc. Since I'm more into building libraries at the moment I'm sure I won't use half of what's in this book but it does give perspective of where my libraries will fit into the overall scheme of cross platform engines, or any engine. In short... Abstract the hell out of it. So far I have a basic vector class compiling on my win32 and lin32 boxes.
After reading an article of vertex tangent and bi-tangent calculations by Eric Lengyel I decided to dive in and read some more of his work. So I've placed an order for his book "Mathematics for 3D Game Programming and Computer Graphics". I look forward to reading about curves and culling techniques. Just looking at the table of contents tells me this book is going to stay on my desk.
I guess I'm just been fiddling around with 3D basics at the moment. Earlier in the week I was able to generate a cone / cylinder object - sometimes a cone and other times a cylinder when top radius > 0. Then I coded normal generation and later this weekend or early next week I'll start writing algorithms to generate texture coordinates using projective cylinder and projective box methods. It just feels so good for my mind to be working on these kinds of problems again.
I've been sick for the last few weeks. To be more specific, I started getting sick right after my last post. It has not been fun. I've been to the doctors a couple of times now, just gave blood this morning, and have another appointment next week. Not sure what's going on yet.
I never got to use my telescope over the holiday due to weather and a meltdown of my power supply. Strange thing just began to melt the plastic after switching it on. I'd never used it before so it may have been wired wrong from the start. At least my father in law and son got to enjoy looking at folks on the other side of the lake. *shakes head*
I'll post something more interesting next time.
Here it is, a tiny flash rss reader which uses a php script to process rss xml.
It uses lastRSS to process the rss feeds which is nice because it allows server side caching. I made this for anyone to use and have included the source code which you can download below. I made this mostly as an exercise in flash (actionscript) but I'm hoping someone will make use of it. I forgot to mention it supports multiple feeds and allows the user to switch through them seamlessly.
You can view an example flash object using my blog's RSS feed here.
Download : Tiny Flash RSS Source
In flash related news, I'll be moving the way of the flyman soon and start making a flash game. Something fun and simple. You know... for kids.
I'm looking forward to the long weekend here in the states. I've got my telescope unpacked and will be heading out to the countryside to see if I can spot some galaxies. My scope is one of those fancy Celestrons (no it doesn't have GPS) so all I need to do is calibrate it and send it on its way. There's nothing like looking up.
My server box arrived last week in one piece. I added the graphics card, installed a linux compatible network adapter, and plugged it in.
I'm using a KVM switch so I need only press a few keys and I can switch back and forth from my two machines. This is new for me. In the past I had used a manual analog switch box to share monitors with my PS2Linux box. This is definitely a lot nicer.
So I spent a good portion of the week learning about setting up an apache server. Ubuntu Server comes with an option to install the LAMP automatically but I opted to do it myself. I first installed OpenSSH so I could use putty to create an ssh session from my windows box. Then I installed and configured the mysql database. Apache and PHP were easy enough to install. I did have a few problems getting PHP mail() to work properly with my SMTP server. I think this has a lot to do with me not being an actual domain since according to the mail log the receiving servers were just letting the mail time out. Anyway I fixed that by using my ISP's SMTP server to send mail. No big deal. One of the last things I had to setup was memcached for PHP. This took a little bit of messing around to get PHP to recognize it but once I figured out to put a reference to the extension in the php.ini file and restarted apache everything started working great. Also I'm using proftp to jail in my user ftp sessions. I have decided to not install a web based control panel such as ISPConfig since I would rather learn how to do everything with the shell.
Below you can see a screen of the services running at startup using netstat -tap. Just for proof that I didn't make the whole thing up.
I feel I am in danger of becoming the 3rd guy in " target="_blank">this video...
Recently I have deemed it necessary to setup my own LAMP (linux, apache, mysql, and php) server for development. I've ordered a simple barebones computer with a gig of ram a fast Intel chip and a lot of hard drive space. The board has an AGP slot so I'll probably push my old nVidia 5200 in there... uhmm because every server needs sub par 3D graphics. I'll post a picture of it once it gets here.
The OS I'll be using is Ubuntu Server. I won't be using the default LAMP install option as I want to install and configure each element of LAMP myself. Did I mention that I've never done this before? Luckily I have a decent tutorial to follow:
The main reason for setting up my own server has everything to do with programming for updated php 5 and mysql. My current shared hosting still uses php 4 and an older sql server. I'll be doing some work on an updated VPS later this year and I'd like my code to run smooth from the start. Also this will give me some experience with operating the VPS.
The computer should arrive early next week. I've also ordered a Belkin KVM switch so I can share devices as well as audio.
I'm moving on with my Poker AI experiment. My initial entry can be found here if you'd like to catch up. It's been a while since I've looked at this code so this entry will mostly be to help me refresh and get some direction. As I've said, a poker hand is made of 4 16 bit words. Each 16 bit word represents the potential cards in a suit. This uses 13 of the 16 bits. Hand types are seen below:
0 = High Card
1 = Pair
2 = Two Pair
3 = Set
4 = Straight
5 = Flush
6 = Full House
7 = Quads
8 = Straight Flush
I've created a function to calculate a 32 bit comparable value called the hand value. A straight flush looks like 0x00890000 in hex. Where 8 is the hand type and the rank(9) = Jack high. So we have a Jack high straight flush, not bad. The remaining ranks are not needed in this particular value as any Jack high straight flush will equate with another, thus a chopped pot.
The next step according to West (Game Developer Nov,2005) is to calculate the hand strength, a percentage value of winning, using the following algorithm:
Create a pack of cards
Set score to 0
Remove the known cards (community and hole cards)
Loop a few thousand times
Shuffle the remaining deck
Deal opponent's hole cards and the remaining community cards
Evaluate all hands (using hand values) and see who has the best hand
If agent has best hand
Increment score by 1/number of people with same value
Hand Strength = score/number of loops
So this is my next step. I'm thinking that other useful data could be found using this function as well. For instance we could track the number of times we make a particular hand type and form useful probability scores from this.
I'm trying to stay motivated on gamedev. It has always been a rewarding part of my life and I'd like to keep it. I'll be forcing myself to make posts, even if it's just to say blah, in an effort to keep on truckn.
It would be useful if the gamedev journals allowed categories.
It's been a fast year so far. I've done little game or graphics programming yet. I have built a lot of web applications. Two things I should mention. One is that I turned 30 a couple of weeks ago. I guess that's not that big of a deal to me. The second is that I killed my personal website. Rather than re-explain my decision to do this, I'll just post the contents of the about page. The new version, www.neilkemp.us, is a word press blog but I won't be posting about my sister's dogs or my aunts crusty feet, etc. Instead I'll be posting tutorials and programming insights if I have any. For starters I've just uploaded my first tutorial, it shows how to convert 3D models to vector art using Max and Illustrator. It might be useful to someone.
Playing with shaders again. Here you can see fur applied to the standard noaktree troll (green monkey) model. The first frame is of the naked monkey, next you can see the fur applied with a medium density and several layers, finally the same fur is applied with self shadowing enabled.
Using OGRE has been a recent distraction of mine. It would be nice if these techniques could be applied to dynamic OGRE models. Basic forces are desirable for added realism and will need to take into account the various rotation matrices of the animated skeleton so that when, for example, an arm is waved only relevant fur layers move. Fur is angled according to normals fed to the shader so conceivably a second "combed" set of normals could be crafted to generate a more groomed appeal. Normals could be shaped in Max with a combing script. Perhaps a stand-alone fur editor might be the better, more accessible, route for average users. The final shader could be written in Cg so that this effect is available to both GL and DX users.
The images you see below are rendered in a simple DirectX application using a static mesh. The fur is angled according to the model normals. Fur color is defined by the diffuse texture.
So anyway, that's one of my goals for 2007. Another unrelated goal is to achieve the full lotus position. Wish me luck. Happy new year to people of the Gregorian calendar.
I can't really talk about stuff I've been programming. I did make this cool skateboard model though. Haven't finished the golf course yet, I just don't like doing levels so much.
Well as of yesterday my wife and I have made it 5 years!! It makes sense once you realize her profession involves the education of children. [smile]
I've implemented the function which calculates the value of each hand in my poker AI. I had mentioned that I would keep the type of hand and the hand values separate but this is illogical since the hand value contains the type. Now I can easily compare two or more hands and determine the winner. The hand value also takes into consideration split pots, etc. Now I will need to build a simulator to determine the hand strength. This is basically playing the hand thousands of time to get the number of times it will win then creating a percentage value. I will start with a simple simulation class that treats every player the same then expand at a later time to get more accurate results.
This is a golf course I'm working on. There are no trees and plants yet because I've been going back and forth on how to create them. I could take the speedtree approach and create low poly trunks with many billboarded leaf quads. This would work fine in max but I think it would be harder for a customer to integrate into their RT engine. I've been busy taking leaf and trunk photos and am considering using speedtree to build some kick ass textures using my photos which I could then use to make some low poly trees. We'll see how this hybrid approach plays out in the next couple of days. I'll post some renderings to get feedback once I've got some built. To speed things up I'm going to randomize trunks using a series of modifiers or perhaps write a maxscript to do so.
As I continue with the demon game, I'm instantly back doing what I don't want to talk about in my journal, artwork. So screw it, I'll keep working on that and talk about something else until I get to the nuts and bolts of the game play.
I've been a poker player for a few years. I don't usually play "live" games where money is involved as I'm not the gambling type. I've only played a scratch-off lottery card once and that was on my 18th birthday. I do however play online for fake cash (points) and with friends for bragging rights. It's a fascinating game that you can improve at. I've managed to keep my fake chip stack above 200 K for a while whereas I used to be a more volatile player. I've wondered for a while now if I could create a winning poker agent based on what I've learned at the table and what I know about machines.
Poker is a game with a lot of unknowns and depends more on probability, your read of a player (profiling), and luck (chance). Given everyone has the same amount of luck over a long period of time, the players with the best math skills and "reads" will have the larger stack in the long run. So we don't have to program how to deal with luck just now. But later we can add stack protection to limit the agent's losses due to bad luck.
My initial approach to building a poker agent will be based on Mick West's article Texas Hold'em AI. Some people still call it Texas Hold'em but the more general term for it is No-Limit Hold'em. I'm not from Texas so I'll go with the latter. Mick gives a method for creating a simple implementation based on what he learned while working on the World Series of Poker game. Later I'll be using what I learned with G.A. and N.N. to spawn multiple species of smart agents each with unique styles of playing.
I've begun by defining my data types for suit, rank, cards, hand, and hand type. I've created a struct of 4 16bit words to hold a single hand of poker. Each of the 4 words represents a suit (numbered 0-3) of clubs, diamonds, hearts, and spades. There are 13 ranks in each suit (0=2 and 12=A). We can represent that a card is in a hand by setting the correct bit in the proper suit. I've created a function to set the proper bits given a number representing the card (numbered 0-52). The card = suit*13+rank, suit=card/13, and rank=card%13. There are nine hand types in poker. 0:no pair, 1:pair, 2:two pair, 3:set, 4:straight, 5:flush, 6:full house, 7:quads, and 8:straight flush.
My next step was to build a function to return a hand type of a given hand. The agent will need to know where it stands given its hole cards and the community cards. Mick combined this into a function for creating hand values, discussed later, but I've decided to separate the two as they really do different things. The hand type function is a lot of comparisons and table lookups. Limiting the number of cards in a player's hand allows me to make certain logical assumptions. An example of this is if there are 5 cards in a given suit then the hand type is a flush and it can then check for a possible straight flush. Of course no flush check is necessary unless there are at least 5 cards in the hand. The whole function continues on like this and is a prime target for optimization. Yay!
That's as far as I've gotten so far. Next I'll need to create comparable hand values from the hand types so the agent knows who won and who lost. You can see a print out of hand values and hands below.
Also I've posted some new photos on my site, including one of me flying this neeto toy my son got last Christmas.
YESSS! I'm number one at something!
I've just updated my DirectX SDK from the August (2005) to August (2006). It only took me a year but wow did the size of the sdk bloat or what!? There are a few things I've never looked at before in the tools section, plus it looks like Pix has been improved. I'll start going over the docs in my spare time. This way I can participate in the DirectX forum again and I'll know wtf Jack is talking about in his journal.
I've joined the GameDev.Net Seti@Home team. I've got two of my machines crunching space data mostly at night time. Man DecipherOne and vertex have a lot of points.
Also I've been reviewing the C4 engine for use in my upcoming demon game. I like what I see so far but it is missing some things I'll need and have become accustomed to working with. Blending animations is the big miss. Also multiple materials, scriptable shaders, and a rigid body physics system are all currently missing. According to their forums all of these issues are on the table and are soon to be implemented. I was planning to use OGRE but it just isn't the all-in-one solution I'm hoping to work with on this project. C4 has support for PC and Mac, networking, 3D sound, input, and great graphics. I'm a little worried about the fact that it uses only OpenGL for rendering. I have more experience with DirectX but they basically do the same thing. It's kind of funny that while everyone seems to be migrating to C# and DirectX for 360, I'm thinking of taking the backdoor to OpenGL.
Have a good weekend.