C Board  

Go Back   C Board > Community Boards > Projects and Job Recruitment

Reply
 
LinkBack Thread Tools Display Modes
Old 05-27-2009, 12:00 PM   #1
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,629
nort, yet another tron game

Greetings again. Just thought I'd post one of my latest projects to let everyone know I was still around.

This is nort, "tron" spelled backwards. It's a simple tron game with AI written with the SDL in C++. I used git for version control, and wrote the whole thing in a very short period of time. (I think it was less than 24 hours.) There's no documentation, sorry. :P

http://dwks.theprogrammingsite.com/m...ort-1.1.tar.gz -- source with Linux 64-bit executable
http://dwks.theprogrammingsite.com/m...rt-1.1-win.zip -- source with Windows executable (you'll need SDL.dll)

I used just plain SDL, no other libraries. The Windows executable should run with just SDL.dll (which you can get from my other projects, e.g. sailseas, or the SDL website).

Instructions:
- Press space to start a new game. All four AIs will battle it out by default; if you want to play, press '2' to disable AI for player 2 (green), and use the arrow keys to control it.
- Press '1' to disable AI for player 1 (red), and use asdf to control it.
- Press END to speed up the game, or space to abruptly start a new one.
- See the README.txt for details.

Other features are:
- The game area wraps when you hit the edges. It makes it a lot harder.
- The AI is very difficult to beat. You can trick it, though, especially if you know how it works. I'll leave it to the reader to discover this from the source.
- The code's reasonably well modularized. You can, for example, add other AIs if you wish.

There are a few bugs with the program; I guess the only annoying one is that AIs sometimes crash into each other.

Anyway, I have to run now. Feedback welcome. I'm now working on other projects, of course, but I thought this was interesting anyway.

DWK

P.S. I was beating one of the AIs once after 63 games. I had won 17 games, (the worst) AI had won 16.

[edit] By the way, I didn't specifically release the code under a license -- maybe with the next version, if there ever is one -- but if anyone wants to change it, you can consider it released under the GPL version 3. [/edit]
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, etc.

New project: nort

Last edited by dwks; 05-27-2009 at 12:03 PM.
dwks is offline   Reply With Quote
Old 06-05-2009, 09:38 AM   #2
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,629
Just thought I'd post a belated screenshot.
Attached Images
 
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, etc.

New project: nort
dwks is offline   Reply With Quote
Old 06-09-2009, 03:11 AM   #3
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,139
It's fun, especially when you co-play with the AI.

FYI, I had no problem compiling and running on 32-bit Arch Linux. I can see why you stopped using CMake, I don't like it anymore either ;-).

I was shocked to see how small your AI code is...

Now all you need to do is wack xuni over it ;-). As a library that is, so the rest of us can use it
__________________
"I.T. gets the chicky-babes" - M. Kelly
bakefile | vim

Last edited by zacs7; 06-09-2009 at 03:14 AM.
zacs7 is offline   Reply With Quote
Old 06-09-2009, 03:38 AM   #4
and the hat of copycat
 
stevesmithx's Avatar
 
Join Date: Sep 2007
Posts: 393
fun game.
AIs are too tough though.
I guess the best strategy to progress is to barricade the AIs and immobilize them rather than evade them and avoid getting hit.
Good work dude.
__________________
Not everything that can be counted counts, and not everything that counts can be counted
- Albert Einstein.
stevesmithx is offline   Reply With Quote
Old 06-10-2009, 04:24 PM   #5
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,629
Quote:
It's fun, especially when you co-play with the AI.
Yeah, it's nice if you make your player an AISimple. The AISimple always tries to go straight if possible and only turns if there's an imminent collision, so it doesn't interfere much with you (and it's almost impossible to crash ).

Quote:
I can see why you stopped using CMake, I don't like it anymore either ;-).
Hey, it's not too bad. Beats autoconf anyway. What do you use now?

But I used an ordinary Makefile here because CMake seemed like overkill.

Quote:
I was shocked to see how small your AI code is...
Yes, that was part of the plan. I tried to design it from the ground up so that a Player didn't care what was controlling it.

Quote:
Now all you need to do is wack xuni over it ;-). As a library that is, so the rest of us can use it
. . . that would be interesting. Probably not going to happen, though, unfortunately. You might be interested to learn though that for my latest project (callis) I'm writing a C++ GUI library for the SDL . . . .

Quote:
fun game.
AIs are too tough though.
Thanks. Yeah, they're really difficult to beat. There is a way, though. Every time the AIs move, they go in the direction that has the most "room". You can fool them into going into a room with what appears to be an exit (leave two rows in/out) and then seal it off.

Sometimes the best strategy is to hope that the AIs will crash into each other, though. :P

Glad you guys liked it. Feel free to add a rand()%50 to make the AIs do stupid things every now and then . . . .
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, etc.

New project: nort
dwks is offline   Reply With Quote
Old 06-11-2009, 06:41 AM   #6
The wheel reinvent0^r
 
hauzer's Avatar
 
Join Date: Aug 2008
Location: Србија
Posts: 115
This is a great game to kill time. Very fun indeed.
__________________
I reinvent the wheel to understand how it works.

Platform:
Windows XP SP2 Professional Edition
Compiler: GCC 4.3.0
Editor: Notepad++ 5.4.2
Notes: Successfully using MSYS, loving my Windows makefiles. Never, ever use Cygwin.

--Quotes--
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
hauzer is offline   Reply With Quote
Old 06-13-2009, 01:11 PM   #7
Hail to the king, baby.
 
Akkernight's Avatar
 
Join Date: Oct 2008
Location: Faroe Islands
Posts: 713
omg this game is so awesome

Me and my friend were playing on the same keyboard, like multiplayer, and we literally laughed so much we couldn't breath xD This is not offence, as we didn't laugh AT the game, just AT ourselves and how much retarded stuff we did xP ofc we added some of our own humor to it, as in, saying funny stuff, but still, great game It's simple, it's fun and it's cross-platform, 10/10 from me
__________________
I deny the Holy Spirit; burn me.

http://blasphemychallenge.com/ <- Do you dare?
Akkernight is offline   Reply With Quote
Old 06-16-2009, 08:55 AM   #8
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,629
Glad you guys like it.

I must admit that I agree it's much more fun in multiplayer. It's pretty hilarious. I'm not sure why, but it is.

One of these days I'll have to add in third/fourth multiplayer controls. Though I don't know how well that would work on one keyboard.

Anyway, see you later.
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, etc.

New project: nort
dwks is offline   Reply With Quote
Old 06-19-2009, 12:08 PM   #9
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,629
Since theprogrammingsite is down for a while (I'm sorry . . .), I've attached the nort archives to this post.

Just rename them to remove the .txt extension.

I really sorry about theprogrammingsite -- I'll try to get it up as soon as possible.
Attached Files
File Type: txt nort-1.1.tar.gz.txt (274.7 KB, 30 views)
File Type: txt nort-1.1-win.zip.txt (342.6 KB, 34 views)
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, etc.

New project: nort
dwks is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Source / Semi Open source game idea. Help needed CaptainPatent Projects and Job Recruitment 10 05-16-2007 10:44 AM
game engine advice? stien Game Programming 0 01-23-2007 03:46 PM
how do the game engine and the api interact? Shadow12345 Game Programming 7 06-05-2002 10:06 PM
My Maze Game --- A Few Questions TechWins Game Programming 18 04-24-2002 11:00 PM


All times are GMT -6. The time now is 08:27 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22