Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: Need Assistance With Extensible Types for a Library on: 2013-07-29 07:55:27
The question is, what is the use case for your own types.
Such type based conditions are not OOP - take a look on the command design pattern instead.

Actually, I take it back.  Googled command design patterns, and found one that works perfectly for my library!  Thanks for that, 65K; turns out I was looking at it wrong and just needed to learn something new!
2  Game Development / Newbie & Debugging Questions / Re: Need Assistance With Extensible Types for a Library on: 2013-07-29 06:06:42
Thanks, Danny02 and everyone else, for the input. Smiley I've got a couple of ideas I'm bouncing around, but mainly I'm starting to come to the conclusion that I am making this thing a little too specific for a library.  Ideally I should be programming the input specifics when I'm working on the actual game.

At the very least, the graphics side of things is coming along nicely!
3  Game Development / Newbie & Debugging Questions / Re: Need Assistance With Extensible Types for a Library on: 2013-07-29 05:25:53
Honestly, I don't have any library-level case uses; the plan was to set up a system where a generic 'Command' could be generated by, say, an input/network manager, and sent to the target object.  The manager would know how to send what Command where by way of keeping a list of possible commands and targets, adjustable at runtime:

1  
KeyManager.addCommand(<???> commandType, int keyID, int keyEventType, Commandable target);


Any time someone triggers the appropriate KEY_DOWN/KEY_UP event for the corresponding key, it sends the Command designated by commandType to the provided Commandable object.  The implementation of the target object's response to the command is completely modular.


With regards to Nate's suggestion of using instanceof, I recall reading a while back that instanceof should be avoided, though whether that was due to performance issues or because it's generally a bad habit, I can't remember.  This was a looong time ago, however, so that may not be the case anymore?
4  Game Development / Newbie & Debugging Questions / Need Assistance With Extensible Types for a Library on: 2013-07-29 00:49:20
I am currently writing a simple game library for personal use, and I'm having a massive brain fart on this one non-specific Java coding/OOP thing...  Suppose I have an interface like this:

1  
2  
3  
public interface Commandable {
  public void command(Command cmd);
}


Assume that the Command class has only one field for now, which is "type".  Let's say that, using my library, I write a Player class that implements Commandable.  What I want is to be able to EXTEND Command to add new types at a later date, so <CommandSubClass>.getType() can theoretically return a different set of "type" values than the Command superclass.

I wanted to use Enums, but since they are static and final, they make poor candidates.  standard ints WORK, but generally speaking I try to avoid representing a type as an int whenever possible.  The end goal is I want to be able to do something like this in the Player class:

1  
2  
3  
4  
5  
6  
@Override
public void command(Command cmd) {
  if (cmd.getType() == Command.MovePlayerNorth) {
    /* Do stuff here. */
  }
}


Halp!
5  Games Center / Showcase / Re: Tectonicus - deep minecraft map renderer on: 2010-11-28 22:00:42
That is pretty spooky. Smiley

Aaron: We're finding multiplayer pretty playable at the moment - health is in and after yesterdays bug fixes it's pretty stable.

There's still some things I'd like to see fixed, like tools/weapons/armor getting miraculously repaired after dropping them and picking them back up, plus not being able to pick up certain items, plus combat doesn't seem to work so well (lag issues).  It's playable, but it has a few updates to go before it is close to looking like single-player survival mode.  Smiley

I love the game though.  I wrote Markus a love letter with my bug report.  Kiss
6  Games Center / Showcase / Re: Tectonicus - deep minecraft map renderer on: 2010-11-28 04:38:19
Nicely done!  I might use this for my Minecraft server, once SMP is fixed to the point of playability and whatnot.  Cheesy
7  Game Development / Newbie & Debugging Questions / Re: BufferedImages on: 2010-11-27 20:15:37
BufferedImages have more chance to be hardware accelerated than a image loaded from the toolkit class I believe.

Nice!

Loading images via ImageIO is way easier, provided you're not worried about using a blocking API.

Yes, they seemed a bit easier, which is one of the reasons I was hoping they would be at least viable.  Not worried so much about using a blocking API (yet).

Thank you both for the feedback!
8  Game Development / Newbie & Debugging Questions / BufferedImages on: 2010-11-27 09:33:20
I'm no stranger to Java programming, but it seems the API has been expanded quite a bit since I last wrote any code.

I was wondering, is there any benefit/detriment to using BufferedImages loaded by ImageIO rather than using standard Image objects obtained through the Toolkit?  This is pertaining to a desktop application (.jar), not an applet.

A few constructive answers would be immensely helpful!
9  Games Center / Showcase / Re: Flames of Anaria: 2D RPG on: 2009-05-15 08:22:47
I love what you've done so far. Did you write the engine from scratch? If so, I like how you implemented the dialog system and the movement controls; very reminiscent of the good old top-down action RPG days.

Keep up the good work.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (32 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (64 views)
2014-11-07 19:57:14

TehJavaDev (69 views)
2014-11-03 22:04:50

BurntPizza (67 views)
2014-11-03 18:54:52

moogie (82 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!