Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Graphics and Sound Engine

This topic is 5799 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Most graphic engine that I know, have something like a basic class and all objects will derive from that class which will be able to draw themselves, if I''m correct. How then can you impliment sound into that? Wouldn''t you want each object to be able to make their own sound? How to do that and avoid multiple inheritage since I''ve heard it''s a bad idea.

Share this post

Link to post
Share on other sites
The way I tackle this is to have my Graphics Engine (2D) know how to draw a few basic things, Sprites, Lines, Boxes, etc... Any entities for my game (e.g. units, ambient sounds, etc.) are stored seperatly in what I refer to as my Game Engine, each entitiy contains indexes into various tables that hold the drawing information (frames for animation and the sprites), it does not however hold the sprites themselves (that way I can change my Graphics Engine, and the Data Tables, without having to touch my Game Engine).

My Graphics Engine (which is a class.. consiting of a Base class thats common across all my projects, and knows how to do the drawing, and a project specific class which contains all the information like screen layout, etc.) contains smaller sub-engines which are responsible for things like drawing the Mini-map, drawing the status bar, drawing a menu, etc. These query the entites they want to draw to get at the drawing information in the table, and then render it based upon that.

My Sound Engine is a seperate beast, if an entity wants to play a sound, it simply tells the Sound Engine, "play sound number x at my location".

By keeping the distinction between game control flow (Game Engine), graphics output (Graphics Engine) and sound (Sound Engine) (Note: I also have a seperate Input Engine that interperates the controls into messages [again 2 levels, generic - read the devices - and specific - translate action into message]) you can change the way one works without impacting (to any great degree) the others.


Share this post

Link to post
Share on other sites

  • 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!