Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Advanced search

1173573 Posts in 50155 Topics- by 41176 Members - Latest Member: JoshFTL

November 26, 2015, 04:23:47 am

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)[Java] Object/Class Design for Games?
Pages: [1]
Author Topic: [Java] Object/Class Design for Games?  (Read 427 times)
Player 3
Level 10

Segfaulting since 200X

View Profile
« on: May 02, 2013, 07:47:43 pm »

Long story short, I'm trying to figure out what classes I would need to properly keep track of the game.
For example, picking an airplane dogfighting game, using the following classes:

  • Plane - Contains data such as position, rotation, graphic, et cetera.
  • Enemy (extends Plane) - Contains data such as AI and parameters, et cetera.
  • Player (extends Plane) - Contains data such as controls functions, score, et cetera.

Probably a good start on the data itself.
Would there generally be anything else important, like certain rendering classes, sprite loading classes, audio classes, and so on needed?
Level 10

Scary, isn't it?

View Profile WWW Email
« Reply #1 on: May 02, 2013, 07:53:10 pm »

States, so that you can have a menu, and not have the gameplay code mucking it up.

Do I need a signature? Wait, now that I have a Twitter I do: https://twitter.com/the_impmaster
Level 3

Where is my tea?

View Profile Email
« Reply #2 on: May 03, 2013, 04:18:11 am »

You'd probably require an events polling class, events handling classes (like Input registration), a game logic class (doing all the game mechanics), a renderer (duh), perhaps a scenegraph, a physics thingy, rules class, UI class, state class... You'll need aLOt of classes.

  • Cacto Loco! - 'Additional Tunes' (Composer)
  • To be continued...
Maud'Dib Atreides
Level 4

Obsessed with space

View Profile WWW Email
« Reply #3 on: May 03, 2013, 05:47:40 pm »

Player 3, you should have collection classes for your more numerous instance objects that will use class states such as >-Hypothetical> SpriteCollection for SpriteClass.

This is useful for record keeping, searching and sorting, selecting, and general management.

Guy: Give me all of your money.
Chap: You can't talk to me that way, I'M BRITISH!
Guy: Well, You can't talk to me that way, I'm brutish.
Chap: Somebody help me, I'm about to lose 300 pounds!
Guy: Why's that a bad thing?
Pages: [1]
Jump to:  

Theme orange-lt created by panic