So I'm creating a game using Applet and I was wondering what would be the largest resolution I could ever consider for a game to run at 12 frames a second on a typical gaming computer? (BTW: This game is running on a local machine and NOT over the web)

I'm thinking of creating a game similar to Street Fighter.

Recommended Answers

All 7 Replies

Your max res and fps are probably only going to be determined through experimentation. Level of detail, number of objects updating per frame, complexity of game logic interactions and your own coding efficiency are all going to have an impact on performance.

Do you think 900 x 600 is reasonable? I won't know until I finish the majority of my code, so I just wanted something to work off of.

Since I don't know anything about the details of your code, graphics detail, etc. I couldn't really say. Just start with the 900x600 if you like and see how it turns out :) Once you have the rest of the code finished you'll be in a position to tune and tweak.

I agree with Ezzaral. There are java game engines out right now capable of running somewhat comparably to those written in C++, meaning you could code the game to run in higher resolutions and still have it run at normal fps on an "average" gaming computer.

This resolution that your game can run at is dependent on how well you code the game and what graphics you are using. It's hard to give you a suggested resolution without knowing your code.

(sorry for the repeat of you guys above, just clarifying my engine example)

Since it's now all about efficiency, lets see what we can do to make my code more effective.

Well What I'm basically going to do is have a loop and every 1/12 a sec it's going to call the draw method of applet (BTW it's double buffered). When the draw method is called its first going to get the background image to draw. Then it calls all my other classes to draw them selves. To be a bit more clear, all I'm doing is grabbing images from somewhere on disc (hd, cd, what ever) and drawing it using the draw method of Graphics.

One thing I'm thinking of doing to increase the efficiency of my code is to load the images into the classes before having them drawn, so there's no lag due to reading from the disc.

As for controls I'm thinking of having a listener for the key board and depending on the key press, an int is changed, causing a different image to be used when draw is called and then some basic math will done for health and that's it.

If anyone's done anything similar and have some hints, let me know.

Well, one thing as far as your animation loop goes, you generally want to keep track of the time between draw() returns and use that to calc the next time to draw, instead of using a fixed 1/12 second loop. The reason is that updates may different slightly (or even greatly in some cases) and you will get jumpy refreshes if you don't take that into account. There are a lot of example implementation of this out there if you need a reference. Just Google on "Java animation loop" (I don't have any examples here or I would post for you).

Thanks for the advice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.