Computer Science Canada Gandalf's Snake |
Author: | [Gandalf] [ Mon Dec 05, 2005 9:20 pm ] |
Post subject: | Gandalf's Snake |
Well, I've also made a snake game like everyone else, and since I haven't posted many of my programs before, I will now. Also, I recently started working on a C++ "port" of this game (still working on it), so posting the original doesn't seem a bad idea. Features include: -High scores -Unique scoring system. You get more points the faster you get the "food". -Amazing graphics! -Grid based (of course) -An 'escape' button that works I didn't put too much effort into the menu parts of the game, so don't judge those since they most likely will not be bug-proof. It's been a while since I've worked on this game, but any suggestions are welcome. I may not put them in this version, but if I can convert it to C++, then it may go to the next snake game. So next time there is a snake game competition, feel free to include mine! |
Author: | Tony [ Tue Dec 06, 2005 10:04 am ] |
Post subject: | |
Looking good. Heck, I'll even give you bits for this I'm not sure how you're handling the different speeds though. Ideally you'd have a single setting with DelaySinceLast going. And the scoring system should be more transparent. I understand that I get more points for getting to the food faster, but by how much? |
Author: | jamonathin [ Tue Dec 06, 2005 2:20 pm ] |
Post subject: | |
My favorite was the use of file extensions. .asd <- very creative |
Author: | [Gandalf] [ Tue Dec 06, 2005 4:26 pm ] |
Post subject: | |
Oh yeah, I love creating file extentions . Yeah, the speeds are something which I could improve, since as you guessed I used different delays (Time.DelaySinceLast(speed)) which might cause reaction problems. About the scoring system. The most points you get per 'food' is 50, the least is 2 - the whole process probably takes well under 10 seconds. I'll look into the scoring system a bit, I'm hoping for something where the difference isn't too huge. Any specific suggestions on that point? I'd post the formula for calculating it, but I don't have the source handy right now (I'll post it sometime soon). Thanks for the bits, comments and suggestions . |
Author: | Tony [ Tue Dec 06, 2005 4:52 pm ] |
Post subject: | |
Just perhaps a counter going, that lets me know how much points I will get if I eat right now.. continuesly dropping... perhaps you could also consider the distance between the snake and the food.. if the target is far, you loose a lot of points even for a perfect execution. I think I'm just getting to be too idialistic about those points. And of course -- where are the evil poisonous mushrooms? |
Author: | [Gandalf] [ Tue Dec 06, 2005 5:45 pm ] |
Post subject: | |
Right! The counter is a good idea. I was going to add it before, but I had forgotten about it. In it goes, thanks . Tony wrote: perhaps you could also consider the distance between the snake and the food.. if the target is far, you loose a lot of points even for a perfect execution.
... And of course -- where are the evil poisonous mushrooms? Hehe, maybe, maybe. After I get the majority of the rest done anyway. Currently, the time is takes from the score you gain to go from 50 to 2 is 5 seconds. |
Author: | GlobeTrotter [ Tue Dec 06, 2005 5:54 pm ] |
Post subject: | |
Maybe implement a pathfinding algorithm, and determine the shortest distance that could be taken towards the food, then calculate the difference between the shortest path and the one you take, and assign points based on this, rather than time. |
Author: | Tony [ Tue Dec 06, 2005 5:58 pm ] |
Post subject: | |
The problem with that is you can't go through the snake. So the pathfinder would have to consider the snake to be a wall, though it changes in shape during each move the pathfinder takes... and it gets to be very complicated from there.. |
Author: | Cervantes [ Tue Dec 06, 2005 6:53 pm ] |
Post subject: | |
Good point, though it's definately do-able. Alternatively, you could ignore this, and say that you were not in the optimum position to get the next apple. |
Author: | Tony [ Wed Dec 07, 2005 10:24 am ] |
Post subject: | |
Actually this would be something really cool to do -- a snake A.I. |
Author: | GlobeTrotter [ Wed Dec 07, 2005 6:21 pm ] |
Post subject: | |
The problem would be that at some point, when the snake gets too large, it would take longer than the framerate to calculate the next best position. Then the game would slow down, and it wouldn't truly be snake AI. |
Author: | [Gandalf] [ Wed Dec 07, 2005 6:57 pm ] |
Post subject: | |
Quite possibly, and the advantage would be small, since if you ignore the snake position some accuracy is lost. And if that's fine, then so is using the time for scoring . Still, it would be interesting to make it work for a certain time limit as well. What you could also try it to make both play at the same time, a bit like tron, but going for the food. Only thing is, then the problems begin again with having to keep track of the moving snake as walls to avoid. |
Author: | Tony [ Thu Dec 08, 2005 10:18 am ] |
Post subject: | |
GlobeTrotter wrote: The problem would be that at some point, when the snake gets too large, it would take longer than the framerate to calculate the next best position.
That's all a part of the requirement. The game must maintain a reasonable FPS. Basically the movement is called, and it has N amount of time to come up with a decision. If it fails to do so, the snake is forced to move in the direction it was heading before. So given a long sized snake, with a complex path to the fruit - yes it will not be able to see far enough and crash into itself. The A.I. should account for it and make educated assumptions about where it has been, where it is going and how will its shape change half way through it. |
Author: | Paul [ Sat Dec 10, 2005 12:10 am ] |
Post subject: | |
Its games like this that makes me miss turing As far as my experience, I've never met a scoring system like this with snake. Its always been scoring related to your playing speed with constant increments, or eating things of different sizes and having your score be based on that. This one is based on how long it takes for you to eat it right? Thats some cool originality (just 'cause i've never seen it before, still cool if you got it from somewhere else) |
Author: | [Gandalf] [ Sat Dec 10, 2005 8:43 pm ] |
Post subject: | |
Thanks, and yep, the score you get per snake depends on how fast you ate it. This kind of scoring system is similar to what is used in a snake game commonly found in forum 'arcades'. I didn't exactly copy the idea (it's different in the other version), but it is the basis of my scoring system. So, has anyone beaten my high score? |