• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
MylesEvans

Is creating an drawing class a good idea?

3 posts in this topic

Say a class with data members Xposistion, Y position, etc

 

 

like

 

Quaddraw Quad(X,Y,etc)

 

 

then in main game loop. Make a call to...

 

 

Quad.show(); //draws in position X/Y

 

 

 

 

I was trying to do this and its wasn't working.

0

Share this post


Link to post
Share on other sites

I'm not exactly sure how you're planning on using this, but yes, it's probably a bad idea.

 

If the goal of creating classes to represent my application is abstraction, then I probably don't want my game logic to have to think in terms of quads, but rather in Sprites or Models or Tiles or whatever it is that is actually being represented. That is of course unless you actually are just drawing quads to the screen...

 

In your renderer, you may want to treat quads as data and as items to perform calcualtions on, but you probably won't be drawing individual quads, as you'll be batching them and storing their indices in vertex lists and things like that which muddy up the definition of when a quad is actually "drawn."

2

Share this post


Link to post
Share on other sites

This kind of question needn't exist. There's two correct answers depending on your use case, inverses of each other.

 

Suppose I'm making a turn-based, tile-based game. Some tiles are larger than others (e.g. I plop down a city, and it covers four tiles instead of one). Then it might be a good idea to write a drawing class. The class can serve to cache these tiles, only update those that need to be changed, at the right framerate. With a bit of work, it could form the core of a graphics subsystem running on an independent thread from the rest of the game logic. This reflects the underlying program: your game might only update game mechanics once per turn, but the characters and cities and water in each tile need to update more often (the water has a wave animation that needs to run continuously, for example).

 

Suppose I'm making a 3D FPS game. The characters all need to run around and be animated, but this is handled through each object. Character Joe and Character Susan have different meshes, so while they might be children of the same subclass, they benefit from somewhat customized draw methods (Susan needs to be surrounded with a glow effect because she's special). And neither Joe nor Susan have anything in common with a building, which also knows how to draw itself. Trying to abstract the whole thing into a specialized drawing class that handles all these distinct cases would just overcomplicate things.

 

Which brings me to the most important point of all this. Design questions are almost always cut and dry if you know what your features are. Sure, there's a few different ways to do something, but there is almost always a best way, and it's almost always obvious with a little thought. My driving game needs to support both jeeps and sedans. Fine. Make them subclasses of a common class "Vehicle" or "Car". My flight simulator needs to have physically based wind simulation. Great. Tie that in with your physics engine, not your rendering backend.

 

As you become a better programmer, one thing I've noticed is that you increasingly just see what to do. It's just obvious. No one can tell you what the right design is unless they're working on the same project. Programming is all about just trying things and see what happens. In my experience, there are few applications for an abstracted, dedicated rendering class. But that doesn't mean that that's not necessarily the Right Thing. It's all up to you.

0

Share this post


Link to post
Share on other sites

I'm on the boat of people that says Objects shouldn't know how to draw themselves.

 

Main reason is to abstract game logic from rendering logic. You shouldn't make a game logic aspect (ie, a character, or a building) handle responsibilities that are inherent of another system.

 

Besides, having a draw method for each of your meshes/sprites/whatever leads to a lot of boilerplate code if many meshes are drawn the same.

 

While many objects could have different drawing requirements, often they're not that different that you can't make a class handle all the drawing instead. Its not like you need to have a "susan render" method, but you could just have a method that renders objects with effects, susan would have one attached to it, joe wont, and the rendering object will react accordingly.

 

If you change render objects along the road, you needn't to change every single draw method of all your objects, you should be able just to switch where the objects are sent to being drawn and that's it.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0