Slashdot Mirror


Crash Course in Game Programming?

Lullabye_Muse asks: "I want to write a game program for an independent research class I am taking at my High School. I have until June to deliver a final product or a good demo. I'm somewhat new to programming and will be doing work at home, and at school (Linux and Windows, so cross platform OSS is best). What is the best language to learn to code games in, and do you have suggestions for any useful sites, on game programming?"

36 of 142 comments (clear)

  1. New To Games? by johnkoer · · Score: 4, Insightful

    Since you said you are new to programming, you might want to consider taking on an OSS game that is already out there and modifying it to suit your purpose. It will help you learn a lot of the basics of programming, but it will also give a great starting point.

    If you are dead set on writing an entire game yourself, best of luck to you. Even for an experienced programmer, throwing together a game (or even a demo) in three - four months is a feat.

    1. Re:New To Games? by abradsn · · Score: 2, Informative

      I agree. And to add to this comment, if you are still dead set on writing a game, use the highest level langauge you can find. Since you are new to programming, you will want to use Visual Basic, or C#. They are the easiest to learn in the shortest amount of time. Keep in mind that a computer programming course in college is a few months long. You will be hard pressed as it is just to learn the programming skills necessary to write a game. The best advice on a short project is to let performance fly to the wind. If you see two solutions and one performs well but takes more time to code, just do it the other way and save that time. For example, instead of using a binary tree, just iterate over every element in the array. If some has just read this part of the comment and skipped the rest of the comment, please re-read the rest of the comment. Thanks.

    2. Re:New To Games? by _pruegel_ · · Score: 4, Insightful

      I disagree. I believe modifying most OSS games out there requires more knowledge and most importantly more time and effort than writing a simple game from ground up. Those games might have huge code bases and usually there is little documentation especially for starters.
      The author of this "Ask Slashdot" did not mention "First Person Shooter" or even 3D at all. And there are games which are very simple but still fun. Games like Pong, Mine Sweeper, Snake and many more can each be done in a couple of hours. There are even programming languages made for simple game development although I would prefer a "real" language like Java or Python. I once wrote a small game to learn Tcl/Tk and that was fun and I did it in less then a day.

    3. Re:New To Games? by JohnFluxx · · Score: 2, Informative

      I second the disagreement.

      For my degree project I took freecraft and made it 3D and make it client-server. Looked nice.
      But I spent most of my time fighting the code. Not because it was particulary bad or anything, but because I had to convert it all over to C++ compatible from C (there are incompatibilities. I hit every one I'm sure), fight the Makefile's (at the time they had their own custom make system), fight event-loops (freecraft and the graphical engine), and so on.

      It turned out looking pretty nice, but I got poor marks (relatively - it was 68% when a 1st is 70%. But I was getting 75+% in everything else, so...). I attribute the poor marks partly to be unable to really explain where my time and code was. "Well I spent a week adding this c++ library to the makefile...".

      As a side point, I never bothered to release my code. It required so many libraries that it was a nightmare to set up to compile.

    4. Re:New To Games? by iocat · · Score: 2, Informative

      No offense, but I say screw that -- get a GBA emulator and development environment at GBA dev , and you can work cross-platform with all F/OSS on some hardware that has lots of easy graphic capabilities and input methods built in. Plus there are tons of well commented demo apps that will get you up and started in a flash. PCs are too complex for a first project -- GBAs are more limited and easier to get your head around.

      --

      Dude, I think I can see my house from here.

  2. SDL Graphics library by (trb001) · · Score: 4, Informative

    Languages aside, SDL (Simple Directmedia Layer) is a great library for graphics/sound/network programming. Simple, easy to learn, cross platform. For a class project, it should do the trick.

    I'd suggest C++ for programming languages, but that's probably just because it's what I've used for years.

    --trb

    1. Re:SDL Graphics library by tekiegreg · · Score: 2, Interesting

      you suggest C++ with good reason, next to Assembler; IMHO it's one of the best languages for game programming. Granted game programming language pluses are speed and granular level control, at the sacrifice of user friendliness.

      Then again if you're programming for a deadline project, maybe a simpler project coded in a higher up language, If you're a C++ programmer and using Windows, think C#, all the syntax none of the headaches though a bit slower since you're compiling to IL. If you're in a *nix environment I'd consider a simple Java game with the same considerations (similar to C++, none of the headaches and slower). Choose appropriately.

      --
      ...in bed
  3. Easy by Apreche · · Score: 3, Informative

    Since you are doing this in high school, and want it cross platform, it obviously doesn't have to be a high performance 3D super game of awesome. So make it in java.

    The design pattern for most simple java games is model view controller. You create an object oriented game model with map, player, item classes etc. Then you create a view, or the gui that looks at this game model and translates the data into graphics or text on the screen. Then the controller portion interprets player input and modifies the game model accordingly.

    This is a very good pattern to follow for games, especially for research projects. This is because the game itself usually isn't the research, but some underlying CS principle or algorithm. And this makes very simple cross platform games to which you can attach or embed your real research very easily.

    You can also follow this same approach with python, or ruby or even C++. Python might even be a better choice since it might beat java in performance and is used quite often in the game industry.

    --
    The GeekNights podcast is going strong. Listen!
  4. Get Python + Pygame by fredrikj · · Score: 5, Informative

    You should definitely get Python and Pygame. Python is both easy to learn and more powerful than most languages. Better yet, there are plenty of example games to study. If you want to do 3D, also get PyOpenGL, and get the started with the NeHe tutorials (Python code available).

    The downside with Python is that it can be slow (a fact that can be remedied to some degree, but not entirely, by also installing Psyco). Fortunately, the slowness doesn't matter (unless your aim is to compete with the next id Software engine). I've written a simple engine for a 2D platformer in Python myself, and even with a game logic and collision detection, 90% of the processor time is spent blitting the graphics to the screen. Since Pygame (written in C) does the rendering, using C++ for your game code won't provide any big advantage.

    Good luck!

    1. Re:Get Python + Pygame by fredrikj · · Score: 2, Informative

      To clarify, the 10% of processor time I got for my game code was enough to do what I wanted. If you use OpenGL, which uses the graphics processor for rendering, you'll instead get 90% of the processor time. That way there will be a bigger relative advantage for C++, but it'll also be even more likely that you'll get enough time to do what you want in Python.

    2. Re:Get Python + Pygame by elhedran · · Score: 2, Informative

      yep, screen.blit works, and pretty fast if you remember to limit the source rect to where you want to copy from. (although that may just be my machine).

      Of course, you still have to 'update' the bits that have changed, but for the rest it should be faster than doing a full update.

      while 1:
      for event in pygame.event.get():
      if event.type == QUIT or \
      (event.type == KEYDOWN and event.key == K_ESCAPE):
      return
      keystate = pygame.key.get_pressed()
      direction = keystate[K_RIGHT] - keystate[K_LEFT]
      if direction == 1:
      screen.blit(screen, (10, 0), (0, 0, screen.get_width() - 10, screen.get_height()))
      pygame.display.update()
      if direction == -1:
      screen.blit(screen, (0, 0), (10, 0, screen.get_width() - 10, screen.get_height()))
      pygame.display.update()

  5. It's going to need to be simple.... by Grygonos · · Score: 5, Insightful

    If you're new to programming, and actually want to code this yourself, it's going to need to be a simply game with little to no graphics. Implementing a OpenGL game is NO trivial task. A game I did in Java was the simple squares game where the object is to arrange the pieces like so .. 1 2 3 4 5 6 7 8 * So I wrote a Java app that would mix up the squares like so 4 7 2 * 1 8 6 5 3 and allow you to move the pieces around via the *blank* square. This still wasn't trivial, especially for someone new to Java, much less programming in general. Not trying to disparrage your efforts, but being new to coding is probably your biggest disadvantage.

  6. Back in my day by madaxe42 · · Score: 3, Funny

    We used to program games in Basic, on BBC Micros! First game I ever wrote was a donkey kong clone, and a poor one at that - about 1500 lines of code, max.

    Also, back in my day, we had to burn our feet as fuel, we were so poor. And we had no monitors. And we only had one keyed morse-code based keyboards. Bah!

  7. Try blender by orasio · · Score: 4, Informative

    http://www.blender3d.org/
    http://www.blender3d.org/cms/Game_Blender.365.0.ht ml

    It's a 3d design package, that gives you a game engine, so you could have the graphics part solved, and can worry just about the actual game. I believe you can program for it with python.
    It works on MSWindows, GNU/Linux, and other platforms, and it can generate .EXE or web 3d games viewable with its own (small) plugin.

  8. My Suggestion as a Game Programmer in HS by Prien715 · · Score: 4, Interesting

    My suggestion would be Java, simply because the graphics libraries are pretty decent and it's not hard to write a decent GUI. Additionally, it's cross-platform and would probably help you in the real world later.

    But the real question is, how much experience do you have currently? I started programming in HS by doing games on those little calculators (TI-81 to 85 completely self-taught) and enjoyed the experience so much I decided to do CS in college (graduated last year). If I were in your shoes, you may want to think small. Many of the early video games were text-based, many made by one person. Nowadays due to complication, you need teams. So it may not be a bad idea to write something simple and textbased in whatever language. Text-based doesn't need to mean uncomplicated or compromised gameplay; chess, othello, hearts, and dungeon-crawlers were all very popular and I still know people who prefer these over newer games.

    --
    -- Political fascism requires a Fuhrer.
  9. Andre Lamothe by vasqzr · · Score: 2, Interesting


    Buy a couple of his books. You can find them dirt cheap at discount book stores or eBay.

    If you want to go cross-platform, pick up his Java book. You could be writing primitive games in a week.

  10. Game sites by magic · · Score: 4, Informative

    Check out the community sites garagegames.com, flipcode.org, and gamedev.org to meet other people in similar situations. The forums are really good for getting quick answers to beginner questions.

    -m

    1. Re:Game sites by vasqzr · · Score: 5, Informative


      Don't forget http://www.gamasutra.com/ and the PCGPE, even if it's older than dirt.

  11. SDL, C and Pygame by Electrum · · Score: 4, Informative

    Without a doubt, Simple Directmedia Layer (SDL) is the best platform for writing cross platform games. It provides a very clean abstraction layer to the high performance APIs (DirectX, etc.) available on each platform. Many people who code only for Windows use it since the API is a lot nicer than the COM based DirectX API. A number of commercial games have been ported to Linux using SDL.

    For serious game programming, you need to learn C or C++. I would guess that 99% of all commercial games for the PC are written in mostly C or C++. This doesn't mean you need to write all of your code in a low level language. Even the original Quake used an interpreted language (QuakeC) for the game logic. But almost no language other than C or C++ will provide the speed or memory usage necessary for most commercial games.

    If you'd rather concentrate on writing your game rather than learning C, try Python with Pygame. Pygame is a Python binding to SDL. It is fairly fast since all the low level graphics stuff is done using SDL. Certain things will be slower in Python (collision detection, physics, etc.) but most code isn't speed critical anyway. Some things will be harder in Python since it's easier to manipulate bytes and bits in C.

    Also check out PyOpenGL if you want to learn OpenGL. It can be used in conjunction with Pygame. I used this when I was learning OpenGL and it's quite nice. The API is almost exactly like the C based API, but it is easier to use. At least one of the popular OpenGL tutorials has been ported to PyOpenGL.

  12. Game Blender by manjunaths · · Score: 2, Insightful

    If you are new to programming then don't program, as simple as that. Or in this case program as little as possible. So use Game blender http://www.blender.org/ download the blender game demos, and check them out. You can get up to speed in days, also the logic is scripted in python, which is easy to learn. You can get lots of help on the web, on IRC, irc.freenode.net, #gameblender and finally you can get lots of premade scripts/blender files for things like fps (first person shooter) motion etc.,
    Keep it simple, it should be one level or two atmost.
    Even things like shooting arrows at moving targets are fun, the arc of the arrow etc., teach you physics and for the player it takes time to learn, so they get hooked.
    Have a goal, the user at the end needs to do something like rescue a princess or find treasure.
    No OpenGL, SDL and C++. Period. That is simply impractical. You'll end up coding the engine and won't have time for art or game play planning.
    If you really want to do something like that look at CrystalCore http://crystal.sourceforge.net/tikiwiki/tiki-index .php?page=Crystal+Core (#CrystalSpace on irc.freenode.net) or nebula device. But good luck on that.

    --
    Slashdot: Tabloid for the nerds. Stuff that doesn't matter.
  13. Good Links by bios10h · · Score: 2, Informative

    Disclaimer: it is my website. I'm not plugging my website's links collection; I just think it might be useful to starting developers. I have a pretty collection of websites useful for game programmers.

    Click here and under 'Game Development'...

    I highly recommend FlipCode and GameDev.net for game-programming-related content. They have tons of stuff for beginners.

    With the information you provided, it is pretty hard to direct you to *the* website you need because we don't know if you wanna do 3D or 2D, Ogl or DX, game genre?

    There are also some crappy 'game toolkits' but if you know how to write C++ code, I'd recommend you stay away from these things.

  14. Make sure you *really* want to PROGRAM games... by _xeno_ · · Score: 2, Interesting

    You need to ask yourself one thing before starting to learn to program: Do you want to program games, or just make games? The two are different.

    A lot of gamers wind up deciding "hey, I want to program video games!" at some point, without realizing that what they really want to do is make games. If you don't know anything about programming, then you should start by learning the basics of programming and forget making video games for a while. You need to understand the basics first, before you can start doing anything complicated.

    If you really do decide to make video games, I'd highly suggest making a couple of really simple games first. Something like hangman, where you just take a list of words and make the user enter letters until they "guess" it. This will teach you the basics of keyboard input and graphical display without having to worry too much about speed or game mechanics.

    I'd suggest starting with Java too - maybe grab Eclipse as your IDE, or just use a simple text editor. This solves the "cross-platform" part, and as long as you understand that you won't be creating Quake in it, you shouldn't be too disappointed. (You could, of course, also try using Mozilla.) It's similar enough to C and C++ that you'll should be able to pick up those if later you wind up making a game in C.

    But based on your post, I'd suggest learning more about how to program in general first. Take some classes, if you can. Learn the basics. Learn about basic data structures. This will give you the ground-work you need to create a game, as well as help you determine if programming is really for you.

    --
    You are in a maze of twisty little relative jumps, all alike.
  15. Get Python + PyOgre by Clay_Culver · · Score: 2, Informative

    If you are going to do 3D game programming, I would also suggest you look at PyOgre. Ogre is a powerful open source graphics engine written in C++. You can download the python bindings for it here. Download it and check out the demos that come with it (the demos are placed in you python directory in a folder called ogredemo).

    Linux bindings are not ready yet, but they shouldn't be too far off into the future. You should check the the API Reference and Manual for most starting information, and use the ogre Wiki and forums for most questions you have.

  16. putting flamesuit on...but how about flash? by avi33 · · Score: 4, Interesting

    Before the locals gather their pitchforks to run me out of town, here's why:

    -If you don't know much about programming, even something basic like vectors or graphics libraries could be more than a little daunting. Flash makes graphics dog-dumb easy, leaving you to focus on the logic. A lot of the abstractions (game speed, display parameters, collision detection) can be handled easily, leaving you to learn how to program.

    -You can do some OO programming with Actionscript, so you can start with a simple program, and when you get skilled, learn how to extract that functionality into libraries or classes.

    -You should be able to focus on some simple programming aspects like game physics, or making it fun (which doesn't have much to do with programming).

    -There are a zillion sites out there with bits of code that you can learn from and modify. Granted, lots of it sucks (i.e. it works, but it will not show you how to be a 'good' coder). Offhand, I don't know what to recommend to become a good coder, but at the least, I'd recommend plowing through at least the first 3 chapters of Bruce Eckel's Thinking in C++ (free online). Once you get through pointers and address references, actionscript will look like child's play. Sure, there are sites out there with sample PyGame/Java/etc. code, but Flash code is easier to cherry pick and drop in.

    -You have to realize that what you're doing is similar to saying "I've never turned a wrench before, but I want to build a car in 4 months." Game programming can be exceptionally difficult on a number of levels.

    1. Re:putting flamesuit on...but how about flash? by zeasier · · Score: 2, Informative

      I agree that Flash is your best option, especially if the class is only one semester long. Video games make so many otherwise boring subjects in high school interesting. The math and physics teachers will thank you, because when their students ask why they need to learn those subjects they will just say, "Because then you can take can take a class on video games next semester. Woot!" It's important to lower the bar so the class is accessible to as many students as possible.

      If you don't use Flash you should already have many your libraries completed so students don't have to do a lot of work to get results. If you do use Flash try to make it's proprietary shortcomings painfully obvious but don't directly refer to them. That way your students will eventually revolt against Flash and will think they are the first generation to support free and open source software.

    2. Re:putting flamesuit on...but how about flash? by dj_cel · · Score: 2, Informative

      I was thinking the exact same thing whe I read this post, I recently graduated an animation program and one of the courses was a two semster run of Flash and fairly extensive actionscripting. flashkit.com has some great examples of prebuilt games to learn from quickly, as well as tutorials for non-action scripters to get into the nitty gritty. I seriously think this is the most viable option for the time frame and experience level.

      --
      Those who can make you believe absurdities can make you commit atrocities. - Voltaire
  17. General Advice by American+AC+in+Paris · · Score: 2, Interesting
    Start small, and don't arrange the furniture before you've built the house.

    Push all the "great ideas" to the back of your head, for now. They'll only get in the way at this point. Lay out a very basic game design and write it down. Do this both in plain English and in pseudocode. Resist the temptation to dive into feature details; don't go on about how different guns will do different things, and how there will be ten different types of enemies, or how you want the explosions to be green and shimmery. For now, make it simple: one guy, one gun, one type of enemy, one behavior. Note that this doesn't mean you shouldn't design for such expansion, though--be thinking about how to go about building your code to allow all sorts of things down the road, just don't get mired down in the minutae.

    Build a basic, working prototype. Get input working; get drawing working; get audio working; get physics working; get collisions working; get interaction working; get menus and user interface working. Use placeholder graphics and sounds for now. Once you've made a good, solid, stable engine, then start working on graphics, audio, backgrounds, et. cetera. A good way to tell if you've reached this point is if you can play your ugly, bare-bones game and enjoy it. If you don't enjoy the game without the flashy stuff, adding finished content will just be like putting lipstick on a pig.

    Finally, stick to 2D. You'll learn more about the "game" part of making games if you don't need to wade through all the extra crap you need to know to work in 3D. (It is also much faster and easier to create 2D content than it is to create 3D content, but again--that comes after you've got a solid engine in place...)

    --

    Obliteracy: Words with explosions

  18. Re:Flash by pezpunk · · Score: 4, Interesting

    it's funny, but you'll probably get flamed or modded to oblivion just for posting about the only reasonable solution to his conundrum. i seriously doubt this kid is going to learn the Java API and throw together something on the scale most of these people are talking about in the 3 months or so of after-school time he has to work with.

    Flash is a great medium for 2D games. the graphics are drag and drop, and the actionscripting is a perfect introduction to handling the logic associated with managing a game.

    but, this being slashdot, anything mentioning Flash in a positive light will probably get modded downward and derided by the community.

    --
    i could live a little longer in this prison
  19. I know I will probably be modded down... by cr0sh · · Score: 3, Informative
    I would say try your hand at writing javascript games - no, I am serious! Amazingly enough, if you have a recent browser which can support javascript and CSS (ie, DHTML) - you have everything needed to create a basic game. Drop the game "page(s)" on a webserver and add in some CGI processing, and you have a way to save/load information as well (game save points, scores, levels, etc).

    Javascript, CSS, and DHTML are each well documented on the internet, and there are numerous books to get you started, as well.

    Finally, before you cry out "but Javascript won't let me create a cool game!" - take a look at this:

    Illumia RPG

    and especially this:

    TRIGLAV RPG

    --
    Reason is the Path to God - Anon
  20. Re:Flash by Loacher · · Score: 2, Interesting

    I third your opinion.

    Flash is easy if you have no experience, and there are lots of popular flash games. One of my favourite is curveball (just google it), not to mention yeti games.

    I made my first flash game some time ago, and it is still a challenge to play. Took me only a couple of weeks, based mostly on the excelent tutorials at kirupa (google it).

    And in my limited experience, actionscript is a great gateway language. At first, I found it really easy to do very simple stuff using the Flash GUI.

    Soon that was not enough, so I started playing with actionscript in 'expert' mode. I even managed to create a few nice data structures there. But then I wanted to dynamically load stuff, so I learnt about URL variables, XML, etc...

    Then I wanted to keep scores, so I learnt PHP and SQL. And to integrate my little flash experiments into a website, so I learnt HTML and CSS, which led to a little JavaScript.

    At that time, my flash projects were so bloated and slow, that I grew frustrated, and started learning other languages, like java, perl, python, and just starting now, C++.

    Give Flash a try, it does have its legitimate uses.

  21. Ignore everything else you've read here. by Yaztromo · · Score: 5, Informative

    Ignore everything you've read here about graphics and sound libraries, existing game code, existing game libraries, and (for now), choice of languages. If you've never done any programming before and intend to use this as a vehicle to start programming, read this first. Clear your mind, and ignore the details for now.

    More important than anything else you can ask right now is to find out what you're trying to achieve. Saying "I want to write a game" isn't specific enough, as humanity has invented tens of thousands of games over the years using all sorts of different mechanisms (cards, dice, boards, pieces, pots, beans, joysticks, vector graphics, role playing, puzzles...). So first, figure out what you want to write.

    Next, take the game you want to write, and stick it on a mental shelf. Everyone would love to write Grand Theft Auto: San Andreas as their first game, but it isn't going to happen.

    My first piece of advice: don't try to create a new game for your first project. Take something you already know, and know well, and implement it first. Try to pick something that has finite states that are easily describable, and then work from there. Preferably something that has mechanical rules and won;t require too much "artificial intelligence" on the part of the computer (ie: you may know Chess really well, and it has a finite number of pieces, the logic required to decide how to have the computer move is exceedingly complex. Companies like IBM have spent millions trying to perfect such algorithms).

    Two classes of games which are typically excellent candidates for first projects are card and dice games. Both are fairly easy to program, as they involve numbers, and have a finite number of possibilities (ie: 52 cards, 6 sides per die). When selecting a game to implement, find something you enjoy, but preferably something that again, won't require an M.Sc. in Artificial Intelligence. Blackjack is an excellent candidate (many Universities use this as a first year programming assignment anyhow, so you'd be getting a leg-up on others if you plan on persuing Computer Science in higher education), as the compter can act as the dealer, and has very specific rules it always follows (requiring no AI at all). Don't worry about how many times the game has already been done -- your goal is to learn programming, and not to create the next Halo 2.

    Once you've selected a good candidate game, you need to code the game mechanics before you code anything else. So again -- forget everything anyone here has told you about graphics and sound libraries, or even languages. You won't need these until later.

    Continuing with Blackjack as an example, here are some of the things you need ot think about first:

    • How will the computer store the information about a card (and again, don't think about the graphics for the card at this point -- right now you need a way for the computer to be able to tell the difference between a 3 and a Queen, a Diamond and a Club)?
    • How will you group cards together? (For the hands, the cards remaining in the desk, etc.)?
    • How will you perform actions on the cards such as shuffling?
    • What are the win states? What are the lose states? What are the draw states (if any)?
    • What are the rules the computer has to play by?
    • What options should the user have at each junction (ie: draw, hold, split, double)? When is each approperiate?

    If you can get all of this down in code, you'll be off to an excellent start. From here, you can graft whatever user interface you want atop the "game engine" you've just created. And you'll find you'lll learn a lot about the basics of programming (variables, arrays, functions, objects, random numbers, sorting, comparisons, etc.)

    You'll probably want to be able to test things out as you go along, which will require a minimal user interface. To start, you'll probably want to use just text to represent everything (ie: "10 Hearts", "A Spades", etc.).

    1. Re:Ignore everything else you've read here. by Ramses0 · · Score: 3, Interesting
      I have to agree. I'm currently making Dominoes as an online board game. I've been programming professionally for ~5 years now, have 4 years of college, 2 years of High School, and 4-5 years of self-study in programming. Programming a complete working version of anything can be difficult, so keep it simple. As an example of what you might end up facing, here's a dump of my latest directory structure:

      domino.php --- 1k
      dominoes.php --- 3k
      dominoesBoard.php --- 10k
      dominoesGame.php --- 13k
      dominoesGui.php --- 18k
      dominoesHand.php --- 2k
      opHandler.php --- 3k
      rules.php --- 2k
      test_domino.php --- 1k
      test_dominoes.php --- 1k
      test_dominoesBoard.php --- 9k
      test_dominoesGame.php --- 10k
      test_dominoesHand.php --- 10k

      WRITE YOUR TESTS! Notice almost 50% of my code is tests (and I feel that it's not enough, I currently got ahead of myself and need to catch up on my tests before I feel comfortable adding more functionality).

      I would do a lot of thinking about what the parent poster said, specifically: Start Simple. Think About Your Win/Lose Conditions.

      I'd like to add the note: Write Tests. To continue the blackjack example, what happens when a user has an "A, J" in their hand? (blackjack). How can you test that? Write a test for it. What happens when they have "J, K, Q" in their hand? (bust) How can you test for that? Write a test for it. What happens when they run out of money? What happens when they try to bet too much money? A negative amount of money? Write tests and repeat as necessary.

      A whirlwind tour of my dominoes layout (this is to back-up the parent poster about the game libraries, and mechanics, etc):

      • domino - a single domino
      • dominoesHand - hand containing many dominoes
      • dominoesBoard - all the dominoes that have been played
      • dominoesGame - all the win conditions, lose conditions, points, drawing, etc (game logic)
      • dominoesGui - mostly HTML, and a lot of drawing functions
      • dominoes.php - what the user ends up interacting with (mostly passes off to dominoesGame)
      • test_* - a bunch of tests that load up the other files, use them, and print out "pass/fail" for each situation


      For the GUI code, it's mostly HTML text to display stuff to the user, which is why it's so big. But even then, recognize that the bulk of the work is in stuff that the user doesn't even see (Board, Game) ... good luck! Ask questions to your teachers, and WRITE YOUR TESTS! :^)

      --Robert
  22. vote for python + pygame by neura · · Score: 2, Informative

    If you want to do something simple and don't know how to program at all, this is definitely the way to go.

    Python is not only easy to learn, it's a great starting language. (enforces proper formatting, doesn't use crazy things like ; line endings ;)

    Python.org Beginner's Guide
    Dive Into Python (free on-line book, well written IMO)
    and of course the http://pygame.org/ which the parent poster already said.

    I would NOT suggest using PyOpenGL if you're new to programming, it's an unnecessary layer of complexity for very simple projects. Use it after you know how to program and have created at least a few simple things already. :)

    Anyway, just wanted to give my vote for Python.

  23. thoughts from a teacher by entropiccanuck · · Score: 2, Insightful

    As a high school programming teacher, I'd highly recommend you first work on a trial program. For someone new to programming, a 3-4 month project is complex. Write a smaller, non-trivial program first, allowing yourself to get a feel for the language, structures, techniques, etc. (note: this post presupposes "somewhat new to programming" + "high school" = "start from the beginning." If you're more experienced, good job with the modesty and no offense intended.)

    Some of my kids want to jump right in with a GTA clone or Zelda or something ... take a look that the closing credits for those games, it's not something you're going to be doing by June 2006, let alone 2005.

    Yaztromo, in a helpful comment somewhere above, mentioned starting with Blackjack, with some suggestions for going about that. An ASCII single-player version is relatively simple. Other possible intro projects would include some other card games, Mastermind, Simple Simon, Yahtzee, etc. Keep it simple to start-- graphics, sound, languages, even the computer are secondary here. Test as you go: in the blackjack example, get a card deck implemented first, then add draw/hold, then double, then split. Get something down on paper that a mindless automaton can follow and successfully complete it's task. Then substituting a computer for the dummy is simple, and programming is just translating your instructions efficiently. Once you have a project like this completed, you'll better understand game complexity, allowing yourself realistic goals.

    Your final project could be something entirely different, or you could extend your intro project to include multi-player (hotseat and/or online), graphics (very extendable), or AI, which is also very extendable. And there's always optimization, which is infinitely extendable. The nice thing about this path is you know you'll have something to be proud of come June ... if you finish ahead of schedule, add features! (practical note: keep version backups!) If you head in a different direction, classic arcade games can provide a wealth of inspiration, ie., Tetris (my pick in this category,) Galaga, Asteroids, Breakout, etc. Note that these are real-time games, which are typically significantly harder, and use more math/physics.

    On the language issue, I teach with Python. It's clean, powerful, and easy to learn, and my kids seem to like it. Use Pygame as well if you go this route. I introduce some of my more advanced students to Java later in the year (last quarter) if they're interested, which some like, some don't. I hesitate to recommend it if you don't have any previous programming experience, especially given your timeframe. However, if you are really interested in Java, consider trying this: the first Java assignment I give is the re-implementation of a previous Python project, typically something like one of the games mentioned above. This would give you a feel for both languages, though as a caveat it would take more time from your final project.

    For resources, the Learning Python and Programming Python (O'reilly) books are pretty good ... check your library or ebay if your school can't get them for you. On the free side, there's many great Python tutorials and examples online (python.org, pygame.org), though some code examples are non-optimal. Check out pygame.org's link page, and www.lupinegames.com. Since you mentioned "independent study," I'm guessing there's no programming teacher, so I'd recommend joining a mailing list or web community that can fill some of that role.

    Make something you can be proud of. Good luck, and keep it fun.

    Michael

  24. Blender + Python = Games by TeeJS · · Score: 2, Interesting

    I think Blender is an excellent choice here. It's free, cross platform and very easy to get started in. Combinde with Pythin and the info available at GameBlender.org it should be very easy to get a awesome project out quickly. My 11 year old daugher got going with the 3D modeling in an afternoon after watching the online video tutorials.

  25. What is your true goal here? by ralfoide · · Score: 2, Interesting

    That post is probably the best advice I've seen here.

    The most important question I think is

    "what is your true goal?"

    Possible answer include:
    a- something new and original
    b- something really usable
    c- something pretty
    d- a combination of a/b/c?

    Is the goal just to create any game? Being for a class and depending on your TA or professor, I would expect the engine to be more important than the look. (if it were commercial, it would probably be the reverse, ymmv.)

    One important detail is how it should look, depending on your true goal. Be warned that if you are not already a designer (i.e. used to draw manually or with computer tools) then stay away from anything that requires a lot of art.

    Even something as simple as a Pacman clone or 2d vertical shooter requires a lot of art and that can divert a substantial amount of time from your project.
    If it's a class project and what matter is more having a complete usable game with a real engine that just pretty static picture, nobody will care if your pacman looks like a blue circle as long as it can travel around and properly collide with walls.

    Now for the specifics: some people like card games, some others don't. Personally I'm more into 2D games. They can be easy to program. As a start, you can have a look at a basic game I wrote a long time ago (it clones an old Amiga game) and that I regularly port to different platforms (it's a great way to learn a new language and framework):

    http://www.alfray.com/projects/Nerdkill/index.html

    This one is in C# and uses DirectX (desktop) or GDI (PocketPC). The engine was written to reasonably easy to understand and adaptable to other languages or platforms and is somewhat described here:

    http://www.codeproject.com/netcf/cfgamenerdkill.as p
    and
    http://ralf.alfray.com/.izumi/Dev/NerdkillDev

    Technically it could sure be ported to work under Linux using Mono and GTK#, although there's some work there especially if you have to learn these APIs too.
    The whole thing is GPL so feel free to reuse it if you like. I thinking of it more as a way to see how to organize your project (or not.)