Jump to content

  • Log In with Google      Sign In   
  • Create Account

NightCreature83

Member Since 21 Feb 2008
Offline Last Active Today, 11:35 AM

#5254759 Why did COD: AW move every file into the same folder where .exe is?

Posted by on 30 September 2015 - 05:16 AM

This is Steam, do they even have an ability to control that?

Besides, why do you care? It works and that's enough.

Steam is nothing special as a developer you have the control over where files are located in your own directory structure.

 

It looks like COD went with an archive format for their files now which allows for better compression on the archived files. This will in turn have a faster load from the disc with perhaps a trade of in the decompression step of those files in the archive. The massive FF files seem to be the archive files. And it seems like they made a single archive per location which means you dont have to jump through the directory structure to load the files for a level. This is offcourse all speculation on my part :)




#5254419 pass an array? (stock c++)

Posted by on 28 September 2015 - 11:35 AM

The safest way to do this in stock C++ is to use a template

template<class T, size_t arraySizeX, size_t arraySizeY>
void function1(T(&array)[arraySizeX][arraySizeY])
{
    for (auto counter = 0; counter < arraySizeX; ++counter)
    {
        for (auto counter1 = 0; counter1 < arraySizeY; ++counter1)
        {
            array[counter][counter1] = 111;
            std::cout << array[counter][counter1] << std::endl;
        }
    }
}
 
//Call the function
int anArray[12][3];
function1(anArray);

You can now make use of arraySizeX and arraySizeY inside of the template for the size in both directions. The function syntax looks weird but it will capture the size of the array through the compiler.  You can find more information about this at this link

Caveat though this only works for stuff that is an array, you can't pass a pointer this way, that will actually generate a compile time error.




#5253781 Feedback on this Threading architecture

Posted by on 24 September 2015 - 02:31 AM

Can your renderer exist on a seperate thread so that that thread only has to deal with rendering transforms and feeding the GPU, whilst you update the game on the other thread?




#5253678 can anyone explain const char*, char, strings, char array

Posted by on 23 September 2015 - 09:31 AM

 

 

Any advanced string type, std::string as well, will inform you of chracter count especialy, when calling .size()

This is not true if the string is UTF enocded. UTF8 and UTF16 can encode a single character in multiple bytes. If you store UTF8 in a std::string size() doesn't guarantee that it corresponds to the number of characters in the string, it will however guarantee the amounts of bytes needed for the buffer, and the same goes for storing a UTF16 string in a std::wstring.

 

How does it contradict my quote? It is what I said, that size yields amount of characters...

 

That is just what I am saying it does not do that for a UTF8 or UTF16 encoded string, size actually gives you the size of the internal buffer not the number of characters used in the string. UTF8 can encode a single utf character in 3 chars internally in the string buffer, this happens when you start using characters outside the latin A character set, japanese and chinese characters for example need more bytes to express their pattern so it can be displayed.




#5253650 C++ Graphics Library

Posted by on 23 September 2015 - 07:27 AM

It can do that too, among other things. While I have read a bit about it in the past I have not actually used it so far. The closest analogue in a nutshell is probably "something like Windows GDI" independent of any OS. That includes different output devices (a simple memory bitmap, a PDF, an OpenGL texture which was created by rendering into a framebuffer, ...).

EAWebkit uses cairo interally to render the webpages/uis you load with it out to a bitmap you can use for your rendering pipe.




#5253632 can anyone explain const char*, char, strings, char array

Posted by on 23 September 2015 - 05:47 AM

Any advanced string type, std::string as well, will inform you of chracter count especialy, when calling .size()

This is not true if the string is UTF enocded. UTF8 and UTF16 can encode a single character in multiple bytes. If you store UTF8 in a std::string size() doesn't guarantee that it corresponds to the number of characters in the string, it will however guarantee the amounts of bytes needed for the buffer, and the same goes for storing a UTF16 string in a std::wstring.




#5253343 can anyone explain const char*, char, strings, char array

Posted by on 21 September 2015 - 03:31 PM


char* is a pointer which holds the address in memory of a character, for example it can point at a single 'char' variable, or it can point at the address where a sequential array begins.

const char* is such a pointer that is declared constant, which means that any function accepting it promises not to change the values stored in memory at that address. Read-only access to a string is usually the meaning..

const char*

Is not a constant pointer its actually a pointer to a constant char.

char* const

Would have been a constant pointer to a char. There is a difference in this stuff so be careful learn when the pointer is constant and when the actual object the pointer is pointing at is constant.

const char* const

Would be a constant pointer to a constant char.

 

The difference between the first two is subtle but effectively it means I can assign a new address to the variable that is decalred that way as long as the memory it points at is of const char type, I cannot change the value in the memory location of the pointer. In the second example I can not change the address of the pointer, however I can change the value in the memory location of the pointer. In the last case you cannot either of the two operations above.

