Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Mar 2014
Offline Last Active Today, 01:33 AM

#5161251 How to install latest SharpDX from GitRepository.

Posted by spazzarama on 18 June 2014 - 01:30 AM


I have SharpDX 2.6.3 synced in GitHub. But I'm not sure on how to actually install it, other than how I've done it in the past and just copied the bin folder and the documentaions folder over to my main drive. But should I also copy packages and external or not?

Thanks for any help.




If you are not trying to build it, you only need the bin directory.

#5158816 (c#) list of lists of lists or outside helpers?

Posted by spazzarama on 06 June 2014 - 05:58 PM

Keep in mind that your objects within those lists are only references to the object, so aside from the small overhead of the List<T> or Dictionary objects you are not necessarily wasting much in the way of resources.


I would also think about the life-cycle of some of these objects and how they interact, and ensure that you have an efficient system for maintaining these relationships. E.g. if the bottle is lifted from the table, do you also have a reference on the bottle object to the table or do you have to look through all your objects looking for this elusive bottle reference? After considering some of these events this might help you determine the approach that works best for you. I think that maintaining a two-way parent/child relationship is a common approach.


I wouldn't use Object as the type however, I would create a base MyBaseObject class that implements support for these relationships and then inherit from this.


As to the choice between a List or a Dictionary, it really depends on how you are iterating/finding items within those lists. If you find yourself iterating Lists looking for an object that has a property X of value Y then you might want to consider using a dictionary instead. If however you find yourself iterating over the list in order to perform an action on each item within the list then the List would suffice.

#5158321 What's a quick way to get a database going for a .net text-based game?

Posted by spazzarama on 05 June 2014 - 01:51 AM

I completely agree with nfactorial,


Write a set of simple services that interact with the database as needed on behalf of your client app.


For some quick service development perhaps take a look at ASP.NET WebAPI for the server side... Of course, then you have to secure those services, you may need to have a set of services to allow each player register a username and password and require this authentication before allowing any interaction with the services that talk to the database.

#5158290 VS2013 Graphics Diagnostics problem

Posted by spazzarama on 05 June 2014 - 12:17 AM

Windows 8.1 with VS2013 (no update).


I can confirm it is working for me for the scenario you mentioned, both when using the CSSetConstantBuffers call as you have posted and with something more complex with multiple CS dispatch calls.


Doesn't work if I am using multiple render targets (stalls on capturing the frame).

#5157507 Beginners problem

Posted by spazzarama on 02 June 2014 - 04:42 AM

Sounds like something is zero smile.png


Try outputting the light.ambient, input.normal and possibly light.dir or light.diffuse:

float4 PS( VS_OUTPUT input ) : SV_Target
    return light.ambient;
    //return input.normal;
    //return light.dir;
    //return light.diffuse;

My guess is that at least light.ambient is zero. You're correct, even if the normal vector or light direction is zero (dot product with zero vector = 0) you are adding this to the finalColor so += 0 should still return you the diffuse * light.ambient.


What edition of Visual Studio are you using? If VS 2012 or VS 2013 there is a built-in graphics debugger that would allow you to step through and evaluate some of the values within your shader. When compiling the shader you must supply D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION and the shader file name - see this topic for an example. Alternatively there are a number of other debuggers available see this GameDev topic about free HLSL debugging tools.

#5157259 Visual 2013 problem with debugging shader

Posted by spazzarama on 31 May 2014 - 11:45 PM

VS can't work out which file your shader belongs to.


In your ShaderEngine.cpp


Change line 13 from:

hr = D3DCompile(buffer.data(), buffer.size(), NULL, NULL, NULL, mainFucName, "vs_5_0", D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION, NULL, &VS_Buffer, &errorVS);


hr = D3DCompile(buffer.data(), buffer.size(), name, NULL, NULL, mainFucName, "vs_5_0", D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION, NULL, &VS_Buffer, &errorVS);

then do the same for your pixel shader compiler function.


That worked for me with your sample (passing name into the pSourceName parameter). Not very intuitive smile.png

#5156665 Staying motivated while learning? [Advice needed]

Posted by spazzarama on 29 May 2014 - 03:35 AM

It helps if you truly love doing it!!


If you don't have that luxury, then 3Ddreamer's advice is doubly important!

#5156660 Best tutorial/article to begin with C#

Posted by spazzarama on 29 May 2014 - 03:14 AM

You might want to run through these http://msdn.microsoft.com/en-us/library/aa288436(v=vs.71).aspx first.


Then if you're looking to do game related stuff, you might find the Unity scripting tutorials useful, there is one there showing the differences between C# and JavaScript.

#5156240 SQL Server Table naming conventions

Posted by spazzarama on 27 May 2014 - 03:35 AM

dbo.tbl_ prefix


