Class communication methods

This is a discussion on Class communication methods within the Game Programming forums, part of the General Programming Boards category; I've been planning some things for the game I'm currently working on, here's an excerpt from my 'plan list' that ...

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    Class communication methods

    I've been planning some things for the game I'm currently working on, here's an excerpt from my 'plan list' that I could use some guidance with:

    Code:
            3. A map class (CMapControl?) to handle creation and rendering of maps.
               Having the map class load the map scripts itself would be ideal in that
               it's easier to manage, but I want to have seperate classes "doing their
               own thing", therefore a script parsing class should load and parse the map
               script, sending necessary data to the map class for rendering etc.
               
            4. A script class. Should handle reading and parsing of script files with
               some sort of global method of transferring arbitary data between other
               interfaces, e.g. parsing a map script (tile layout etc) and sending the
               tile data to the map class for rendering etc
    I can't think of a method that would allow me to accomplish this without having the map class load and parse the files itself.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    idea 1:
    class CMapControl : public CMapScriptParser

    This allows the code to be handled in another object, making it easy to manage, but still has the CMapControl doing all the work

    idea 2:

    class CMapControl
    class CMapScriptParser
    class CMapDataHandler

    a CMapScriptParser reads all the data, and shoves it into a CMapDataHandler, which is what the CMapControl object references when it needs data.

    Idea 3:
    class CMapDataHandler
    class CMapControl : private CMapDataHandler
    class CMapScriptParser private CMapDataHandler

    A bit of both the last 2 ideas. The best way to go about this idea would be to have CMapDataHandler set up as a singleton.

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Ok thanks for the ideas. Haven't seen you around here for a while skorman, where you been?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  2. calling OpenGL methods from outside the main class
    By Hector in forum Game Programming
    Replies: 2
    Last Post: 06-22-2006, 08:23 AM
  3. Mmk, I give up, lets try your way. (Resource Management)
    By Shamino in forum Game Programming
    Replies: 31
    Last Post: 01-18-2006, 09:54 AM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 02:30 PM

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