Thread: nort, yet another tron game

  1. #1
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057

    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]
    Last edited by dwks; 05-27-2009 at 12:03 PM.
    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, nort, etc.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Just thought I'd post a belated screenshot.
    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, nort, etc.

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    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
    Last edited by zacs7; 06-09-2009 at 03:14 AM.

  4. #4
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    587
    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.


    No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
    - Herbert Mayer

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    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 ).

    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.

    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.

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

    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, nort, etc.

  6. #6
    Registered User
    Join Date
    Aug 2008
    Location
    Belgrade, Serbia
    Posts
    163
    This is a great game to kill time. Very fun indeed.
    Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
    What profit hath a man of all his labour which he taketh under the sun?
    All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
    For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.

  7. #7
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    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
    Currently research OpenGL

  8. #8
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    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, nort, etc.

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    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.
    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, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. Open Source / Semi Open source game idea. Help needed
    By CaptainPatent in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 05-16-2007, 10:44 AM
  3. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM