Re: game development layout question

  • From: "Jim" <jhomme1028@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 13 Oct 2007 08:05:09 -0400

Hi Tyler,
Sounds like it works though. Lots of stuff provides overhead. Investigate what 
you have been told by the experts and don't be afraid to give it a try. You'll 
never get it done if you wait for the perfect environment.

Jim
__________
Take back your shopping life at http://tinyurl.com/32rsxz

  ----- Original Message ----- 
  From: Littlefield, Tyler 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Saturday, October 13, 2007 2:24 AM
  Subject: Re: game development layout question


  note: rtti provides some overhead.
  Thanks,
  Tyler Littlefield.
  Vertigo head coder
  "My programs don't have bugs, just randomly added features."
  msn: tyler@xxxxxxxxxxxxx
  email: tyler@xxxxxxxxxxxxx
  aim: st8amnd2005
  web: tysdomain.com
    ----- Original Message ----- 
    From: Ken Perry 
    To: programmingblind@xxxxxxxxxxxxx 
    Sent: Saturday, October 13, 2007 12:13 AM
    Subject: RE: game development layout question




    Well this can be done several ways.  You can use RTTI to  check the type or 
you can have a function in your class that returns what it is for example the 
server I work on has a unit class that has a method  GetType that returns four 
different const types.  The third method is to make these true virtual classes 
where each type all have the same methods so that it don't matter what type you 
have you just use the method and it does the right thing.  For example  if you 
have a shape class and have triangle, square, and circle as sub classes.  You 
can have a virtual function that gives you the area called Area().  It doesn't 
matter if you are dealing with a square or a triangle the correct Area function 
will get called.

    Ken 

----------------------------------------------------------------------------
    From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Graham Hardy
    Sent: Friday, October 12, 2007 8:14 PM
    To: programmingblind@xxxxxxxxxxxxx
    Subject: RE: game development layout question


    Hi ken - Further to my message of a moment ago, when you say, 'as you loop 
through the array you check what type it is and act accordingly,' how does this 
type-checking work? That is, what sort of code is involved to check the type?

    Graham.




----------------------------------------------------------------------------
    From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ken Perry
    Sent: October 12, 2007 7:32 PM
    To: programmingblind@xxxxxxxxxxxxx
    Subject: RE: game development layout question




    Actually Tyler I think your missing a large part of OO programming.  The 
point of c++ is so you can make an object and then inherit that object by other 
classes and then be able to make a single array of the type object that can 
hold all inherited types.  A good example of this is in .net where you have the 
Control class.  You can actually make an array of type control and then 
instantiate each control as button, Combo Box, List Box, etc.  Not many people 
realize this because they use the GUI method of creating forms and don't do the 
dirty work.

    In the same way in C# all things are objects or are supposed to be.  so you 
could make an array of objects and almost instantiate any variable into it 
using the new operator.  The then as you loop through the array you check what 
type it is and act accordingly.

    Ken



----------------------------------------------------------------------------
    From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield, Tyler
    Sent: Friday, October 12, 2007 6:39 PM
    To: programmingblind@xxxxxxxxxxxxx
    Subject: Re: game development layout question


    I could use void*, but I would have to cast the pointers--there should be a 
cleaner way. :(

    Thanks,
    Tyler Littlefield.
    Vertigo head coder
    "My programs don't have bugs, just randomly added features."
    msn: tyler@xxxxxxxxxxxxx
    email: tyler@xxxxxxxxxxxxx
    aim: st8amnd2005
    web: tysdomain.com
      ----- Original Message ----- 
      From: Jim 
      To: programmingblind@xxxxxxxxxxxxx 
      Sent: Friday, October 12, 2007 7:31 PM
      Subject: Re: game development layout question


      Hi Tyler,
      In Monopoly, I can have a racecar or a shoe on a square. Shouldn't you be 
able to just make a square and then point to the object that is supposed to be 
on it or can you somehow just put an object on it? I thought OOP was supposed 
to be able to represent the real world.

      Thanks.

      Jim
      __________
      Take back your shopping life at http://tinyurl.com/32rsxz

        ----- Original Message ----- 
        From: Littlefield, Tyler 
        To: programmingblind@xxxxxxxxxxxxx 
        Sent: Friday, October 12, 2007 7:37 PM
        Subject: Re: game development layout question


        Hello jim,
        It might, but if I have an array of objects, the objects would need to 
be of mixed-type so I'm able to maybe manage more than one object.
        E.g, a vehicle will be a different object from a player, etc.
        Thanks,
        Tyler Littlefield.
        Vertigo head coder
        "My programs don't have bugs, just randomly added features."
        msn: tyler@xxxxxxxxxxxxx
        email: tyler@xxxxxxxxxxxxx
        aim: st8amnd2005
        web: tysdomain.com
          ----- Original Message ----- 
          From: Jim 
          To: programmingblind@xxxxxxxxxxxxx 
          Sent: Friday, October 12, 2007 5:34 PM
          Subject: Re: game development layout question


          Hi Tyler,
          Unless I am missing something, you could maybe make the squares on 
the board objects so that they could be different from one-another. Would that 
work?

          Thanks.

          Jim
          __________
          Take back your shopping life at http://tinyurl.com/32rsxz

            ----- Original Message ----- 
            From: Littlefield, Tyler 
            To: programmingblind@xxxxxxxxxxxxx 
            Sent: Friday, October 12, 2007 4:47 PM
            Subject: game development layout question


            Hello list,
            I've got a question.
            I'm thinking of writing a game in c++.
            I want to find a way to make the board and map.
            I thought about using an array, but then that would require that 
all objects are the same...
            Any ideas?
            Also, how are race tracks built?
            I want to do a bit of racing in the game, just not sure how to lay 
those out.

            Thanks,
            Tyler Littlefield.
            Vertigo head coder
            "My programs don't have bugs, just randomly added features."
            msn: tyler@xxxxxxxxxxxxx
            email: tyler@xxxxxxxxxxxxx
            aim: st8amnd2005
            web: tysdomain.com

Other related posts: