Jump to content
  • Advertisement

Cosmic R

  • Content Count

  • Joined

  • Last visited

Community Reputation

159 Neutral

About Cosmic R

  • Rank
  1. Cosmic R

    Structuring and organising classes

    thanks for the great reply.  I have taken into account your suggestions. My biggest problems as you noted appear to be numbers 2, 3 and 5. Basically my game should know when the player has fired etc, not have the player class tell it. I was delegating too much down the chain. All my state classes should do is update the object it's attached to.   As far as my sprites go, yeah I need to re-write it - at the moment it works, but not how it should so I'm aware of that one...   And with no 1, the singleton, if I shouldn't use it then how do I instantiate the game? A static class?
  2. Hi all, I've been a long time lurker for a few years after a long break from the site.   I'm still a beginner, but am really pushing to get a few games under my belt.   Anyway, I've set up a basic game design like this:   Game class Singleton Game State Class  (for playing/paused etc)  - handle input  - draw  - update   Sprite Class   Game Object Class  - list of sprites for animation  - virtual handle input (calls state->handle_input)  - virtual update (calls state->update)  - virtual draw (calls state->draw)    - Monster Class (derived from GameObject)  - Player Class (derived from GameObject)   State Class  - virtual handle_input  - virtual update  - virtual draw MonsterState Class (derived from State) PlayerState Class (derived from State)   Object Manager Class  - manages a list of game objects of a type eg ObjectManager<Monster> monster_manager;  - calling monster_manager.update() runs the update command on all the monster objects etc   Okay, so now that's out of the way, my problem is how do I get my objects talking to the manager? I want my player object for example to be able to tell the manager to create bullet objects.   But it seems the way I've designed it all only allows for messages to be sent downwards, not upwards. I tried including the calling objectmanager on each update call, but because the objectmanager is templated it didn't work.   I thought of creating a global messaging system, where a list of message objects is kept and every loop they are executed, but that's just moving the problem around, not really changing the structure (ie the message class would need access to the ObjectManager)   Am I going about this the wrong way?   Are there any good examples of basic games (but not Pong) that allow for expansion? Maybe something like object oriented space invaders?
  3. Yes, I have read the article. No, I think I must've not given the right question. What I meant to say is, when you want to search a math formula and its theory behind it, without having any knowledge to what that math formula is all about prior to searching, what is the trick to searching for these information when using Google? How do come up with the search term that I could easily apply and get the results what I wanted if given a math formula yet there's not much information to be conveyed from? [/quote] the way google works is it's just a big answer machine. for example, say I've got my isometric tile engine working, but I don't know how to make tiles selectable by mouse: how to get mouse position in isometric map and I get loads of results with the answer. now say I want to go back to basics and get the theory behind isometrics. All I know is its a view called isometric- isometric view the first result is a wikipedia article - with loads of background on the theory - http://en.wikipedia.org/wiki/Isometric_projection it all really snowballs from there. even if you only have the vaguest clue about a topic you can google it. you just have to have the patience.
  4. Cosmic R

    anticracking technique help?

  5. Cosmic R

    Loading bitmaps in Allegro

    http://www.allegro.cc/manual/api/loading-image-files/load_bitmap doesnt say anywhere anything about supporting jpg.
  6. Cosmic R

    NPC Voices

    its as simple as if it were possible we would have seen it already.
  7. Cosmic R

    Good calculator for programmers?

    the calc that comes with ubuntu suits me. its got leading zeros and digit grouping, and it can do much more that windows calc, such as square root without having to use the x^y button.
  8. Cosmic R

    class prototypes

    Quote:Original post by Storyyeller I was going to do it that way, but it wasn't working, so I tried moving everything into the header to see if that would help. I figured I could always change it back once I got it working. its not plainly obvious to me, but I suspect that this is where your problem is.
  9. Cosmic R

    class prototypes

    also try to avoid putting full function definitions inside your header files. its much more logical to only put your prototypes there, and the definitions in the .cpp file. This lets you organise your code easier and also avoids having to recompile every file each time you make a change.
  10. Cosmic R

    Allegro problem

    nah it will work the way it is. trust me the problem is with the bitmap filename. either the file is in the wrong folder, or there's a typo in the name. I'm pretty sure there's no problem with long filename support anymore.
  11. Cosmic R

    class prototypes

    your header files contain the prototypes for your functions and classes. its like telling other functions, 'these classes exist, but I have described them elsewhere' a prototype looks like this (say, foo.h):class Foo { Foo(); //constructor ~Foo(); //destructor int Bar(); // a function that returns int }; then you would make foo.cpp might look like this:Foo::Foo() { cout << "Hello World!"; } Foo::~Foo() { cout << "all done!"; } Foo::Bar() { int value; cout << "enter a value"; cin >> value; return value; } and then finally, you would put #include "foo.h" in your main.cpp file. [Edited by - Cosmic R on February 23, 2009 6:40:00 PM]
  12. Cosmic R

    Allegro problem

    END_OF_MAIN() is an allegro macro, dont comment it out! put in something like if (!good_guy_sprite) { allegro_message("unable to load bitmap"); exit(1); } this will let you see if its finding the bitmap. I recommend using a shorter filename and without spaces to avoid more confusion too.
  13. Cosmic R

    Problems Exiting Program

    probably a good idea to rename the exit variable to something else too, to avoid confusion with the exit() function.
  14. Cosmic R

    Problems Exiting Program

    you shouldnt need to but try allegro_exit()
  15. Cosmic R

    yet another pointer question

    Quote:Original post by scratt Why not create a std::vector or std::list of std::strings and just truncate them when you put them into the list. because I like to be difficult! hehe nah just joking. well, almost. because I'm using C, not C++ and also because I want to understand the problem better.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!