Raymond Camden's Blog Rss

GameOne Released

47

Posted in Flex, ColdFusion | Posted on 04-22-2009 | 5,404 views

Ok, if you have been following me on Twitter, you know I've been working on a project involving BlazeDS, Flex, AIR, and ColdFusion. The game idea I had was pretty complex, so I thought it would make sense to start with a simple game, and focus on the technologies first. So with that in mind, I'm proud to announce the release of GameOne. Yes, I know, great name, eh? Well, I don't care how creative the name is, I'm just happy it works (mostly).

The game is basically a stock simulator. The stocks are fake and update every few minutes. When you buy/sell stocks, it is announced to all active players. You can chat as well. So for example:

So, it's late. I'm tired. And there is a lot I want to talk about this game, especially in regards to messaging and LCDS/BlazeDS+CF. (Seriously, why aren't people using it more?) But for now I figured I'd let folks download and play with it. I'll post the full source code (client+server side) later in the week. Enjoy. Oh, and for those of you who are competitive, you can view a dump of all users sorted by funds here: http://gameone.coldfusionjedi.com/

Comments

[Add Comment] [Subscribe to Comments]

I am particularly impressed with the UI for the ladder, awsome work.
Not to mention that the funds are not the true wealth of the user either, for example I have like $0.86 in funds but my true wealth is like a million times that...

And yeah love the UI have to say its the best;-)
I'm impressed! I hafto start to make a tutorial/manual about this=D
http://www.tutobook.com
UI is my middle name. ;

@Andrew: Um, consider it a ranking of liquid wealth then (I think that's what they call it ;).
*lol*

Btw I did sent you a tweet reply, but as you don't follow me you might not have seen it. I haven't tested your install badge on the blog post, but I was very annoyed that the check for Air was ignored and it downloaded it anyway. Just an FYI that this is a bug that you just may wish to fix, if you haven't already.

I might be wrong, liquid assets from my recall is your total assets on paper. Not 100% sure my meory serves me right there though.
I'm using the Badge install code that Aptana uses. To be honest, I don't know much about it. If you, or anyone, know a way around the 'whole air package' thing, please let me know.

Yeah, you are probably right on liquid. Meh, what do I know. ;) To be honest, this entire game was a learning exercise so I can work on the -real- game I have in mind.
Ray, just another FYI I did end up trying the install badge on your website and it worked fine. I think it might have just been the fact that I clicked on the twitter link that it had issues with.
I'm going to be addicted to this. Needs some small improvement though: show real-time value of stock owned.
@Joshua: I will be blogging on how the updates happen. Realtime is probably possible, but beyond my skills. (In fact, I'm 99% sure it IS possible w/ LCDS. I'm using BlazeDS though and I don't think I can. Also, 'non realtime' actually is a GOOD thing for my next application.)
@Ray It should be pretty easy to add another column to your display that just shows SHARES * CURRENTPRICE as they update? You should also think about adding the leader board into the app itself. Can't wait to see the source for this. Very cool idea!
Another col: Not a bad idea.

Leaderboard: I originally wanted it in game, but at 11PM last night I was exhausted. ;)
Some feedback. =)

After clicking on a stock, I head down and enter an amount of shares to buy/sell. However, you have to click on the up or down arrow to get the buy/sell button to enable.
@Ray - You know you have started something now don't you?

Maybe another sugestion over time is something to remember what price the stock was purchased for, so that they know how much money is potential going to be earned lost etc. And maybe a runtime worm, that shows the rise and fall of the select stocks as well.
@Bradley: Agreed. I was trying to be smart so that you couldn't hit the button till a value was there. I need to fix it.

@Andrew: The issue is that you can buy X shares of Y at Z, and Y shares of Y at Z-1. The UI to handle displaying all that would be a mess.
@Ray, doesn't need to be fancy, even a another column layout or something that updates with all the stock that has been purchased an for how much. Let the user work out the profit / loss margins.
fun game
Nitpicky - and prolly due to your lack of sleep - on the Registration page - "Pasword" should probably read "Password" instead. - Installed and setting up now.
@Sid: Oops.

@Andrew - Maybe so. Like a personal history.

To be clear, I don't plan on spending a lot of time on this. The entire app was meant as a training exercise and blogging fodder. But I'm taking all these comments to heart and will definitely remember them for the next app.

After my lunch meeting (and my food) I've got a minor update coming out to hit a few of the minor UI things.
Ray - Are you gonna release this on RIAFORGE? I'd like to tinker with it if ya do.
No, but I will absolutely be releasing the code. I'm planning 2 blog entries. One on front end - one on server side - and for each I'll release the code.
@Ray - Yeah, I am not sure what the values in the brackets reflect against the price. But let's say we add a column that has a summary of the value of the shares for that user, then when it is clicked on a new window or something opens that shows the history of stock sold and bought. I was originally thinking just stock currently held, but a history would be better. But a column needs to be there that shows my stock is worth number of stock x purchase price and summed over the different prices. Writing a sql script to do that should be second nature.
The value in () is the change since midnight.

I'm not currently saving any history. When you buy shares of X twice, I just have one row in the db for the total # of shares.

