Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Gandalf's Snake
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
[Gandalf]




PostPosted: 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! Smile
-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!



Gandalf Snake.zip
 Description:
Gandalf's snake game.

Download
 Filename:  Gandalf Snake.zip
 Filesize:  273.57 KB
 Downloaded:  423 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Dec 06, 2005 10:04 am   Post subject: (No subject)

Looking good. Heck, I'll even give you bits for this Very Happy

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?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
jamonathin




PostPosted: Tue Dec 06, 2005 2:20 pm   Post subject: (No subject)

My favorite was the use of file extensions. .asd <- very creative Laughing
[Gandalf]




PostPosted: Tue Dec 06, 2005 4:26 pm   Post subject: (No subject)

Oh yeah, I love creating file extentions Laughing.

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 Smile.
Tony




PostPosted: Tue Dec 06, 2005 4:52 pm   Post subject: (No 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? Twisted Evil
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
[Gandalf]




PostPosted: Tue Dec 06, 2005 5:45 pm   Post subject: (No 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 Smile.
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? Twisted Evil

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.
GlobeTrotter




PostPosted: Tue Dec 06, 2005 5:54 pm   Post subject: (No 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.
Tony




PostPosted: Tue Dec 06, 2005 5:58 pm   Post subject: (No 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..
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue Dec 06, 2005 6:53 pm   Post subject: (No 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.
Tony




PostPosted: Wed Dec 07, 2005 10:24 am   Post subject: (No subject)

Actually this would be something really cool to do -- a snake A.I.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
GlobeTrotter




PostPosted: Wed Dec 07, 2005 6:21 pm   Post subject: (No 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.
[Gandalf]




PostPosted: Wed Dec 07, 2005 6:57 pm   Post subject: (No 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 Smile. 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.
Tony




PostPosted: Thu Dec 08, 2005 10:18 am   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Paul




PostPosted: Sat Dec 10, 2005 12:10 am   Post subject: (No subject)

Its games like this that makes me miss turing Crying or Very sad

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) Claping
[Gandalf]




PostPosted: Sat Dec 10, 2005 8:43 pm   Post subject: (No subject)

Thanks, and yep, the score you get per snake depends on how fast you ate it. Smile

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? Cool
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 15 Posts ]
Jump to:   


Style:  
Search: