This discussion is archived
2 Replies Latest reply: May 9, 2011 1:31 AM by gimbal2 RSS

Question about game programming

860174 Newbie
Currently Being Moderated
Hey guys,

First of all i would like to apologies if i have posted in the wrong section.

The Game

A friend of mine suggested that we should design a tower defense game for our 2nd year project. It sounds fun, but we are not sure where to begin from. We have decent amount of experience in java 2d, Worked on projects like Chat client(100% custom interface) paint program (Drawing program) etc. I have some questions regarding Developing games in java.

First of all if you haven't played tower deface games, i suggest you do so here. The game is similar to that.

Questions

What data structures should be usefull in tower deface games?

For the performance of the game what Image types should be used i.e jpeg,png,gif?
NOTE: our animation will be done with frames, i.e several images of characters moving And changing between that according to the time The enemies move.

Any tips on performance tuning?

This is pretty much i would like to know.

I Appreciate everyones Help

Cheers Guys
Harmy
  • 1. Re: Question about game programming
    796440 Guru
    Currently Being Moderated
    857171 wrote:
    What data structures should be usefull in tower deface games?
    That's like asking "What kind of fasteners will be useful when building a house"?

    There's not much correlation between the very high-level nature of the app and the very low-level data structures used in the code. There's a very high probability that you'll use Lists, Sets, and Maps. You may also use Trees, Heaps, or other, more esoteric structures. But that doesn't tell you anything. Nor should it. Implementing this little section of the game over here in this particular way you might use a list, but then, implementing it slightly differently, you might use a Set. Neither is inherently more common or more appropriate in "deface games".
  • 2. Re: Question about game programming
    gimbal2 Guru
    Currently Being Moderated
    857171 wrote:
    Questions

    What data structures should be usefull in tower deface games?
    An object oriented structure. You're using Java after all. What that will exactly look like depends on how you are going to write your code. There is no "one data structure to rule them all", nor should you be thinking in terms of data structures anyway. Birds eye view; high level architectural design first. Then you can start to fill in the low level code details.

    >
    For the performance of the game what Image types should be used i.e jpeg,png,gif?
    Doesn't matter, once loaded it is a buffer of 32 bits pixels, unpacked. I would use PNG because it is lossless and supports transparency.
    NOTE: our animation will be done with frames, i.e several images of characters moving And changing between that according to the time The enemies move.

    Any tips on performance tuning?
    Don't use Java2D, use an OpenGL API like JOGL or LWJGL. For LWJGL there is a framework called Slick which is specifically built for hardware accelerated 2D games and it also gives access to OpenAL for sound (through LWJGL).

    Seriously, Java2D is a touchy API as you may already have found out. You need to know exactly how it operates under the hood if you want to prevent yourself from getting in its way and then you still don't have a guarantee that what happens on system A will repeat on system B or C. It is good for generic drawing tools where speed is not of the essence, but for a game that has to churn out 50/60 FPS you are better off using APIs built for gaming.

    Speaking of sound: don't reinvent the wheel, use this: http://www.java-gaming.org/index.php/topic,20271.0.html


    And finally I would dig through the performance tuning forum of javagaming.org:

    http://www.java-gaming.org/index.php/board,20.0.html

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points