wood burning stoves 2.0*
The moose likes Game Development and the fly likes BlackBox(tm) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "BlackBox(tm)" Watch "BlackBox(tm)" New topic
Author

BlackBox(tm)

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

A web application is probably one of the worst platforms upon which to build a game (due to the latency of the HTTP request/response cycle), but that didn't stop me. I developed this more to play with JSP 2 and Tomcat 5 than anything else, but it was a lot of fun to work on this -- much different from the drier, business-oriented web apps I usually work on.

Give it a whirl and let me know what you think -- especially if you are familiar with the original Parker Brothers game.

Keep in mind that it is a web application, so I already know it's too slow.

bear

Enter the BlackBox
[ September 12, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

slick implementation Bear!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Very nice. It would be better if I knew what the heck I was doing. But not bad at all for a Web Based game.


GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Thanks Jessica and Gregg.

Gregg, it's worth reading the instructions if you are interested in figuring out how the game works. It's always intrigued me since it's such an "engineer's game" (not to mention a good lesson on 'black box' vs 'white box' testing).
ty shock
Greenhorn

Joined: Sep 09, 2004
Posts: 7
Cool game. I'm going to come back and play it more when I get some time. Looks like it has a 'mastermind' feel to it.

I'm a fellow JSP developer, so I like the concept.

Here's a jsp idea i have that could be cool:

A few years ago our customer wanted an instant message interface built into their web app. While analyzing the solution, one thing I tried was where you have an invisible frame in the browser connect to a jsp/servlet, and leave the connection open. This way you can stream dynamic text back to the client as javascript commands, and the browser executes them for you. For example, you would stream text like so:

out.println("<script>");
out.println("var chatText = "hello world");
out.println(/* javascript function to update chatwindow element in other frame */);
etc...

In the chat servlet running on the server, we started a loop that monitored a global static chatbean. When a new line of text was added to the chatbean, it would use the open socket to the webpage to send the new line as a javascript function. This way chattext was pushed globally as soon as it was entered.

What I think would be cool would be to have a multiplayer javascript game where you take advantage of this open connection as a means to synchronize the game between clients. The online logic would rest in the servlet, and you could use global beans to communicate game variables between players.

Sure it would be a hack, and you could probably do it better with flash, but it would be neat to try and implement.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
All I could say is, it could use some mouseovers, but I know you do not want to use JavaScript since you hate it so much.

I did not know you were so talented!

LOL

Eric
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Really nice, Bear!

I enjoyed reading your history of BlackBox implementations you've written.


[Jess in Action][AskingGoodQuestions]
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

I'm lovin the game. Nice way to excercise my brain . I've got two enhancement suggestions for you:

1- When I'm playing the game I often forget how many balls I'd chosen to find. It'd be nice if there was a running count next to my score of how many balls I still need to place.
2- After finishing the game, to start a new game you've gotta go to two screens: click "new game" then select the # balls to find. It'd be nice if you could select the # balls on the final score screen and skip the middle page.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Very cool Bear.

I had three balls, took 1 hit and three detours, for a final total of 7 points. Is that good?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

but I know you do not want to use JavaScript since you hate it so much.


Not at all. In fact, I use a fairly extensive amount of Javascript in the game (read the Colophon). Sorry if you got the impression I hate Javascript... what I hate is how it is misused for things better done on the server side.

What types of things do you think would benefit from rollovers? I didn't want things to get too whacky when you waved the mouse around, but I'd certainly consider anything that would improve usability.

Ernest, thanks for the kudos. In a microcosm, my BlackBox implementations are a history of my entire tech career.

Jessica, great suggestions!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Is that good?


Indeed! The 3-ball game is really hard since there is so much empty space and possiblity of "pass-throughs" that give you little information but costs 2 points.

Incidentally, the 5-ball game has the possibility to have configurations that are impossible to deterministically solve.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Speaking of the 5 balls. Is it possible for one side to have 6 red boxes for direct hits?

Mark
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Yes, though I could not come up with a config off the top of my head that made them contiguous.

This is possible since one ball can account for a hit, and also cause a ray from an adjacent port to detour into another ball.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I think that the rollover would help to see what space your mouse is over. That is all I can think of really...

Eric
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
That's a cool game. I feel inspired but can't think of a board game that would translate to a web platform.
[ September 15, 2004: Message edited by: Helen Thomas ]

Le Cafe Mouse - Helen's musings on the web - Java Skills and Thrills
"God who creates and is nature is very difficult to understand, but he is not arbitrary or malicious." OR "God does not play dice." - Einstein
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
Though I do believe there is an error:
That missed ball doesn't look right in relation to some hits.

web page
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Which result do think is in error? They look correct.
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
How would you explain the hit directly above the red ball if it's real position is indicated by the blue ball.

Unfortunately I submitted my guesses before shooting all rays which is the object of the game to keep the score low. As a result not a lot can be said about the bottom part of the grid.
Bacon
Ranch Hand

Joined: Jul 14, 2004
Posts: 305
Enjoyed it a lot, very nice game.

Its interesting that the reflections provide the most significant information.
Bacon
Ranch Hand

Joined: Jul 14, 2004
Posts: 305
Got an 11. I know that's not relevant to game development, but I'm pleased with that score. Is that a good score?

On a more relevant point... What is the best way to get started with game development. It sounds like a lot of fun.
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
I go by the hits mainly. I don't trust the relections just yet.
But it's an excellent game. I've blog raved about it.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
start with a simple game eg tic tac toe and learn how to make it. From there you build upon your experiences til you build bigger and better games.

my 2 cents

Eric
Bacon
Ranch Hand

Joined: Jul 14, 2004
Posts: 305
Thanks Eric. Do you need change?

Should I bother with GUI right away or is there a simpler way to get to learn the logic portion first?

btw... a new personal best: 9!

An interesting twist on the black box would be to make it truely 3D, a cube. That would be difficult, but really cool. What do think Bear, could you have a prototype ready by next week?
[ September 16, 2004: Message edited by: Ray Marsh ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65


How would you explain the hit directly above the red ball if it's real position is indicated by the blue ball.


The 'ray' detoured off the green ball in the second-to-last row, and into the ball in the first column.

I've blog raved about it.


Too cool! Might you provide a url?

Its interesting that the reflections provide the most significant information.


It usually takes players a while to relaize that. Congrats!

Should I bother with GUI right away or is there a simpler way to get to learn the logic portion first?


Starting with the model is always a good way to deal with just about any type of app. The model for this implementation is entirely GUI-agnostic and could be used for any UI. Perhaps I should get up off my butt and finish the Swing interface (as if I had the time!)
Bacon
Ranch Hand

Joined: Jul 14, 2004
Posts: 305
Originally posted by Bear Bibeault:

...quote:
--------------------------------------------------------------------------------
Its interesting that the reflections provide the most significant information.
--------------------------------------------------------------------------------

It usually takes players a while to relaize that. Congrats!


aw shucks!


...The model for this implementation is entirely GUI-agnostic...


My degree is actually in theology, but I'm gettin static on this one!
[ September 16, 2004: Message edited by: Ray Marsh ]
Helen Thomas
Ranch Hand

Joined: Jan 13, 2004
Posts: 1759
Bear you must be getting a lot of PM's. Your box is full.
It was on my blog actually with a readership of one and family.
The latter also think that Wonderland(Stinky & Loof) from http://www.BigFishGames.com is terrific.
They have some free trial-sized games but probably not done in Java. Downloadable so fast. Though speed hasn't been an issue with me with BlackBox.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

UI-agnostic, the state or property of being completely independent of any specific user interface. See MVC; Model 2.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Bear you must be getting a lot of PM's. Your box is full.


Hmm, no new ones. And only had a dozen old ones. I don't know what's up with that.

You could always send me email...
Bacon
Ranch Hand

Joined: Jul 14, 2004
Posts: 305
So how about that Black Cube idea?

That would be really interesting, but difficult to display in a meaningful way.
Ray Marsh
Ranch Hand

Joined: Jan 12, 2000
Posts: 458
A shameless contest for braggin rights is going on in the Meaningless Drivel forum for this game.


Anxiety does not empty tomorrow of its sorrows, but only empties today of its strength. – Charles Spurgeon
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Cool!
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11153
    
  16

I remember when i was young, my sister had the game. Your interface is spot-on with what i remember... the orange plastic pieces with the shapes cut out look great!!!

What might be useful as a teaching tool is after the player submits their guess and you tell the how you did, you could draw in the rays that don't work with their ball pattern, showing them where they made a mistake.

Yes, they could probably figure it out on their own, but sometimes (just like with code), you're so locked into what you BELIEVE is correct you can't see what IS correct...

Overall, an EXCELLENT re-creation...
[ October 11, 2004: Message edited by: fred rosenberger ]

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ray Marsh
Ranch Hand

Joined: Jan 12, 2000
Posts: 458
so... fred... where's your shameless grab for bragging rights? an experienced sage like yourself should be in the hunt for the prize.

please notice that i typed all in lower case so you can understand.
[ October 11, 2004: Message edited by: Ray Marsh ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Your interface is spot-on with what i remember... the orange plastic pieces with the shapes cut out look great!!!


Thanks! But I can't take credit for the artwork of the 3-D theme. I lent my physical copy of the game to Jay Barnes who renderred the graphics for me. I will take credit for driving the effort to make it as realistic as possible.


What might be useful as a teaching tool is after the player submits their guess and you tell the how you did, you could draw in the rays that don't work with their ball pattern, showing them where they made a mistake.


Yeah, that's on my possible future features list. Not so easy to do in the web environment, but certainly a worthwhile feature.


Overall, an EXCELLENT re-creation...


Thanks again! Very much appreciated.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11153
    
  16

Originally posted by Ray Marsh:
so... fred... where's your shameless grab for bragging rights? an experienced sage like yourself should be in the hunt for the prize.


I never said I was any GOOD at the game - just that my sister HAD it. I don't think I've seen the game in 25 years, let alone played it.


please notice that i typed all in lower case so you can understand.


I made a special effort for you, Ray, to use proper case in this post. If anybody is wondering what this is all about, see THIS thread.
Ray Marsh
Ranch Hand

Joined: Jan 12, 2000
Posts: 458
I saw that thread before, hence the reason for the good natured barb.

I do appreciate the mixed case effort, however, it is unnecessary since I am bilingual!
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Ok...I placed all the balls and got the message
You have no remaining guesses to place....you may submit now...

I clicked on "Submit Guesses".
The board is cleared, the score became zero and the Messages window displays
Welcome to the ...., as if a new game has began.

Then I clicked on a empty space in the grid, the Messages window says
You have already made the maximum number (4) of guesses.
Please remove guesses before trying to make any more.


Am I missing something?
[ October 14, 2004: Message edited by: Mani Ram ]

Mani
Quaerendo Invenietis
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Mani, sounds like a problem with running some of the JS. Could you send a problem report including your precise browser info to the e-mail address on the game?
 
Consider Paul's rocket mass heater.
 
subject: BlackBox(tm)
 
Similar Threads
web based gaming code
XMLHttpRequest
2 player internet game
Re-enter the BlackBox
Java basics done, Whats next?