![]() |
|
[Java] Is 16 classes too much for a Space Invaders game? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] Is 16 classes too much for a Space Invaders game? (/showthread.php?tid=2246941) Pages: Pages
1
2
|
Is 16 classes too much for a Space Invaders game? - SIM-524734 - Feb 25, 2012 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 @.@ * - BigDomePiece - Feb 25, 2012 Personally I don't think you can have too many classes.. haha It should work fine really. How big is all of it? * - SIM-524734 - Feb 25, 2012 (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. * - Igame - Feb 25, 2012 (Feb 25, 2012 02:19 PM)Ecoste 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 * - BigDomePiece - Feb 25, 2012 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 * - SIM-524734 - Feb 25, 2012 (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. 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 * - BigDomePiece - Feb 25, 2012 I could only see putting the collision detection with whatever will be colliding. Besides that, it looks fine. * - SIM-524734 - Feb 26, 2012 (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. * - andrei042795 - Feb 26, 2012 Would you mind sharing the source once its ready? Im very interested in game programming. Thanks and good job :) * - Fizzix - Feb 26, 2012 That is not enough. Look at how DDD separates things, and then you'll see a lot of classes for small projects. * - SIM-524734 - Feb 26, 2012 (Feb 26, 2012 10:13 AM)andrei042795 Wrote: Would you mind sharing the source once its ready? Im very interested in game programming. 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. * - randomKID - Feb 26, 2012 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! * - SIM-524734 - Feb 26, 2012 (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. Thanks Fizzix. I'll look into DDD, for now i'm fucking confused what is it though :3 * - Fizzix - Feb 26, 2012 (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. * - Colby_ - Feb 26, 2012 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. |