The use of prefixes such as tbl, sproc, vw (view), func (function), clr and so on are really just hints as to what the type of the database object you are dealing with is.


Sometimes when writing queries it is handy to know that the table you are querying really is a table and not a view. Mostly helpful in really big projects (i.e. "I know I have to call a stored procedure, but what was the name again?? oh i'll type .sproc_ first to get the list of 100 in code completion and hide the 100's of tables").


Personally I don't care what naming conventions are used as long as they are consistently applied, my old boss on the other hand would often say "Mr Codd would be turning in his grave!" when he saw something he didn't like - including tbl_ prefixes and pluralisation smile.png.


(edit: sometimes what technology you use impacts your naming convention, e.g. using the Entity Framework or other ORM tools might steer you towards using singular or plural depending on the implementation and what the code it generates looks like)

#5156224 Tweening Questions

Posted by spazzarama on 27 May 2014 - 02:08 AM

If you are using Visual Studio 2012/2013 it natively supports *.fbx, compiling them into a *.cmo file which can then be read using the DirectXTK library.


The animations that are saved within the FBX are then available to you. Just need to apply the transforms correctly based on the current time etc...


Although it is in C#, my book linked below has a chapter dedicated to implementing animation with Direct3D (Chapter 4 - Animating Meshes with Vertex Skinning). Using an FBX -> CMO, it shows how to perform interpolation between frames using quaternions and spherical interpolation (Slerp).


The basic approach is:

// animation loaded from FBX/CMO file
foreach (keyFrame in animation)
    if (keyFrame.Time <= time) {
        // use this keyFrame transform for the appropriate bone index
        transforms[keyFrame.BoneIndex] = keyFrame.Transform;
        // perform interpolation towards next future keyFrame

// Apply bone transforms (i.e. apply transform of parent upon each child bone)

// Convert from bind pose into bone space using inverse of bind pose

Some screenshots showing incorrect and correct bone transforms:

Incorrect Bone Transforms
Bone Transforms


#5154163 [SOLVED] D3DX11CreateShaderResourceViewFromFile - deprecated.

Posted by spazzarama on 16 May 2014 - 06:57 PM

* Is using "WIC" is the main format for those listed file/image formats and the standard way of doing things?
* Am I actually using an official and main method to load images using Direct3D11 ?


Windows Imaging Component or WIC is a standard way of loading images of various codecs on Windows (since Vista I think). Loading textures (to be used as image data) using the WIC is a common approach in Direct3D.


With DDS textures you can store data in the same format that is used within a D3D texture object. It is important to remember that a texture doesn't necessarily contain image data (i.e. you might use a texture to store a height map or a whole range of other things), the DDS format allows you to store this data in the various texture formats. You can also use the D3D texture block compression (BC) formats within a DDS.


The DirectXTK project is maintained by Microsoft. Chuck Walbourn has been involved in DirectX since the early days on Windows 95. These methods for loading your texture data are great to use. The actual format you choose to use really depends on your storage constraints, and your asset workflow.

#5152245 Books (Long post sorry)

Posted by spazzarama on 08 May 2014 - 02:00 AM

Another shameless plug:


http://packtpub.com/direct3d-rendering-cookbook/book (Direct3D Rendering Cookbook) 

(or on Amazon)

This takes you through using Direct3D with SharpDX and C#. It doesn't go into game design itself, but does give you a good intro into rendering techniques with Direct3D (e.g. tessellation, bone animation/skinning, deferred rendering, etc).


Good luck with it, I find programming in general to be a really rewarding activity and I hope you can get out of it what you are after!!

#5150250 limit on the how many bytes that can be passed across shaders

Posted by spazzarama on 28 April 2014 - 11:29 PM

The D3D11 p_s_50 shader model supports up to 32 registers (four 32-bit components each). I don't think you are going over the limit (in your second example), I think instead the compiler doesn't know what interpolation mode to use for the uint3[4].


From http://msdn.microsoft.com/en-us/library/windows/desktop/bb509668(v=vs.85).aspx


1. When using an int/uint type, the only valid option is nointerpolation.


I can't test anything at the moment, but perhaps prefixing the uints with nointerpolation will help?

#5149558 HLSL book suggestion

Posted by spazzarama on 25 April 2014 - 09:58 PM

HLSL Development Cookbook at Packt might also help you out. I have found Jason Z's book quite useful also.


There are plenty of great examples for specific effects/techniques out there, its just a pain trying to track them down smile.png Good luck!


p.s. although not focused on HLSL alone, my book linked below contains a number D3D examples that you may find useful also :P

#5149312 C# for Xbox anyone? I'm excited!

Posted by spazzarama on 25 April 2014 - 12:25 AM

It is still unclear if C# on XBox One will get the same level of access as the private Indie XBox One program is currently allowed


Fingers crossed!