Welcome, Guest. Please Login or Register.
May 2nd, 2024, 9:23am

Home Home Help Help Search Search Members Members Login Login Register Register
Arimaa Forum « Standalone gameroom client -- what, why, how? »


   Arimaa Forum
   Arimaa
   General Discussion
(Moderator: supersamu)
   Standalone gameroom client -- what, why, how?
« Previous topic | Next topic »
Pages: 1 2 3  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Standalone gameroom client -- what, why, how?  (Read 6988 times)
The_Jeh
Forum Guru
*****



Arimaa player #634

   


Gender: male
Posts: 460
Re: Standalone gameroom client -- what, why, how?
« Reply #15 on: Feb 3rd, 2008, 9:25pm »
Quote Quote Modify Modify

The board does draw in RubyArimaa. It's just the pieces that don't appear.  RubyGo is not working any more; I have no idea why. But, I never was able to get a board to draw in it.
 
By the way, in the shell window that appears, it says:
user defaults not found
user entries loaded
 
And, the Stack Trace of the error message that always appears when I click the Elephant/Dog button is:
 
C:/Documents and Settings/JEH24698/Desktop/arimuby/lib/arimaa.rb:73:in `initialize': undefined method `create' for TkcImage:Class
    while executing
"rb_out c00021"
    invoked from within
".w00003.w00006.w00011 invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tkButtonUp" line 9)
    invoked from within
"tkButtonUp .w00003.w00006.w00011
"
    (command bound to event)
« Last Edit: Feb 3rd, 2008, 9:27pm by The_Jeh » IP Logged
camelback
Forum Guru
*****



Arimaa perl monger

   


Gender: male
Posts: 144
Re: Standalone gameroom client -- what, why, how?
« Reply #16 on: Feb 3rd, 2008, 9:44pm »
Quote Quote Modify Modify

I'm using XP and its working great when playing human vs human games. I'm using ruby 1.8.6
IP Logged
The_Jeh
Forum Guru
*****



Arimaa player #634

   


Gender: male
Posts: 460
Re: Standalone gameroom client -- what, why, how?
« Reply #17 on: Feb 3rd, 2008, 10:31pm »
Quote Quote Modify Modify

When I use Ruby 1.8.6 instead of 1.8.0, I can't open anything at all. I think it's just the nature of my computer.
IP Logged
froody
Forum Guru
*****




I <3 nurpinar

  phm_42@yahoo.co.uk   anteater042


Gender: male
Posts: 103
Re: Standalone gameroom client -- what, why, how?
« Reply #18 on: Feb 3rd, 2008, 11:30pm »
Quote Quote Modify Modify


I changed the way the images are made, because it seemed like The Right Thing to do. As a bonus the pesky 'create' method is no longer used. See if this works:
 
http://phm.36bit.com/RubyArimaa_0_15_0.zip
 
I expect it will work for The_Jeh now, but be broken for everyone else! Oh well. It runs on my Linux machine.
IP Logged

“Arimaa holds its master in its own bonds, shackling the mind and brain so that the inner freedom of the very strongest must suffer”
The_Jeh
Forum Guru
*****



Arimaa player #634

   


Gender: male
Posts: 460
Re: Standalone gameroom client -- what, why, how?
« Reply #19 on: Feb 4th, 2008, 9:42am »
Quote Quote Modify Modify

You're almost there! I can now set up the pieces at the beginning. (It still only opens in Ruby 1.8.0). But then, after all the pieces are set up, I get barraged with another error message, the Stack Trace of which is:
 
C:/Documents and Settings/JEH24698/Desktop/RubyArimaa/lib/arimaa.rb:359:in `tick': undefined method `create' for TkcImage:Class
    while executing
"rb_out c00132 2400 ?? 2118386688 0 ?? -1 0 i 2118386688 NotifyNormal 0 PlaceOnTop 8 763109 0 394 432 ?? 460 2118386688 0 ?? 0 0x0 0x0 6 .w00014.w00015..."
    (command bound to event)
 
 
Also, in the shell window that opens, this text is repeated over and over:
 
bgerror failed to handle background error.
     Original error: C:/Documents and Settings/JEH24698/Desktop/RubyArimaa/lib/arimaa.rb:in 'tick': undefined method 'create' for TkcImage:Class
     Error in bgerror: invoked "break" outside of a loop
« Last Edit: Feb 4th, 2008, 9:46am by The_Jeh » IP Logged
froody
Forum Guru
*****




I <3 nurpinar

  phm_42@yahoo.co.uk   anteater042


Gender: male
Posts: 103
Re: Standalone gameroom client -- what, why, how?
« Reply #20 on: Feb 4th, 2008, 9:58am »
Quote Quote Modify Modify


Ah. Good. I forgot to change the way the 'tick' image is created. This will be fixed shortly.
 
Thx for the feedback.
IP Logged

“Arimaa holds its master in its own bonds, shackling the mind and brain so that the inner freedom of the very strongest must suffer”
froody
Forum Guru
*****




I <3 nurpinar

  phm_42@yahoo.co.uk   anteater042


Gender: male
Posts: 103
Re: Standalone gameroom client -- what, why, how?
« Reply #21 on: Feb 4th, 2008, 12:32pm »
Quote Quote Modify Modify


Got rid of all the 'create' calls and fixed the push/pull bug.
 
http://phm.36bit.com/RubyArimaa_0_15_1.zip
 
I'll probably post a link whenever I change something so people can try it out whenever they feel like it. All feedback/bug reports/suggestions welcome. If you're posting a bug report please include the version of RubyArimaa you've got, your OS and Ruby set-up and the traceback details for the error.
 
At the moment 0_15_1 can only play a local human vs human game, so if you're testing just make sure all the game logic works and nothing weird happens. Thanks.
 
