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

What's the point of having a single render device?

2 posts in this topic

Sorry for the vague title, my whole question wouldn't fit, which is:

What's the point of having a single render device, when so many things need different ways of handling?

I'm trying to implement my own rendering system, really basic, Dx9 and all that, and from overhauling some of my old code, I've found out that out that the more I keep responsibilities of objects/functions separate, the easier I can maintain and extend stuff, pretty much what people recommend anyways.

That means:
Avoid monolithic do-it-all god classes, right? Yes.

Isn't a render device pretty much monolithic, that way if one wants it to be actually substantial, and not just some sort of delegate thing that shoves data between specialized components?
Or is that the point of one, after all?

So, isn't it better to have things like "GuiWindowRenderer", "FontRenderer", "3dRenderer" that could maybe act as plugins, or well, components for a big class?
Or would it be better to completely split those things and use them on their own, when one wants to render a GuiWindow instead of an actual ingame object?
The only need for a RenderDevice I can see that way would be a common framework like thing, that access backbuffers, and flips them and all that, but in that case the renderdevice is not the main hero, but the shadow sidekick.

So, what are the "rendering system" blocks one can see in engine design diagrams really?
I'm aware that that question is kind of a bad one, since a monolithic, rigid spaghetti-like monster class could do it all, and still pass as a rendering system, but let's say we don't want it that way...
Instead...would you make the components the stars, and have the device be some sort of low level widget?
Or have the components act more like scripts, or plug ins something that wants to be rendered can use?
Like with 2D GUI rendering, if it were a script, it could set the device to use an orthogonal view, and then feed it a stream of vertices, and material data.
Then, when it's time to render some scene object, a different view would be used, and so on.

So in short, I'm having trouble designing a sort of layout plan for responsibilities, what should depend on what, etc.

Any resources that focus on that particular topic?
(Again I apologize for vagueness, please act as if this topic never happened if it's too vague for you. Don't want people to feel like they put effort into a reply in vain)
0

Share this post


Link to post
Share on other sites
To support multiple platforms, but still allow high-level rendering code to be ignorant of the actual platform, I always wrap the low-level device (e.g. D3D) in some kind of low-level rendering layer. My current low-level layer provides these classes:
[font="Courier New"][font="arial, verdana, tahoma, sans-serif"]
[/font][/font][font="Courier New"]StateGroup[/font]s => set of [font="Courier New"]RenderState[/font]s.
[font="Courier New"]State[/font]s => sub-classed into [font="Courier New"]RenderState[/font]s ([i]blend mode, shader constants, shader programs, stream sources, etc[/i]) and [font="Courier New"]DrawCall[/font]s.
[font="Courier New"]CommandList[/font] => sequence of [font="Courier New"]State[/font]s.
[font="Courier New"]RenderInstance[/font] => a [font="Courier New"]DrawCall[/font] paired with a stack of [font="Courier New"]StateGroup[/font]s, and a sort-key.
[font="Courier New"]RenderGroup[/font] => a set of [font="Courier New"]RenderInstance[/font]s.

High-level rendering modules are then built on top of these classes (e.g. [font="Courier New"]GuiRenderer[/font], [font="Courier New"]LevelRenderer[/font], etc).
High-level '[i]Drawables[/i]' can exist in many different formats, as long as they can be converted into a [color="#1C2837"][size="2"]RenderInstance [/size][/color]([i]i.e. are composed of [font="Courier New"]DrawCall[/font]s and [font="Courier New"]StateGroup[/font]s[/i]).
These high-level modules then collect a list of '[i]Drawables[/i]' ([i]each of which has a [font="Courier New"]DrawCall[/font] and stack of [font="Courier New"]StateGroup[/font]s[/i]), and gives them to a function along with a default/global [font="Courier New"]StateGroup[/font] ([i]the default/global group is for states like the viewport/render-target that apply to every drawable in the list[/i]), which produces a [font="Courier New"]RenderGroup[/font]. This RenderGroup can then be handed to the low-level renderer.

The low-level module can sort the submitted [font="Courier New"]RenderGroup[/font]s and then convert them into [font="Courier New"]CommandList[/font]s, which are then executed by the device.

N.B. there's no global states in this design. One thing can't "set a ortho matrix" by itself -- that "set" command has to be part of a state-group, which is attached to a '[i]Drawable[/i]' somehow.
1

Share this post


Link to post
Share on other sites
@Hodgman:
Thank you for your reply, I might adapt my system to it as well, since it has some vague similarities already.
My very small and humble system so far uses commands as well, but it's the meshes that have them, and the meshes are being filled by the two simple components so far, window rendering, and static mesh rendering.

It goes like this:
My render device can only do one thing when it comes to rendering: clear, accept a list of meshes, flip.
Each mesh has vertex and index data, and a material.
A material has resources (or handles to them, the actual things are in a libary that get filled at load time) like vertex and pixelshaders, a vertex declaration, a constant table that is linked to variable emitters, info about which datastreams of the mesh are in use, and so on.

To actually produce data, a system like the window renderer takes a mesh, fills it with mesh data according to the states of the windows using it, then sets commands like "Clear the Zbuffer", "Change View to Orthogonal" for the material script, and sends the mesh on it's merry way.

It's a bit awkward when it comes to configuring it all, but it works.
I'm not sure if this 'passthrough' way of doing it is a good idea.

In essence, that window rendering system is just a mutator, it doesn't have much state info itself...does that fall under that gypsy wagon/poltergeist thing?

But again, thanks for the input, that looks a lot more structured than mine...

Edit:
Hm, so no global state like that?
Interesting. Makes sense though, smaller lego blocks that can form many things, including a duplo block, like the OrthoMatrix thing are better than using duplos only.
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