by date
Recent Stuph
Recent Stuph
| Name: | Brett Fattori | ![]() |
|---|---|---|
| Date Posted: | Feb 18, 2007 | |
| Rating: | 4.0 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Brett Fattori |
Blog post
Hey all, I know, long time no talk. Well, I'm getting back into things and it's going slowly. I've been spending time, lately, doing little odds and ends to keep myself busy. I've found that the best way to get back into game dev, is to just do it. Last week, I spent about 5 days writing Asteroids in Javascript using the canvas element and some code that was developed at my work. We don't do games dev at work (unfortunately) but we do do a lot of work with Javascript. We're an e-commerce development house that has done work for clients like Godiva Chocolatiers, Kmart, The Home Depot, Eddie Bauer, and more. My work with Javascript has given me a whole new appreciation (and at times, hatred) of the language.
Ok, back to games dev... I wrote Asteroids in JS in about 5 days. It uses the canvas element as it's rendering context and looks pretty accurate. I had to write some code to do vector letters and numbers, and it took some time to understand what exactly could be done. In the end, I received a lot of feedback (positive and encouraging, mainly because people at work see me as some sort of Javascript oddity) and it'll be something I post somewhere in the future. It will also probably show up as an easter-egg in one of our "products". I'm in product development, so I don't worry as much about client issues and such -- throwing in an easter-egg is just my way of saying "Hi!"
I dropped by IRC a few days ago and have started chatting again with Tom Bampton. He's a great chap, and I've forgotten how much I enjoy talking to him. Paul Dana is there too, and some people whom I don't recognize, but then again -- it's a chat room where devs can just shoot the breeze. It's been fun catching up and seeing what's developed in my two year hiatus.
I also, recently, built a simple poker game with TGB Pro. Man how it's changed since I used it to build CashCow for a GID. It's easy to use and hard in other ways. Getting to know it has been a love/hate relationship. I still have a long way to go with the game, but it might end up being another TGB title at some point.
It was interesting because the overall game setup was like 5 hours to make cards, 1 hour to set up an interface, and 4 days (and still going) to determine what hand I have. The game is simply about chosing the best cards to keep in your hand, and discarding the rest. I got the idea from a touch-screen bar game a friend and I like to play. You're dealt 5 cards and it tells you what you have. You then decide which cards to keep and which to pass on, and then deal up some new cards. If you chose wisely, you'll get a nicer hand and get a good score for that hand. The kicker is that there are 4 jokers in the deck, which can be any card. So, your chances of getting a better hand are always there -- in addition to 5 of a kind which isn't usually possible.
I thought the logic for it would be simple. I refactored many times because I was so very wrong. Little things that make so much sense to you and I regarding what is a flush and a straight are so much more complicated when in code. I tried calculating based on card values, using bitfields to represent cards in my hand, and more odd ways of doing things. Eventually, it just ended up being a quick sort of the cards and then a gaggle of conditional logic. It works nicely, but it still has an issue with flushes versus other hands. The flush, which seems so simple to calculate, becomes a problem because of how it ranks amongst other hands. Since a full house beats a flush, it ends up making some of the logic a little more difficult.
Anyways, the goal of all of this is to make a solid card game "engine" that I can re-use. The final product will be a game which plays all types of poker, and hopefully some new ideas too. My ultimate goal would be to put this on a touchscreen system (of my own building) and put in at my bar in my basement for parties and such.
Well, I just wanted to drop by and say hi to some old friends. Hopefully I can get reaquainted with some of you, and make some new friends. Until next time...
- Brett
Ok, back to games dev... I wrote Asteroids in JS in about 5 days. It uses the canvas element as it's rendering context and looks pretty accurate. I had to write some code to do vector letters and numbers, and it took some time to understand what exactly could be done. In the end, I received a lot of feedback (positive and encouraging, mainly because people at work see me as some sort of Javascript oddity) and it'll be something I post somewhere in the future. It will also probably show up as an easter-egg in one of our "products". I'm in product development, so I don't worry as much about client issues and such -- throwing in an easter-egg is just my way of saying "Hi!"
I dropped by IRC a few days ago and have started chatting again with Tom Bampton. He's a great chap, and I've forgotten how much I enjoy talking to him. Paul Dana is there too, and some people whom I don't recognize, but then again -- it's a chat room where devs can just shoot the breeze. It's been fun catching up and seeing what's developed in my two year hiatus.
I also, recently, built a simple poker game with TGB Pro. Man how it's changed since I used it to build CashCow for a GID. It's easy to use and hard in other ways. Getting to know it has been a love/hate relationship. I still have a long way to go with the game, but it might end up being another TGB title at some point.
It was interesting because the overall game setup was like 5 hours to make cards, 1 hour to set up an interface, and 4 days (and still going) to determine what hand I have. The game is simply about chosing the best cards to keep in your hand, and discarding the rest. I got the idea from a touch-screen bar game a friend and I like to play. You're dealt 5 cards and it tells you what you have. You then decide which cards to keep and which to pass on, and then deal up some new cards. If you chose wisely, you'll get a nicer hand and get a good score for that hand. The kicker is that there are 4 jokers in the deck, which can be any card. So, your chances of getting a better hand are always there -- in addition to 5 of a kind which isn't usually possible.
I thought the logic for it would be simple. I refactored many times because I was so very wrong. Little things that make so much sense to you and I regarding what is a flush and a straight are so much more complicated when in code. I tried calculating based on card values, using bitfields to represent cards in my hand, and more odd ways of doing things. Eventually, it just ended up being a quick sort of the cards and then a gaggle of conditional logic. It works nicely, but it still has an issue with flushes versus other hands. The flush, which seems so simple to calculate, becomes a problem because of how it ranks amongst other hands. Since a full house beats a flush, it ends up making some of the logic a little more difficult.
Anyways, the goal of all of this is to make a solid card game "engine" that I can re-use. The final product will be a game which plays all types of poker, and hopefully some new ideas too. My ultimate goal would be to put this on a touchscreen system (of my own building) and put in at my bar in my basement for parties and such.
Well, I just wanted to drop by and say hi to some old friends. Hopefully I can get reaquainted with some of you, and make some new friends. Until next time...
- Brett
Recent Blog Posts
| List: | 01/10/08 - A small hello 02/18/07 - Recent Stuph 03/03/06 - So long and so out of touch... 12/15/05 - Plan for Brett Fattori 11/01/05 - Plan for Brett Fattori 10/14/05 - Plan for Brett Fattori 09/29/05 - Plan for Brett Fattori 08/24/05 - Plan for Brett Fattori |
|---|
Submit your own resources!| Stefan Beffy Moises (Feb 18, 2007 at 09:29 GMT) |
| James Urquhart (Feb 18, 2007 at 10:57 GMT) Resource Rating: 5 |
Keep up the good work.
| Phil Carlisle (Feb 18, 2007 at 11:44 GMT) |
Interesting about the problems with the card hand thing. I hadnt really thought about how you would neatly codify a given hand. It need to codify the hand against different things doesnt it, like colour, value, suite etc.
I might even give it as an assignment to my students.
| Brett Fattori (Feb 18, 2007 at 17:24 GMT) |
@Stefan - dRacer is just waiting at the moment. It's been a long time since I touched the code, but I go back and play it occasionally. Joe and Clark have been so busy with GG that they don't have the time to work on dRacer right now. I don't fault them one bit, I'm glad that GG is doing so well and that they are too. I miss working with them regularly. Who knows, dRacer may come down off the shelf to be finished at some point.
@James - The canvas element is WAY underused. It is so simple to work with. I've actually thought of making a 2D games framework for it as a side project.
@Phil - That would make a great assignment. I swear I searched for a couple of hours for card hand algorithms and they are all just so speculative. No concrete examples, but all of them said something about sorting. It does make determining the hand a lot simpler when all of your aces, twos, kings, etc are together. The fun part was adding in jokers and how they change the dynamic.
| Tom Bampton (Feb 18, 2007 at 19:09 GMT) |
Glad you are back. I will of course have to kick your ass if you disappear for so long again ;)
Edit: Spot the deliberate mistake ...
Edited on Feb 18, 2007 19:10 GMT
| Neo Binedell (Feb 18, 2007 at 22:00 GMT) |
Royal Flush
Straight flush
Four of a kind
Full house
Flush
Straight
Three of a kind
Two pair
Pair (Jacks or Higher)
Any Pair
This suffices for most things, but there exists some very cool ways to encode your hands so that you can compare the encodings directly by value.
There was a nice article in Game Developer in Nov 2005, if you don't have access I can do a little write up about it to explain the basics. Come to think of it I might have some flash code that I wrote to test the ideas somewhere that deals 3 random hands and shows you the hand value and % of winning etc.
You must be a member and be logged in to either append comments or rate this resource.



4.0 out of 5