I'm not going to spend much more time on game mechanics as I'd rather move on to the 'real' game (but I'm definitely fixing the darn typo and the darn 'cant hit enter' bug).
Fun! Couple small suggestions. Though i get the feeling this app is just a test app not your new endeavor, so maybe no improvements needed. :-)

Show what price we bought the stocks at (in chat maybe)

Color code chat (real chatter vs alerts on buy/sell)
I released v1.005. Makes enter key work in most places. Chat is a LOT nicer now that I bold 'real' messages versus news.
Really neat. I can't wait to see the code.
For the dump of current cash holdings of each player, you should do marketvalue of the stocks they hold too. would be interesting to see.

Also, it needs more cowbell.
The app threw an error when trying to sell 1,000,000 shares from Xyrex a while ago.
Error selling 700,000 shares this time for around $145 each. Think that would've gone for 100+ million, so I probably just broke an integer somewhere. Shares were lost, but still fun. =)

http://orangexception.com/expose/images/random/Gam...

Then follow-up error selling 7000 shares. I think my share count was already reset to 0 on the database from the above error, but the client hadn't updated.

http://orangexception.com/expose/images/random/Gam...
Web App for High/Low tracking on the various stocks

http://www.thecomputerwizards.org/gameone/
And the hourly fluctuation chart here:

http://dev.socialcloudz.com/dev/gameone_chart.cfm
Sid's code makes use of the RSS feed I think I forgot to mention:

http://gameone.coldfusionjedi.com/feed.cfm
track your stocks now too!

http://dev.socialcloudz.com/dev/gameone_tracking.c...

this script uses a UUID in a cookie to keep tracking anonymous and per-user.. also makes sure other users can't tamper with your tracking.. ;)
Has this been hacked?

Number 1 player with

$2,487,445,097.52
I doubt it. It is a pretty simple simulation. Not too hard to grow your income quickly.
Nah, I played fair n square. Though, I did write a few tools to graph and track the progress based on the RSS feed. Once I got over to 10 million, it was real easy to make giant leaps off of very small fluctuations. At this point, with 2bil in the bank, I can make upwards of 500mil per transaction
Did some updating - more to come!

http://www.thecomputerwizards.org/gameone/
New error - buying stock - already had 2147450392 shares and was trying to buy another 55000000 - got this error.

---------------------------------------------------------

Executing Database Query.' faultDetail:'For details, turn on Robust Exception Information in the ColdFusion Administrator'"
name = "Error"
rootCause = (null)
headers = (null)
message = (mx.messaging.messages::ErrorMessage)#2
body = (null)
clientId = "3DD14FDB-3E09-FB17-EF29-B565C56F4065"
correlationId = "A7FFEDF4-CF9B-5047-5D75-E0A474CD0EC2"
destination = "ColdFusion"
extendedData = (null)
faultCode = "Server.Processing"
faultDetail = "For details, turn on Robust Exception Information in the ColdFusion Administrator"
faultString = "Unable to invoke CFC - Error Executing Database Query."
headers = (Object)#3
messageId = "44728866-A00E-44B4-D30F-4B1B2080DA01"
rootCause = (null)
timestamp = 1240719483040
timeToLive = 0
messageId = "44728866-A00E-44B4-D30F-4B1B2080DA01"
target = (null)
token = (mx.rpc::AsyncToken)#4
message = (mx.messaging.messages::RemotingMessage)#5
body = (Array)#6
[0] "sid.wing"
[1] "XXXXXXX"
[2] 2
[3] 55000000
clientId = "3DD14FDB-3E09-FB17-EF29-B565C56F4065"
destination = "ColdFusion"
headers = (Object)#7
DSEndpoint = "orca-amf"
DSId = "3DD14BD4-F81A-

------------------------

That's all I could capture of it.
Crash scenario - Fenris at 30 per share
I buy 2147483647 shares at 30 per share
Trying to buy 1 more share causes the crash point above
Can we say maxint? ;) What I need to do is put reasonable limits on portfolio size. Like 1B max per stock type.

Now that I've released the code, maybe someone will volunteer to do that. ;)
Yeah - found it. MySQL "signed" int max of 2147483647 (total number of any ONE stock you can own) and max "unsigned" int of 4294967295 (max number of total stocks you can own)
Can't seem to install it on Ubuntu 8.04. Funny though, you'd think AIR would allow it to run fine regardless of the OS?
Interesting thing is - the FAQ for AIR (http://www.adobe.com/products/air/faq/) just says "Linux", not what flavors.
AIR and game installed fine on 8.10
Ray just let me know that he's reset all negative shares to 0, and changed the column from int(11) to bigint, so now the max # of shares of a single stock you can own is 9,223,372,036,854,775,807
Ok,

There is a hack / bug / exploit where you can get as many shares as you like, as I thought last week when people were on crazy numbers.

I now have over a 1000 T so the game is pointless now, but was fun before I discovered it.

Ray email me if you want me to explain, I dont want to do it here.
Reminds me of an old GWBasic game called Starlane.
I tried to look up the source code, but it's pre-Internet.
There used to be an old TRS80 game called Taipan, which was quit exciting really.
http://en.wikipedia.org/wiki/Taipan!
"quite exciting", not "quit exciting".
And you have to add an exclamation point to the end of the link or otherwise you are directed to a wiki about Taipan snakes.

[Add Comment] [Subscribe to Comments]