RE: game development layout question

  • From: "Graham Hardy" <graham.hardy@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 12 Oct 2007 20:10:42 -0700

Hi Tyler - Isn't one of the points of C++ inheritance and polymorphism? In
other words, maybe you could have a series of pointers (or, better yet,
iterators - grin) to objects of type Square, which would be inherited as,
say, Jail, Property (inherited in turn to Lot, Business, etc), Pay-day (or
whatever it is in Monopoly). Then, you would just have pure virtual
functions, such as one that could occur whenever someone landed on the
square, passed over the square, or tried to leave the square, and then in
the case of property you might have a Buy function, etc. I admit I'm quite
new to C++, so these may be elementary examples, and this is only the way
I've been led to understand things. The thing I don't really know is how you
would know at runtime the nature of the square in question. For example,
clearly on property squares you could execute a Buy function, but what would
happen if the user entered the command for 'Buy' on, say, a jail square? I
should imagine you'd get a run-time error. Or maybe I'm giving C++ a bad
turn: I guess you could just have all virtual functions in the base class,
which, if they are impossible to execute, would just throw an exception.
 
Graham.
 

________________________________

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


you could have it in an array, then move the car to those elements.
But, my problem is this.
If you have a car, or person, the object will be different, thus you can't
define the array to just hold a car, or etc. it has to contain all of those.
 
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 <mailto:jhomme1028@xxxxxxxxx>  
        To: programmingblind@xxxxxxxxxxxxx 
        Sent: Friday, October 12, 2007 7:56 PM
        Subject: Re: game development layout question

        Hi,
        In the real world, I pick up my car and put it on the just visiting
jail square. How do you represent that on the computer?
         
        Jim
        __________
        Take back your shopping life at http://tinyurl.com/32rsxz
        

                ----- Original Message ----- 
                From: Littlefield, Tyler <mailto:tyler@xxxxxxxxxxxxx>  
                To: programmingblind@xxxxxxxxxxxxx 
                Sent: Friday, October 12, 2007 9:39 PM
                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 <mailto:jhomme1028@xxxxxxxxx>  
                        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
<mailto:tyler@xxxxxxxxxxxxx>  
                                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
<mailto:jhomme1028@xxxxxxxxx>  
                                        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
<mailto:tyler@xxxxxxxxxxxxx>  
                                        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


__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: