Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
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: Interactive Fiction / Text Based Adventure on: 2005-11-20 12:59:27
MUDs need top be mroe flexible.  Typically therefor MUDs follow a more object oriented design.  I personally have ahd excellent success  in the past with the DOOR paradigm (Door Object or ROOM.)

Basically it works like this, there is only one kind of object in the world: a DOOR.

A DOOR has an inventory list and two command lists, an "external" command list and an "internal" command list.   One special kind of DOOR is a player.  A player is an endpoint for input. Other then that its rpetty much liek any other DOOR.  (If you have a combat system it may have stats too.)

When input comes in, it is senbt to the player.  All DOORs handle input in the same way.  Input has sent to the list of commands in the order in the list.  Any command can recognize the input and consume it or pass it on.

The order of command processing by DOORs is as follows:
(1) Check the external list of commands on each of the obejcts in my inventory.
(2) Check the internal list of commands on my parent
(3) Check my internal list.

A DOOR may be visible, in which case it shows up in an inventory list, or invisible, in which case it doesnt.

Some quick examples:
Player has an internal command "look" which prinst the inventory list of its parent.

Player gets an invisible "blindness curse" object added to their invetory.  It has a "look" command which simple prints "you are blind."

Room contains a gaint robot DOOR.
Giant Robot has an external command "Enter Robot" that puts the4 caller in its own inventory.

Giant Robot has internal commands "stand up", "sit down", "walk n|s|e|w"...
Start to get the idea?  Almost any text-based physical sim cna be built in the DOOR paradigm.  Thre are lost of little details (like having "this" type calls to get caller, callee, etc) that will likely becoem obvious to you as you start experimenting with such a system.



That was fascinating - I am a noob game programmer. I did google that door method, but wasn't able to find any in-depth material (unless you count 'the girl next door' Smiley. Can you point us to some guides and examples (not that yours was bad)? thanks.
2  Game Development / Newbie & Debugging Questions / Opinion about constructors that throw exceptions on: 2005-11-20 11:32:04
I have a question about constructors that throw exceptions. This maybe about general programming, but my example is about game and I certainly know that games differ from 'office' applications in many ways. I have a class that handles tiled maps in my game. My thinking is, that you can create this class by providing the actual layout in it's constructor - obviously they are so tightly coupled. Now, if the map is invalid (like in my case, a door is in non-useful location) should the constructor throw an exception, or should I make that the class is created first, and then the actual layout is fed in in separate method which throws the exception?
So in general, if I were to make a library, are people comfortable with constructors that throw exceptions. I am not new to programming, but creating games and libraries are new to me.
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.

CopyableCougar4 (22 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (25 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (26 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (41 views)
2014-08-06 19:49:38
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!