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

Login with username, password and session length

Advanced search

1103512 Posts in 45878 Topics- by 37573 Members - Latest Member: yojambo

March 27, 2015, 05:46:16 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)[Java] Object/Class Design for Games?
Pages: [1]
Author Topic: [Java] Object/Class Design for Games?  (Read 380 times)
Player Ʒ
Level 10

"Flagrant Errors" is my middle name.

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