Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] Collections Source Code Sought.

Started by Ubercat Jul 9, 2009 at 2:21 PM 1 replies 700+ views
Original Post
Ubercat
Ubercat
Greetings. I consider myself at the upper edge of a beginning level programmer, not quite intermediate yet. I have two Java classes under my belt. I'm designing a fantasy war game which will rely heavily on collections. Let me start by stating that I did google "java source code" with various word combinations. I found a lot of stuff, but it's all either too basic, or way over my head. In neither case could I find anything which seemed to cover what I'm looking for. The simple arcade style games I found didn't really use the collections framework as far as I could tell, and the code which did was too advanced for me and wasn't game related. Picture a strategy game where you build various structures which construe different bonuses to your position. You'll have the option to upgrade them, and often they'll be required stepping stones to build other structures. You'll need a forge to build an armory, etc. You'll also recruit various military units. A given unit will be in a certain location along with other units. A group of units will be combined into an army (linked list) Units will have their own sprites for graphical display in the game, which will require a field in each object to link to the proper image, etc. I don't see how a game like that could do without collections, but collections related source code as it pertains to games seems to be scarce on the internet. Could someone link me to an appropriate open source game, preferably 2D, so I could study the code? Thanks!
lithos
lithos
http://www.java2s.com/Tutorial/Java/0140__Collections/Catalog0140__Collections.htm


Well that's the link but you'll want to look at "collections framework" for all how to make your classes compatible with all the tools. Then all the core collection types ArrayList, vector, likedlist, stack, hashset, treeset, hashmap, treemap. You're going to want to do a lot more reading because there's just some things you just don't do with some collection types, with other's there are things you make sense to do but that you don't need to.

edit: as for a whole game nothing that I can think of off hand and in a lot of cases a lot of games have very bad habits for no other reason the person didn't know of something or felt like doing it as such. Everyone is guilty of both.
Ubercat
Ubercat
Looks good. Thanks again.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.