just wanted to give some feedback, even tho i am sure you are already aware of it.
not sure why on some moves the ai can take almost 5 minets to make a move.
i am not sure if this a ongoing discusion already and trying to be improved.
or a way to deter ya from playing ai and try to play other people hehe, but i kinda already decided that didnt make sense since when their is no one to play, the ai is still slow making moves
was just sorta on my mind as i am waiting on a move atm and this was somethign to do haha
Posts:
1,032
Registered:
Dec 16, 2001
From:
Powell, OH
Age:
37 Home page
Re: ai slowness
Posted:
May 19, 2005, 2:11 AM
I am a little surprised if it was actually taking 5 minutes, that is pretty slow. It is pretty slow sometimes. Since I didn't write the AI I don't understand it all that well, but obviously the higher the level, the longer the time it will take for a move.
Also, if there are other players using the site (for game database searches, playing, etc.) that will slow it down as well.
Nothing is being done to speed it up currently, about all I could do is get a faster machine, which costs more so I don't see that happening anytime soon.
Posts:
542
Registered:
May 9, 2002
From:
Northeast USA
Re: ai slowness
Posted:
May 20, 2005, 12:02 AM
There is actually something about running on the server side here at DSG that makes it exponentially slower. When playing against the same level ai, making the same moves on a local, client machine (and an old one at that!) a move might take 2 or 3 seconds that takes several minutes through DSG. I don't understand specifically how the program runs on the DSG server but something does seem off for it to make that much difference. And it has been that way for a long time. It seems like there might be some way to make it go much faster that doesn't have anything to do with the actual program itself.
Posts:
58
Registered:
Jan 19, 2002
From:
Peoria Arizona
Age:
43 Home page
Re: ai slowness
Posted:
May 21, 2005, 8:48 AM
What are the specs of the server. You know I have a computer company. I actually have a nice, slightly used server I am trying to dump. I also may be able to get you that ram much cheaper. I also have contacts for cheap hosting. Maybe a faster dedicated computer would make it all go much better.
Posts:
1,032
Registered:
Dec 16, 2001
From:
Powell, OH
Age:
37 Home page
Re: ai slowness
Posted:
May 23, 2005, 3:32 PM
up2ng, I assume when you say running it on your own PC you are using Marks windows version? That is interesting, I have not run it locally in some time, I will have to take a look at the speed comparison.
It is certainly possible that there is something the matter with the way it runs on DSG. Mark actually donated his AI code and I converted it from C to Java, and made a few minor additions to make it run better in a threaded environment like a game server. One small note, I added a 5 second built in delay at the beginning of each move, just to give you enough time to request an undo.
emerald, email me about the details of your cheap hosting, of course I would be willing to check into it. The current server specs are: 1.8GHz celeron 512MB ram 80GB HD
Last year I had a slightly faster machine with twice the memory, but it cost twice as much. If I had the cash I would go to a faster machine, or even better get a second machine. That way I could offload the AI's, games history search and a few other things to the 2nd box and have the 1st box just be a quick web server/game server.
i sure would like to see this fixed at some point.
i log on here and their, and prefer to duel the ai level 8, but jeez the wait time between some moves never ends, mater fact i think ive fallen asleep once and woke up and the somputer still hadent moved.
their is not always somon on to play, or available, or interested in the game you want to try out, or just wanting to repeat the same mvoes over and over to see were they lead.
but now ive lost interest in trying the ai at all, i thought everquest was a time sink but waiting on the ai to move has proven to break my paitence.
i sure dont see me donating again for something i cant get much enjoyment from
sorry if soundeding rude but sometimes it would be nice to just log on the little bit of time ya have and play for a few and go to bed, but looks like its backgammon or solitair
Posts:
542
Registered:
May 9, 2002
From:
Northeast USA
Re: ai slowness
Posted:
Aug 20, 2005, 3:12 AM
jprock, I hope you don't give up on DSG just because of the AI! It's a great site and a great game and there is usually someone here to play against in real time.
Next time I think of it I think I'll try making identical moves (provided the AI starts with the same first 2 or 3 moves, it should continue playing the same line) on the Windows version on my local machine and here at DSG over the network and track the times for each move.
I did not notice this before but I just saw in your last post:
"It is certainly possible that there is something the matter with the way it runs on DSG. Mark actually donated his AI code and I converted it from C to Java, and made a few minor additions to make it run better in a threaded environment like a game server."
This looks suspicious to me. Is there any way to try running the C code directly? (a "native" call or something?)
Posts:
1,032
Registered:
Dec 16, 2001
From:
Powell, OH
Age:
37 Home page
Re: ai slowness
Posted:
Aug 20, 2005, 5:02 AM
> > This looks suspicious to me. Is there any way to try > running the C code directly? (a "native" call or > something?)
When I originally got Marks code I did try this (it seemed like the easier route), but in those days I was running on some weird linux server that only had support for java using some third party version called kaffe. Anyways, it never worked quite right so I ended up porting the code. I might have a better chance now, but I doubt it would be that much faster running in native c, java is not as slow as many think.
Posts:
1,032
Registered:
Dec 16, 2001
From:
Powell, OH
Age:
37 Home page
Re: ai slowness
Posted:
Dec 7, 2005, 6:04 PM
I just released DSG v4.0.10.6 yesterday to partially address this issue.
I noticed with my memory monitoring that when playing mm_ai8, memory allocation was running pretty high at over 50mb/s! Analyzing the program showed that a couple of functions were called repeatedly (about 1-2 million times per mm_ai8 move) and were allocating a few small arrays each time. The garbage collector was running several thousand times per move, the overall time spent on garbage collection was still only about a second but allocating/deallocating all the memory takes time.
So I instead allocate the arrays once and clear them each time the function is called. I also found that a function I added to the program to check if the ai should stop thinking mid move was being called way to often. I simply call it less frequently now.
Tests on pente.org machine show about a 25% increase in speed for AI level 8. Interestingly on my work machine the test took about an average of 15 seconds (3.1 ghz P4), and a speed increase of 100%. On pente.org is took 120 seconds (1.8 ghz celeron). So if I could afford a faster pente.org machine it would make a big difference.
When doing tests on pente.org against mm_ai8 it really was slow, I didn't realize just how slow it could be. Hopefully I can spend some time on this in the future.
Posts:
542
Registered:
May 9, 2002
From:
Northeast USA
Re: ai slowness
Posted:
Dec 7, 2005, 11:46 PM
Good stuff Dweebo!
Hey, have you ever considered making a small mod to the game room whenever an AI opponent is selected to display some of the stats that Mark displays in his program? Specifically, he displays a "progress bar" (well, I think it's a percentage figure) giving you at least some indication of how much longer you will have to wait for the next move. He also gives a "score" for whether the computer thinks it is winning or losing and by how much based on its most recent analysis.
Posts:
542
Registered:
May 9, 2002
From:
Northeast USA
Re: ai slowness
Posted:
Dec 11, 2005, 9:24 PM
Dweebo,
I finally did a little test of my own. I played the same line on my (SLOW!) local machine using Mark's WPente program (which has the "same" AI) and on DSG and recorded the amount of time spent thinking by the computer in each case. I was playing against mm_ai8 in both cases. It was player 1 and I was player 2. The line I chose was spread out, which causes the computer to think longer and you can really see the difference in performance. My local machine is an old, bogged down Windows 98 machine with a 866mhz processor and 128mb ram. Furthermore, the computer actually is much slower than it should be for a variety of reasons. Note that this computer is much less powerful than the DSG server.
Here is the line: (cut off after the 5th move because it was so excruciating)
Note I did not catch the exact time taken to make the 4th move, but the range given is accurate.
Local Total (5 moves): 0:04:49 elapsed time DSG Total (5 moves): >1:47:50 elapsed time ............................. <1:55:19 elapsed time
Conclusion: There is something going on here that cannot be fixed by 25% performance improvements. Either there is something wrong with the way the code was ported to Java, or some sort of network or systems problem or something. These types of waiting times are really not acceptable to the casual player who wants to take a crack at mm_ai8 and I can understand the frustration shown at the beginning of this thread and elsewhere.
It might be worthwhile to do a little analysis of the efficiency of the code (the algorithm) doing the actual calculations for each move or to try running the native C code directly.
I'm sure this is not high up on the priority list but I thought I'd try to help define the extent of the problem in case there was any doubt.
Posts:
1,032
Registered:
Dec 16, 2001
From:
Powell, OH
Age:
37 Home page
Re: ai slowness
Posted:
Dec 12, 2005, 4:50 PM
Thanks for posting your own test results. I agree that mm_ai8 is still way too slow. In fact after I made my changes and tested them on my own machine I put the code up on pente.org and logged in to play a game. After waiting a really long time per move I thought maybe I had messed something up and so I put back the old code. But then I realized the old code was even slower...
Maybe I will have to try running it natively in C, I'll have to ask Mark for the code again, I don't think I still have it.
Posts:
260
Registered:
Dec 16, 2001
From:
Maryland
Age:
53 Home page
Re: ai slowness
Posted:
Dec 13, 2005, 6:14 AM
Thanks for the testing up2! I'll check on my current code to see what kind of shape its in, maybe not good?! I'll send it to you D if it looks OK. Why don't you send me the Java code and I'll look over it for problems. -Mark
Posts:
260
Registered:
Dec 16, 2001
From:
Maryland
Age:
53 Home page
Re: ai slowness
Posted:
Dec 17, 2005, 7:26 PM
OK, I have the Java code, I'll check over it this week to look for obvious bugs. For some reason ai8 is ranked in the middle of the other levels, maybe that is related or not. Whoa! Looking at the stats, ai1 has an astounding 80,000 games played!! Far more than any mortal.
Message was edited by: mmammel at Dec 17, 2005 1:27 PM