[Week 3] Game Programming Sample Interview Question

  • (2 Pages)
  • +
  • 1
  • 2

19 Replies - 22257 Views - Last Post: 19 February 2011 - 08:34 AM

#16 diego_pmc  Icon User is offline

  • D.I.C Addict

Reputation: 81
  • View blog
  • Posts: 565
  • Joined: 13-May 09

Re: [Week 3] Game Programming Sample Interview Question

Posted 16 February 2011 - 02:30 PM

@Fib Oh, we were supposed to design the whole system the interface. :| I was under to impression we had to write the World::update() function.

I have a question though (I don't know if this is the right place for it): why would MovableGameObjects necessarily be DrawableGameObjects? It feels a bit like mixing the model with the view.

Would it not be more appropriate to have two interface classes, class IMovableObject and class IDrawableObject, and use them in a manner similar to how you would use interfaces in Java?
class Player
    : public IMovableObject, IDrawableObject



Btw, thanks for the sketch, I just realized something I was wondering how to implement in a game. :) (I've read about how to code games but never really done anything very big.) I'll probably learn a few things from the examples people post here.

This post has been edited by diego_pmc: 16 February 2011 - 02:39 PM

Was This Post Helpful? 0
  • +
  • -

#17 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: [Week 3] Game Programming Sample Interview Question

Posted 17 February 2011 - 09:19 AM

@Fib

That class design looks pretty good, I would consider making a base class for all game objects so that your world class could have a container of pointers to the overall base class.

std::vector<BaseGameObject*> GameObjects; // can contain all derived classes



What do you think? :)

This post has been edited by stayscrisp: 03 January 2012 - 04:20 AM

Was This Post Helpful? 0
  • +
  • -

#18 Fib  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 161
  • View blog
  • Posts: 554
  • Joined: 12-March 09

Re: [Week 3] Game Programming Sample Interview Question

Posted 17 February 2011 - 11:05 AM

View Poststayscrisp, on 17 February 2011 - 10:19 AM, said:

@Fib

That class design looks pretty good, I would consider making a base class for all game objects so that your world class could have a container of pointers to the overall base class.

std::vector<BaseGameObject*> GameObjects; // can contain all derived classes



What do you think? :)



I thought about it. But I couldn't think of any members or methods to put inside of the overall base class. But yes that is a good idea.
Was This Post Helpful? 0
  • +
  • -

#19 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: [Week 3] Game Programming Sample Interview Question

Posted 17 February 2011 - 12:50 PM

Possibly something like this

Spoiler

This post has been edited by stayscrisp: 17 February 2011 - 12:51 PM

Was This Post Helpful? 1
  • +
  • -

#20 (Cryptic)  Icon User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 69
  • Joined: 13-January 11

Re: [Week 3] Game Programming Sample Interview Question

Posted 19 February 2011 - 08:34 AM

Wow, seems like I've missed out on a lot.

Well for question (2). I'd answer, I'm restless, I am too motivated, and I find everyone takes what I say to seriously, even though I'm usually debating or giving an opinion to receive and opinion to learn. Also I have a subconscious trigger that, if I feel like your testing my stupidity I'll act stupid =D <-- I think the last one is serious bahahaha... bad habbit.

As for question one, it looks like im too late ( actually happy about that, my code would of looked ugly compare to the samples I've seen here).

But anyways:
Design an OO system for a game containing a world, a player and obstacles. The player will be able to move around the world and avoid obstacles. Only the declarations are needed for all classes but the definition of the World Update function is required.
Spoiler

This post has been edited by stayscrisp: 20 February 2011 - 07:14 AM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2