Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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]
EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (864 views)
2018-03-24 14:47:39

ivj94 (125 views)
2018-03-24 14:46:31

ivj94 (768 views)
2018-03-24 14:43:53

Solater (140 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!