char aChar = 'a';
const char* pointerToAConstantChar = &aChar;
char* const constantPointerToAChar = &aChar;
const char* const constantPointerToAConstantChar = &aChar;

char bChar = 'b';

*pointerToAConstantChar = 'B'; //Error: cannot change the value in aChar
pointerToAConstantChar = &bChar;

*constantPointerToAChar = 'B';
constantPointerToAChar = &bChar; //Error: cannot change the pointer

*constantPointerToAConstantChar = 'B'; //Error: cannot change the value in aChar
constantPointerToAConstantChar = &bChar; //Error: cannot change the pointer



#5253280 C++ Question About Objects

Posted by on 21 September 2015 - 06:44 AM

A final note FYI.

Do not call overriden functions (virtual) from base class ctor. So you cannot do something like:

class Asset {
public:
  Asset(const std::string &foo) { Load(foo); }
protected:
  virtual void Load(const std::string &foo) = 0;
};

class Level : public Asset {
public:
  Level (const std::string &foo) : Asset(foo) { }
protected:
  void Load(const std::string &foo) {
    // Pull physics
    // Pull textures
    // Pull sound resources
  }
};

To build a Level object the runtime first builds the Asset object. When the Asset object ctor is run, it has no information about what's really running and you'll be screwed big way. I think some compilers warn you or even prevent you from doing that. I am 100% sure I have been screwed in the past.

If memory serves, Java allows this for some reasons I don't remember. I'd suggest to be careful with that.

 

Java and C# allow this because the construction of a derived object runs in the opposite fashion from a C++ object. In Java/C# first the derived object is created with its associated vtable, this means that the constructor knows where to dispatch a virtual function call too. In C++ first the base object is created and then the derived version, calling a virtual function is in that case undefined behaviour for C++.




#5252323 Programming Role Playing Games with DirectX

Posted by on 15 September 2015 - 03:45 AM

The compiler can also sometimes complain about comments containing non ascii chars, this has tripped me up many a time in the past.




#5250986 C++11 lambda, modifying copied value

Posted by on 07 September 2015 - 08:13 AM

With = you are capturing variables by value not reference if you use & in the [] it will capture that variable as a reference and you should see the change outside of the lambda.




#5245968 "DxTrace" Linker Error In Visual Studio 2015

Posted by on 12 August 2015 - 07:14 AM

The function StringVPrintfWorkerW is trying to use the function called __vsnwprintf which your linker cant find at the moment. Tell the linker which .lib file that function is defined in and you will see that the compile will work again. https://msdn.microsoft.com/en-us/library/1kt27hek.aspx




#5245816 What is a wrapper? What is a Decorator?

Posted by on 11 August 2015 - 01:54 PM

Wrapper and decorator mean about the same it adds some specific functionality to an object/function without touching objects/function that are similar as the object you decorated. Usually you use this when you have a specific need to do something different but you don't need to rewrite a whole new class to do this action.

 

The wikipedia article about the decorator pattern has a good example of a window decorator for example that adds the ability to have a scrollbar next to a window without having to add the scrollbar functionality to the window class.

 

Decorators will usually have the same interface that the underlying class has but in the functions where it calls the functions of the class underneath it adds functionality that it has to do to the execution of that function.

 

The distinction between a wrapper and a decorator is more the pattern in how it is applied, you usually talk about decorators when talking about classes that wrap the functionality of other ones and add a specific functionality to the execution stack. Wrapper functions is more when you wrap call to a method of a global instance in a global function, wrappers are usually nothing more as function wrapped around another one, generally their scope is smaller.

 

But are used to implement plugable/extendable behavior to an existing class/function that might be black box.




#5245388 D3D12 how to set shader constants (outside of cbuffer)

Posted by on 10 August 2015 - 01:34 AM

I am still wondering why you want your variable outside of the constant buffer, we have these cbuffers to efficiently update our constants?




#5245077 How to render skybox, then save to a texture?

Posted by on 08 August 2015 - 05:32 AM

When you bind the SRV you need to make sure you are no longer using the RTV, if you have the DX runtime setup to use the debug version and set the output to warnings, you will get a warning in the output when the SRV is still being used as a RTV.




#5244983 How to render skybox, then save to a texture?

Posted by on 07 August 2015 - 11:27 AM

btw if you do no rendering between the texture creation, copy and save operation there is nothing in the back buffer and it will be black or what was there last frame. If you do this after the call to clear the bufffer the texture will have the color of the clear color.

 

You will want to do that copy just before the present call and do the save after the present because a read back from GPU to disc is a costly operation.

 

Also read the remarks on this topic: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476392%28v=vs.85%29.aspx because the CopyResource call comes with a few requirements that you have to obey for it to work correctly.






PARTNERS