Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Tispe

Member Since 02 Oct 2010
Offline Last Active Yesterday, 07:20 AM
-----

Topics I've Started

How to structure a game in OOP

Yesterday, 01:13 AM

Hi, I have rewritten my project several times to adapt to new game structures. I do this to conform to rules such as, no static or global variables, no singleton patterns and the single responsibility principle.

 

The application consist of class objects. I often find myself creating a "super" class to only make one instance of it. Such as a Renderer class. This class handles the window, resolution, fullscreen toggle and draws the scene.

 

Another class is the Asset Manager, one instance is created and it handles loading files and preparing them for later use. It keeps an array of all assets. Since the Asset Manager needs the device to create resources (VB, IB, Textures) in the managed pool, I keep a private pointer to the device in Asset Class and make a copy in the constructor. This cross object dependancy is to conform to the "rules", maybe there is a better solution?

 

The Entity class has one instance, it has a list of (pointers to) Player objects (struct). These player structs contain information such as what Skeleton to use, what Mesh to use, and character variables.

 

When rendering I pass the list of Entities to the renderer which looks up the Asset Manager for the resources and draws them as described in the Player object. 

 

There are also other classes such as the animator and gui but I kept those out to keep it short. Is this a good game structure? What should I pay attention to, and are there any other game structures I should consider?

 

The pseudo-code:

main(){
InputOutputClass IO;
DeviceClass Renderer;
AssetClass Assets(Renderer.GetDevice());
EntityClass Entities;
GuiClass Gui(Renderer.GetDevice());

MainLoop(Renderer, Assets, Entities, IO, Gui);

}

Mesh in right-handed coordinate system, how to flip it?

16 May 2013 - 02:51 AM

Hi

 

All my (shamelessly stolen from a game) meshses are upside down and rotated 180 degrees. This leads me to belive that the meshes are in the right-handed coordinate system. DirectX uses the left-handed coordinate system.

 

I have been rotating my meshes during transformation as a quick fix but I'm not quite sure if I should continue doing so.

 

I guess all the animation sequences are also Right-handed.

 

Now, is there any point in converting all this data to the Left-handed system during load time, and if so, how could I do that (vertices, textures, animations, etc)?

 

Cheers!


Help, understanding Tangent Space (normal mapping)

24 April 2013 - 06:47 AM

Hello

 

I have read a bunch of articles and tutorials about normal mapping, many of them focus on how to create them but not that many understandably describe them as they as used in the graphics pipeline.

 

I understand that the Normals of a high-res model is saved as a pixel in a texture. And applying this texture to a low-res model to get per-pixel normals.

 

I understand that these Normals are in high-res model space. And for them to work, the low-res model must be aligned with the high-res model (same position, rotation and scaling).

 

I understand that if the low-res Model is rotated, that the Normals in the normap map will remain in high-res space and there will be a mismatch.

 

 

What I don't understand is why do we call it tangent space instead of just "original high-res model space", and why is it continously changing for each fragment? One article says that each normal is in the space of its individual triangle, does that mean that in the high-res model, each face has its own space, and the neighbouring face has a different space? Why not just one space for all faces?

 

Why can't I just take the light vector, transform it with to model space using the inverse-model transformation matrix?

 

What I can think of is that, when I animate a character each face will be transformed differently. This means that for each face the normals will be transformed differently, from the bone matrices. Why can't I just take the light vector, transform it to the "face-space" using the inverse-bone matrices, and use the normal map from there on? Why do we involve tangent, bitangent using UVs?

 

It is all just a big mess to me, if anyone can describe it please do so.

Cheers!


diffuse map, normal map, specular map, what else?

22 April 2013 - 05:22 AM

Hi, I have some questions I hope to get an awnser to.

 

What types of maps does a typical model need these days to look great? For instance, an High Detail Animal such as a Lion? What about a building (wood or stone)?

 

Does tesselation, Fur or Hair require any maps? Nvidia had a fur demo with its GTX 6xx series, I guess this technology requires top of the line graphics cards. Is there any point in realisticly having Fur and Hair in a game with tens of characters in the same scene? Perhaps other less costly fur and hair techniques are available.

 

Cheers!


Help with loading ICON data from memory

25 March 2013 - 04:45 PM

Hi

 

I have a file which contain a bunch of icons batched together. I load this file to a buffer and now I want to extract the images into IDirect3DTexture9 objects.

 

The icons are 32x32 pixels in size, they contain a XOR palette and an AND palette (atleat I think so after looking at it on a HexEditor). Both palettes are 1024 bytes each.

 

I have seen source code that reads this into a HBITMAP using a BITMAPINFO header.

 

HBITMAP hBitmap = CreateDIBSection(hDC, &bmi , DIB_RGB_COLORS, (void**)&pSrc, NULL, 0 );

But this requires alot of bitfidling and the image is upside down.

 

 

I need help porting this code in to a more conventient method, like D3DXLoadSurfaceFromMemory() that can be used in DX9.

 

Any input about ICO file format and loading is appreciated.


PARTNERS