Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

Is 16 classes too much for a Space Invaders game?

I'm making a Space Invader rip off. And, I have 16 classes. Is that too much? Should I cut on some?

CollisionDetection(I dunno about tis one - I mean I already could include all the collision detection in the Entities themselves.)
Input
Interface
MainLoop+GameStates
NPCBulletEntity(Could be put in NPCEntity)
NPCEntity
NPCCrab(Could be put in NPCEntity)
NPCSquid(Could be put in NPCEntity)
NPCUfo(Could be put in NPCEntity)
NPCMotherShip
PlayerEntity
PlayerBulletEntity(Could be put in PlayerEntity)
Resources

Can someone comment on if I should do it or not @.@
Personally I don't think you can have too many classes.. haha It should work fine really. How big is all of it?
A10 CF is no where near 650 Ti boost 2GB. 650 Ti boost eats A10 and ploughes 7750's angus like no tomorrow

(Jul 1, 2013 07:30 AM)Aesthetics Wrote:  You bought a i3 2220

Girlybitchyvoice: That is so bad ass omg.

*sarcasm*

(Feb 25, 2012 02:22 PM)BigDomePiece Wrote:  Personally I don't think you can have too many classes.. haha It should work fine really. How big is all of it?

Well, I have no idea how big it's gonna be. I just sat down and made a class for everything I thought you need a class for.
(Feb 25, 2012 02:19 PM)SIM-524734 Wrote:  I'm making a Space Invader rip off. And, I have 16 classes. Is that too much? Should I cut on some?

Well compare it to most games this is quite small
Well, that's actually what you're supposed to do when programming. Just make the things you think you're going to need and modify them later.
Personally I can see about 10-13 classes for a game like that. I need to learn Java game programming so I can get in on the kind of stuff.
Would you mind listing the classes?
=]
-BDP
A10 CF is no where near 650 Ti boost 2GB. 650 Ti boost eats A10 and ploughes 7750's angus like no tomorrow

(Jul 1, 2013 07:30 AM)Aesthetics Wrote:  You bought a i3 2220

Girlybitchyvoice: That is so bad ass omg.

*sarcasm*

(Feb 25, 2012 02:25 PM)Igame Wrote:  Well compare it to most games this is quite small

Yeah, but it's just a mini-game of space invaders.

(Feb 25, 2012 02:26 PM)BigDomePiece Wrote:  Well, that's actually what you're supposed to do when programming. Just make the things you think you're going to need and modify them later.
Personally I can see about 10-13 classes for a game like that. I need to learn Java game programming so I can get in on the kind of stuff.
Would you mind listing the classes?
=]
-BDP

CollisionDetection(I dunno about tis one - I mean I already could include all the collision detection in the Entities themselves.)
Input
Interface
MainLoop+GameStates
NPCBulletEntity
NPCEntity
NPCCrab
NPCSquid
NPCUfo
NPCMotherShip
PlayerEntity
PlayerBulletEntity
Resources
I could only see putting the collision detection with whatever will be colliding. Besides that, it looks fine.
A10 CF is no where near 650 Ti boost 2GB. 650 Ti boost eats A10 and ploughes 7750's angus like no tomorrow

(Jul 1, 2013 07:30 AM)Aesthetics Wrote:  You bought a i3 2220

Girlybitchyvoice: That is so bad ass omg.

*sarcasm*

(Feb 25, 2012 02:33 PM)BigDomePiece Wrote:  I could only see putting the collision detection with whatever will be colliding. Besides that, it looks fine.

Yeah i'm thinking about that too, but... I don't know.
Would you mind sharing the source once its ready? Im very interested in game programming.
Thanks and good job :)
That is not enough.

Look at how DDD separates things, and then you'll see a lot of classes for small projects.
(Feb 26, 2012 10:13 AM)andrei042795 Wrote:  Would you mind sharing the source once its ready? Im very interested in game programming.
Thanks and good job :)

Yeah, i'll post the source. But, the game will take like what... 2 weeks to make? I don't have very much time atm.
I noticed you have several entities that are essentially the same but have specific differences. I would suggest creating something like "Entity" and other superclasses that you can subclass to all your Entity classes. That way, you don't need to copy/paste code for each of your entities. Something like a isColliding(...) and move(...) and all that in your super class and then extend it to all your specific entities/NPCs. If anything, make more!
(Feb 26, 2012 01:05 PM)randomKID Wrote:  I noticed you have several entities that are essentially the same but have specific differences. I would suggest creating something like "Entity" and other superclasses that you can subclass to all your Entity classes. That way, you don't need to copy/paste code for each of your entities. Something like a isColliding(...) and move(...) and all that in your super class and then extend it to all your specific entities/NPCs. If anything, make more!

NPCEntity is the superclass of all the other NPCS.

(Feb 26, 2012 11:11 AM)Fizzix Wrote:  That is not enough.

Look at how DDD separates things, and then you'll see a lot of classes for small projects.

Thanks Fizzix. I'll look into DDD, for now i'm fucking confused what is it though :3
(Feb 26, 2012 01:05 PM)randomKID Wrote:  I noticed you have several entities that are essentially the same but have specific differences. I would suggest creating something like "Entity" and other superclasses that you can subclass to all your Entity classes. That way, you don't need to copy/paste code for each of your entities. Something like a isColliding(...) and move(...) and all that in your super class and then extend it to all your specific entities/NPCs. If anything, make more!

He already has one... It's NPCEntity.
I definitely would not make separate classes for entities/npcs etc. That is very bad practice. I assume you're looking at minecraft's design for that, which is a bad idea. What if you have thousands of NPCs? I'm not saying you have too many classes.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by iTeDDyFeb 18, 2015 06:42 AM 16 464 Feb 18, 2015 06:42 AM
Last Post: iTeDDy
[Python] by __init__Jul 16, 2013 10:37 AM 9 311 Jul 16, 2013 10:37 AM
Last Post: __init__
[.NET] by APTODec 10, 2012 01:58 PM 9 159 Dec 10, 2012 01:58 PM
Last Post: APTO