Java-Gaming.org
Java4K winners:
[
by our judges
|
by the community
]
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members
News
: Read the
Java Gaming Resources
, or peek at
the official Java tutorials
Home
Help
Search
Login
Register
Java-Gaming.org
>
Game Development
>
Game Play & Game Design
>
Inventory System
Pages: [
1
]
Print
Inventory System
(Read 812 times)
0 Members and 1 Guest are viewing this topic.
abirmingham
JGO n00b
Posts: 6
Inventory System
«
on:
2009-04-26 12:21:38
»
Time to re-factor the old inventory system in my MUD to something a bit more principled. At the moment it is composed of two types of classes:
WearEvent, PutEvent, DropEvent, etc. etc. -
Events which represent the movement of an Item from one location to another, at present these simply identify whether the target in question is visible/exists, and that it is an item. They then call methods inside of...
Inventory -
A god-class with too many responsibilities. Contains enum Location for all locations an item can be worn/held. Used in a HashMap<Location, Item> which is manipulated through various methods that are extensions of the events mentioned above. EG: Inventory.drop(Item) etc. etc.
My primary issue is that in a text-based game you have to tell the player very specifically why the command they entered failed, whereas in a graphical game you can play an 'error beep' and trust that the player understands that he can't wear a health potion on his head. So what I have is error messages entrenched very far past the above-mentioned events, within Inventory itself: 'You are already wearing something in that location', 'You don't have enough room to carry that', 'Your hands are full,' etc.
Any suggestions? I could just re-factor all logic and accompanying error messages into the events themselves, or create intermediary events which handle secondary logic beyond type-checking, but in either case I can't help but feel like I'm missing out on a more elegant, principled solution. This one is very seriously programmed to an implementation, as opposed to an interface.
Pages: [
1
]
Print
Jump to:
Please select a destination:
-----------------------------
Games Center
-----------------------------
=> Featured Games
=> Showcase
=> Contests
===> LWJGL16k - 2011
===> 4K Game Competition - 2012
===> JGO Comp Petite
===> Finished Contests
=====> 4K Game Competition - 2011
=====> 4K Game Competition - 2010
=====> 4K Game Competition - 2009
=====> 4K Game Competition - 2008
=====> 4K Game Competition - 2007
=====> 4K Game Competition - 2006
=====> 4K Game Competition - 2005
=====> Tiny Game 2010
=====> JGO Comp 2009
=====> 16K LWJGL Competition - 2005
=====> Java Technology Game Development Contest - 2004
-----------------------------
Discussions
-----------------------------
=> General Discussions
===> Suggestions
=> Business and Project Discussions
===> Jobs and Resumes
===> Community & Volunteer Projects
=> Miscellaneous Topics
-----------------------------
Game Development
-----------------------------
=> Newbie & Debugging Questions
=> Articles & tutorials
=> Game Play & Game Design
=> Game Mechanics
===> Artificial Intelligence
=> Networking & Multiplayer
=> Performance Tuning
=> Shared Code
-----------------------------
Java Game APIs & Engines
-----------------------------
=> Engines, Libraries and Tools
===> Java 3D
===> JInput
===> jMonkeyEngine
===> Xith3D Forums
===> Tools Discussion
=> Java 2D
===> JavaFX
=> OpenGL Development
===> JOGL Development
===> LWJGL Development
=> Java Sound & OpenAL
===> JOAL Development
=> Java on Mobile Devices
===> Android
===> J2ME
Loading...