The game I/O mechanism design

This is a discussion on The game I/O mechanism design within the Game Programming forums, part of the General Programming Boards category; EDIT: Bummer! I should have posted this on the Games forum. I apologize. If some moderator would be so kind... ...

  1. #1
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,440

    The game I/O mechanism design

    EDIT: Bummer! I should have posted this on the Games forum. I apologize. If some moderator would be so kind...

    It came the time I'm wanting my game to do something. Have been designing most of the core and testing the classes in isolation. Now I need to actually move the player charater, look at a room, get an object from the floor, etc... And do this by simply typing the command in the prompt.

    The game is console based. For IO operations I'm wanting to use ncurses (PDCurses to be accurate) so that I can take advantage of colors in the console. The reason being I want to minimize any work in porting it to Linux and Mac.

    What I'm thinking doing is designing two singletons CPrompt, CParse.

    CPrompt - responsible for IO operations. It wraps ncurses functionality, accepts input from the user, sends to CParse and waits for results. Outputs results to screen.

    CParse - Parses commands, returns error or sends to correct objects for processing.

    Various objects
    - Receive processing requests (calls to their interface) and send results back to CPrompt for output.

    Graphically this looks like the image provided bellow.

    However, I'm not sure of this design on a few points:

    1. CPrompt is supposed to wrap ncurses functionality, but by having the various object communicate directly to it, I'll be forced to provide ncurses functionality on the objects themselves. Or probably complicate my code by sending to CPrompt also the output format requirements.
    2. CParse seems to be doing too much; parsing the input and deciding on which objects to call. Is it better to provide some form of messaging system between CParse and the objects? And how would this be implemented. Links to reading material (books or web) would be enough if you don't want to spend much time on this point.
    3. By making CPrompt and Cparse singletons I'm thinking on the need of having these two object in memory at all times. There is of course only one prompt. But CParse is less obvious as a good candidate for a singleton class. It's the fact that it will be staying in memory at all times that moves me into making it a singleton. However, should it be ever-present? Is it more logical to have it be destroyed after each parsing?


    I would really love your help on this. Understanding the programming language is becoming less of a challenge as time moves on, but applying this knowledge is the real challenge.
    Attached Images Attached Images  
    Last edited by Mario F.; 11-08-2006 at 12:38 PM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,440
    Well... will be going this route.
    tried also on usenet and didn't receive any answer either. Which is strange. But what the heck. Can't wait forever.

    Wish me luck.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 01:12 AM
  2. Game Design
    By plutoismyhome in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 09-30-2007, 01:22 PM
  3. Game Designer vs Game Programmer
    By the dead tree in forum Game Programming
    Replies: 8
    Last Post: 04-28-2005, 09:17 PM
  4. Anyone heard of FULL SAIL GAME DESIGN DEGREE?
    By marCplusplus in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 11-30-2001, 09:06 PM
  5. Im a Newbie with a graphics design problem for my simple game
    By Robert_Ingleby in forum C++ Programming
    Replies: 1
    Last Post: 11-23-2001, 05:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21