• 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
Alex B.

C++ DirectX Renderer Design

6 posts in this topic

Hi there,

 

maybe somebody could help me with some thinhgs I don't understand yet.

I've read the book Practical Rendering & Computation with Direct3D11 and read the source code that belongs to the book.

 

http://hieroglyph3.codeplex.com/SourceControl/latest#trunk/Hieroglyph3/

 

I pretty much understand what he does. But there are some questions where I'm not sure:

 

-Is it common to wrap up everything in that way it is done there? Cause I looked over other source codes and I couldn't find another renderer that is split up that heavy. (Maybe performance?)

 

- I've read very often that it's not a good idea to let the models render  them selves, but there we got Entities that got a render method. That methods loads the pipeline with the instructions and let it draw it. Is this now how it should be done or not?

 

- There are more apps (for ex deffered rendering or ambient occlusion) that inherit from the base app. If I would do a framework and use it in a game: I wpould have for example do a deffered renderer that inherits from it and send my render queue to it? or even a forward renderer and so on?

 

- Everytime he inherits the app there is pretty much to do again. Is it the way it would be done, or is it more common to get the initialization somehow together that works somehow generic? so i just would have a call like

 

for(i < rq.length; i++)

{

     rq[i].render(); //here are some renderables in.

}

 

thank you!

Alex

Edited by Alex B.
0

Share this post


Link to post
Share on other sites

What functionality do you want from a renderer? Well you want to give it a Scene and render it to the screen right? You also want it to handle the game window so that you can change resolution and toggle windowed mode and fullscreen mode.

 

Another thing you want from the renderer (atleast DX9) is to create textures/surfaces and buffers for you.

 

Here is some of my Dx9Device class:

class Dx9Device
{
public:
	Dx9Device(void);
	~Dx9Device(void);

	bool CreateGameWindowAndInit(HINSTANCE hInstance, int nCmdShow, LPVOID *pInput);
	void ChangeDisplaySettings(DisplaySettings &NewSettings);
	void BuildManagedResources(std::shared_ptr<GameResource> &spResource);
	void Render(GameScene &Scene);
	void GetSettings(DisplaySettings &Settings);

.
.
.
}

The Scene data structure contain all the information necessary to draw one frame to the screen.

1

Share this post


Link to post
Share on other sites

Okay, so that way you do it, you give a scene to the renderer. I think in the scene there are objects that for example inherit from a renderable interface?

 

So the renderables got a function render() that makes the renderer to draw them?

 

As you said the renderer is the system that gives me the device and resources. In the book I wrote all the resources are wrapped up. Is this a good idea or just overkill?

 

Thats what i wanted to describe with the problem I've read, its not a good idea to render the objects themselves.

http://gamedev.stackexchange.com/questions/14133/should-actors-in-a-game-be-responsible-for-drawing-themselves

0

Share this post


Link to post
Share on other sites

How you implement the Renderer can be from very simple, to very complex depending on your needs.

 

The Scene you give the renderer has everything from skeletons to camera matrices already computed. All you have to do is push the Scene through your pipeline.

 

It's wise to think of batching before passing Scene to the renderer. For example, the Scene struct can contain an array of Texture objects. Each texture object has an array of mesh objects, and each mesh object has an instance buffer. 

 

Something like this:

struct InstanceObject
{
	D3DXMATRIX matWorld;
}

struct MeshObject
{
	Mesh pMesh;
	std::vector<InstanceObject> Instances;
}

struct TextureObject
{
	Texture pTex;
	std::vector<*MeshObject> Meshes;
}

struct GameScene
{
	std::vector<*TextureObject> Textures;
}

Then the renderer can nest 3 for loops and loop through what to draw.

Edited by Tispe
0

Share this post


Link to post
Share on other sites

Okay, so if I want a renderer that covers the most of the stuff directX can do its a good decision to do it the way its done in this source I think :) (what I don't understand is the performance decrease. How much does this cost if I wrap a resource in a class?)

 

If I understood it right the pipeline has to be designed that way you just put data in and get the transformed data out. That data should be prepared as good as possible before (culling and that stuff  I think)

 

Thanks :)

0

Share this post


Link to post
Share on other sites

Actually you dont push the whole scene through the render pipeline,the renderer should only see the infromation it needs, like vbs, ibs, shaders, constants and render state changes. Most scene graphs get culled heavily and only the objects that are visible will have the data needed to display them sent to the renderer.

 

My scene doesn't even touch the renderer all I do in the update of my game objects is tell them to add there renderable data to a list, this list is then fed to a renderer to display.

 

The renderer is the only one that knows how to submit a render command to the GPU, the objects only submit the data needed to create the render command.

 

Most games don't even have scene graphs in the update code they only contain a link to a model or something like that, the model can contain a scnegraph but doesnt have to, my current game doesnt use scene graphs just models which consist of meshgroups, and it is the mesh group that contains links or data to all relevant data to be able to render the mesh group.

1

Share this post


Link to post
Share on other sites

Yep, therefore I wanted to do a rendermanager that culls and sorts all of the stuff in the scene and calls the renderer to do all the work :)

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