btw, The_Jeh, what happens when you try to run with Ruby1.8.6? (It shouldn't make any difference.)
IP Logged

“Arimaa holds its master in its own bonds, shackling the mind and brain so that the inner freedom of the very strongest must suffer”
The_Jeh
Forum Guru
*****



Arimaa player #634

   


Gender: male
Posts: 460
Re: Standalone gameroom client -- what, why, how?
« Reply #22 on: Feb 4th, 2008, 4:09pm »
Quote Quote Modify Modify

As far as game logic goes:
1. I can push or pull a piece without moving my own piece.
2. I can push a piece using a frozen piece.
3. I can move my rabbits backwards.
4. I can make a move that doesn't change the position, including taking zero steps.
5. I can set up gold pieces on the silver side, resulting in gold having more than eight rabbits, and silver having fewer.
 
Also, it is proper notation to place an x at the end of the step for a capture. For example, Rf6x means a gold rabbit is captured in the f6 trap. It also would be good to include the move number at the beginning.
 
In addition, I get an error message about an undefined method '+' when I tinker with the navigation bar. Or when I press the up arrow key, I get an undefined method 'var_prev' and when I press down, an undefined method 'var_next'.
 
 
As far as Ruby 1.8.6, when I tried it before, a shell window appears for a split second and then disappears.  
 
I think the command prompt output would be similar to:
C:\Documents and Settings\JEH24698\Desktop\RubyArimaa_0_15_1\RubyArimaa\bin>ruby ..\lib\go.rb
'ruby' is not recognized as an internal or external command, operable probram or batch file.
 
I know this because on occasion, RubyArimaa won't open, and this is the command prompt output.
« Last Edit: Feb 4th, 2008, 5:54pm by The_Jeh » IP Logged
leo
Forum Guru
*****





   


Gender: male
Posts: 278
Re: Standalone gameroom client -- what, why, how?
« Reply #23 on: Feb 4th, 2008, 7:25pm »
Quote Quote Modify Modify

Hi Froody, I had another look into the file arimaa.rb but I haven't got a good grasp of it yet, partly because ruby is a foreign language for me, partly because your coding style leaves me a bit confused. For the moment I can only try to explain briefly how I do the game logic in my programs, in the hope it can help you.
 
First thing, I think you should separate totally the interface from the game logic. It will make the code easier to maintain, and it will make it much easier for you to export and adapt the game logic into your AI projects.
 
Then, here is a pseudo-code of the algorithm I use for checking legal steps. There exist many different ways to do it, so I present it only as an illustration and something to chew on.
 
EDIT: For just listing the legal steps of the moment you can change the first line to "for each piece of the current player". I've mixed in stuff I use for other parts of the game. END EDIT
 
For each piece of both players:
 
---- Check the neighborhood and mark the piece as free/frozen, accompanied/alone
 
If this is not step 1 of the move:
 
---- If the previous step was marked as the first of a push:
 
-------- Look around the now empty square for free stronger opp. pieces
-------- that can complete the push, and mark those steps.
 
-------- RETURN.
 
---- If the previous step was not the second of a push or a pull:
 
-------- Look around the origin square of the last step for any weaker
-------- opponent pieces that could be pulled, and mark those steps.
 
For each free piece of the current player:
 
---- Look around for empty squares and mark those steps,
---- minding that rabbits can't go backward.
 
If this is not step 4 of the move:
 
---- For each piece of the opponent player:
 
-------- If there is at least one free stronger neighbor of the current color:
 
------------ For each empty square into which the piece can be pushed:
 
---------------- IF THE STEP WAS NOT MARKED AS THE SECOND OF A PULL
---------------- earlier in the algorithm:
 
-------------------- Mark it as the first of a push.
 
 
Later on, but not in the same procedure in order not to clutter the code, there are more checks to perform: If the count of legal steps is zero and we are at step 1, the player is immobilized.
 
My actual code is not exactly like that because it uses bitmasks to pack data about legal steps and board states, and the marking is more intricated, but it's the general idea. I hope there are not too many errors -- it's late in the night.
 
 
If you prefer checking if a step is legal on the fly instead of surveying the board before, things are different of course. First check if a push has to be completed, in which case see if the submitted step does the job. If there is no push to be completed and the submitted step moves an opponent piece, check if it can be pulled before checking if it can be pushed, and ensure it is not pulled by a piece that just finished a push. Etc.
« Last Edit: Feb 5th, 2008, 1:32am by leo » IP Logged
The_Jeh
Forum Guru
*****



Arimaa player #634

   


Gender: male
Posts: 460
Re: Standalone gameroom client -- what, why, how?
« Reply #24 on: Feb 5th, 2008, 12:32am »
Quote Quote Modify Modify

I just want to make sure that I don't come off as harshly critical. I pointed out the problems because I know they are useful for you to know. Otherwise, it is obvious that your client is off to a great start.
IP Logged
leo
Forum Guru
*****





   


Gender: male
Posts: 278
Re: Standalone gameroom client -- what, why, how?
« Reply #25 on: Feb 5th, 2008, 1:48am »
Quote Quote Modify Modify

on Feb 5th, 2008, 12:32am, The_Jeh wrote:
I just want to make sure that I don't come off as harshly critical. I pointed out the problems because I know they are useful for you to know. Otherwise, it is obvious that your client is off to a great start.

 
I wish to say the same. The forum doesn't reflect the cheerful atmosphere of the chatroom discussions about RubyArimaa.
 
Froody, I edited my post to modify a point. I also want to add that surveying the board between each step to mark all legal steps can speed up the interface when it comes to pop up the arrows around a piece the mouse pointer is hovering. But it's even more useful for doing statistics about the board state.
 
EDIT: I've just downloaded and run RubyGo, on which you based RubyArimaa, and I get the same kind of errors as well as the console window in the way, so these bugs were already present in the project. I can't get the goban to appear inside the window, and no way to start a game.
 
It seems it's been a while Rubygo hasn't been updated or debugged, and maybe it's not too late to restart on a more solid base such as RubyGame: http://rubygame.sourceforge.net/ which is a library devised for multimedia on ruby. But I'm a complete noob ruby-wise, so this is just the word of someone afraid of jumping into a new language among a tentacular project that does weird things on my the screen. Wink
 
EDIT 2: Even weirder, when I run RubyGo and try to open a file, the dialog box behaves slowly and weirdly and instead of filtering SGF files, it wants ari files.... Does it come from the fact that Tcltk mixes the two programs? Sad RubyGame uses the SDL, I dont know how it compares to tcltk. Would it be possible to program in ruby without the need of external stuff?
« Last Edit: Feb 5th, 2008, 3:07am by leo » IP Logged
froody
Forum Guru
*****




I <3 nurpinar

  phm_42@yahoo.co.uk   anteater042


Gender: male
Posts: 103
Re: Standalone gameroom client -- what, why, how?
« Reply #26 on: Feb 5th, 2008, 2:11pm »
Quote Quote Modify Modify

Smiley
 
Don't worry about sounding critical. Thorough bug reports are great.
 
I'll probably change the way RubyArimaa does the game logic. Thinking about it the code will be easier to understand doing it the way Leo recommends. (Thanks for the algorithm, leo.)
 
I didn't change the name of the user files directory. So remove .rubygo in your home directory before running RubyGo. (When you run the program from the command line it prints the path of the user files dir)
 
 
My plan is to spend a bit more time on RubyArimaa and see what happens. I'm confident that it's not that far off from being a usable Arimaa client. If people want to discuss starting another project from the ground up, I'd be happy to join in on that, too. I suppose the first question is which GUI framework to use?
 
"The main target platform for Rubygame is Linux". Surely many more people will want to run the arimaa client from windows than from linux, so is Rubygame a good idea? Tcl/Tk is far from perfect but it does run pretty well on both win and linux. What alternatives are there? Fox? wxwindows? What's the stuff you've written like, leo? Could it be used as the base for a full client?
 
« Last Edit: Feb 5th, 2008, 2:13pm by froody » IP Logged

“Arimaa holds its master in its own bonds, shackling the mind and brain so that the inner freedom of the very strongest must suffer”
froody
Forum Guru
*****




I <3 nurpinar

  phm_42@yahoo.co.uk   anteater042


Gender: male
Posts: 103
Re: Standalone gameroom client -- what, why, how?
« Reply #27 on: Feb 5th, 2008, 7:25pm »
Quote Quote Modify Modify

on Feb 5th, 2008, 1:48am, leo wrote:

Would it be possible to program in ruby without the need of external stuff?

 
Text based client? I did think about that. You could set up a chess board on your desk and just type in the move Smiley
IP Logged

“Arimaa holds its master in its own bonds, shackling the mind and brain so that the inner freedom of the very strongest must suffer”
leo
Forum Guru
*****





   


Gender: male
Posts: 278
Re: Standalone gameroom client -- what, why, how?
« Reply #28 on: Feb 6th, 2008, 7:02am »
Quote Quote Modify Modify

on Feb 5th, 2008, 7:25pm, froody wrote:
Text based client? I did think about that. You could set up a chess board on your desk and just type in the move Smiley

 
Like on Mindsports Arena? Or even gnaw the phone wires to send bits directly to the server. Requires training Tongue
 
Anyway a client console would be a much needed debugging tool. We could knock one in a few lines in Rebol or Javascript. Maybe it would be great to have a sandbox area in the gameroom to avoid messing with the games?
 
on Feb 5th, 2008, 2:11pm, froody wrote:
"The main target platform for Rubygame is Linux". Surely many more people will want to run the arimaa client from windows than from linux, so is Rubygame a good idea? Tcl/Tk is far from perfect but it does run pretty well on both win and linux. What alternatives are there? Fox? wxwindows? What's the stuff you've written like, leo? Could it be used as the base for a full client?

 
The SDL can do OpenGL, but for mere 2D it uses the old GDI (not GDI+) on Windows, which is indeed bad (no PNG transparency nor good image resampling).
 
The first program I made was on OpenGL, to be able to rotate the board in 3D like a molecule model - to study symmetries. But the pieces were dry polygons. Then I did another on the GDI, then the latest one on the GDI+. Everything in C++ and probably a bit too much Windows dependent although I took some care to separate the parts of the latest one (AI, game, lightweight graphics wrapper, interface).
 
But C++ is a hassle, which I use mostly because of my industrial background, and I don't think it's a good ground for cross-platform projects - it would require a ton of duplicate source, or long braids of precompiler conditionals. The most I know of Unix/Linux programming is a bit of X11 graphics and event handling in pure C...
 
Ruby looks fine to me, and you are the one with most enthusiam, so it's all normal you choose the tools.
« Last Edit: Feb 6th, 2008, 7:06am by leo » IP Logged
omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Standalone gameroom client -- what, why, how?
« Reply #29 on: Feb 8th, 2008, 1:01am »
Quote Quote Modify Modify

on Feb 5th, 2008, 2:11pm, froody wrote:

If people want to discuss starting another project from the ground up, I'd be happy to join in on that, too. I suppose the first question is which GUI framework to use?

 
If it was done using Adobe Flex, we would be able to use the code I've already developed for the new Flash client.
 
http://www.adobe.com/products/flex/
 
IP Logged
Pages: 1 2 3  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.