• Content count

  • Joined

  • Last visited

Community Reputation

1038 Excellent

1 Follower

About Shaarigan

  • Rank

Personal Information

  • Interests
  1. I would guess that you wouldnt find anything like that because it is redundant. XML and JSON are formated syntactical strict languages where inside a C file anything could be written that is formal correct in the first order. Thats why writing a XML or JSON parser is less time consuming than a C/C++ parser. Maybe either you need to write it yourself or use something like an AST to get what you want. You could look at C#'s IL Code generator for an approach how they do it
  2. Placing your variable into the std map dose not give it a scope as it does in C# for example. C++ dosent know if an object is in scope or out of it, this would be the task for a memory/garbadge collector system you would have to write by yourself. This line VertexShader vertexShader(id); //Create a new VertexShader creates a local variable of type VertexShader on the stack that lives as long as you remain inside stack scope. And when calling return vertexShader; it returns a new copy of your stack scoped variable to the recipient that called your setup function and after that cleans up the stack by removing your local instance from memory. The same is true for your unordered map since it isnt a pointer, the insert function of the std map creates a copy of your object inside the memory std map manages. The only chance you have here is to use either some kind of ref pointer that takes responsability for keeping your instance alive as long as there are references to it alive or use a raw pointer so you need to take responsability to delete it after you were done so memory could be released properly (destructor wont be called since delete). Otherwise you would have two different copies and in the most anyoing case (as yours occuring) it will happen that your class gest destructed and data you previously attached gets lost
  3. Coding my first game.

    Since I dislike the idea of people making a business without at least one of the core knowledge from that business; Stencil as mentioned above seems as a good choice and there license points explicitely royality freeness out
  4. If you have had a look onto Waveform API or WASAPI you should have seen the WAVEHDR struct passed into the audio output channel. This struct contains a data pointer to certain raw wave data in memory and some other stuff. So where is the problem to create your data stream and pass it to the Wavefront API or WASAPI?
  5. Coding Guidelines

    But is using mMember, aArgument and so on not the same as prefixing stuff; where mWndPos = aWndPos + cWndPos; //do some stuff to mWndPos; *pWndPos = mWndPos; is as same confusing as whatever Bregman wrote? I know that it would make life easier when using some kind of member type to variable separation but writing this-> seems to be pretty standard here
  6. C# Need some help with Unity.

    Then you should take a look at the car physics tutorials
  7. Maybe you need a more advanced management/ caching strategy in which your caching thread and your render thread have as less friction as possible. The first question is 'who owns' the memory? I would say that your render thread needs to own the storage that maintains the images so caching is just a visitor here that potentially could set some kind of flags that tells render-thread that there isnt an image yet so it could pass over that image to the next one. Checking a bit flag is insofar atomic that there couldnt happen a break between writing bytes so you might not need any interlocked ops here. Caching thread would know need to kind of responsibilities, tagging memory as obsolete and loading images from disk in the background where I would go for some package/ memory mapping approach rather than loading single files. A second good caching strategy is to encounter an access timestamp and remove data from cache as needed but as few as necessary and from the oldest access upwards. The propability is very high that if you swing your head left, you will far or less move it back to the right. This would also limit the number of cache misses due to heavy move your head arround. This could otherwise cause your cache to load images that have become obsolete in next frame because you already moved away but then returned so need to cache this again
  8. Write it yourself using the Waveform API or the newer WASAPI functions. I have done this for testing purposes some time ago and it works just by putting binary data into the channels
  9. Coding Guidelines

    I mostly agree with the C# Style 0r0d mentioned except that in my opinion the leading m/a/c prefix for class/argument/constant types could lead to faster recognition what a name is used for but I personally feel that it leads to more thinking about "was this a member, argument or temporary I used here" rather than writing for the initial intention. For example I know i need the size stored in my class right now so I would in some kind of subconscious auto typing write "size" and go ahead in the knowing of this beeing the correct addressor I intendet. Using a prefix "m" for my class member "mSize" could (or potentially would most of the time in my case) lead to a less subconscious typing but a conscious active reminder about "do not forgett that it isnt size rather than mSize" that might lead to a break in code flow. When I had C# first and learned C++ later, there were no such things like prefixing your member/argument/constant whatever variables in my years of school at all.
  10. After a feeled million hours of coding in the past 16 years there have been many ways to write code in many different languages. Some seemed correct to the time they were used, some seemed to be too strict or too chaotic and I also evolved my coding style with each new line written. Now considering the results of over 5 years in professionall game development, tools and engine code as hobbyist and on small and large commercial projects up to AAA titles, there are still many ways one could write code in different languages but also in the same language on different projects in one and the same but also different companies. I mostly agree with; see some trends in C#, C++ coding guidelines that are fully worth to go for but the major difference is on the naming conventions. Because I have currently to write my own coding guidelines (not for a special project but primary as a personal convention to refer to when coding) and seek for a way I'm happy with, I did some research on different guidelines and came up with following references: When Epic Games write about Unreal This seems a bit confusing when seeking for some type like Animation or Skin (that are both different prefixed with A and F) but prevents various naming conflicts to types and variables when writing a function that accepts FSkin Skin as parameter for example. Googles c++ guidelines point into a completely different direction when they write So they heavily make use of typos, underscores and also lower case prefixes to identify different kinds of member, static, nonstatic and function names and in the same breath except there rules for various special cases. Some other examples from different projexts I was invovled to also use and do not use prefixing types or use underscores class Class { const <type> cConstant; const <type> Constant; const <type> __Constant; <type> _myClassMember; <type> _MyClassMember; <type> myClassmember; <type> mMyClassMember; <type> function(<type> parameter); <type> Function(<type> parameter); <type> Function(<type> aParameter); } class NAClass //avoid using namespaces, instead prefix anything with a 2 letter namespace like identifier { ... } Dont need to mention that Visual Studio will raise a Warning/Exception that a type is named as same as a function parameter when using a class class Container { private int size; //current size public Resize(int size) //will cause compiler telling that type matches a member type { //do resize here } } So in the end anyone does he or she thinks that it is worth to be done and so me do too. I would like to hear your opinions to why and what codings style do you prefer or are involved to in whatever way. What do you think makes a good standard especially for the most common point, Naming Convetions? Will be corious to read your opinions
  11. It seems like what we did in a prototype for our grass renderer. The grass faded out starting at certain distance to create a smooth vegetation effect using a simple shader and <PlayerPosition> to <VertexPosition> calculation. The result was clamped into certain range and then appended to the alpha channel. Nypyren mentioned, this seems like a texture blend so the same approach as with out grass renderer would need just a little update to the textures color channel.
  12. A quick google search gave this tutorial on GitHub
  13. Talisson's solution is a usual approach in custom engines and frameworks because it makes loading faster for removing file format specific parsing to favor loading times, memory usage and so on. An other approach is to use something simple like .obj file format. There exists various loaders out there that do their thing and could be a starting point for your first model/geometry rendering
  14. There was a similar post/problem some time ago you might think usefull to read. Physics in 2D-Games can/should be as simple as comparing 2 rectnagles to each other and go ahead from there
  15. Please oblige me and forgett about "GameObject". This is an approach I hate Unity for bringing it into the game because you do not never ever need something as a GameObject in a specialized game. What you should have is some set of Subsystems like Rendering, Logic, and Physics each has a list of specialized classes (no! GameObjects) like a combination of Matrix, Mesh and Texture (Rendering), a combination of Position, Bounds, Gravity, Force (Physics) and a combination of Healt, logical Inventory (Logic). Evrything may be connected due to a connector class holding 3 pointers to each of its connections to keep a maintainable structure of an entity for the game but thats it. Rendering does not need to work on the logic, moving players does the Input System, moving NPCs does the AI Systemoperating on coresponding classes. Use some kind of polling or event based update routine to keep your game running. In Minecraft, the Voxel Engine has no information about a single block until it was created as part of a querry into the terrain system. You never have single blocks stored as objects but a data managing unit that maps chunk data into visual and logicall data. A querry is given into the system to check for possible actions performing when a player hits the input button and on the case of mining or placing a block, some data is written into that chunk and rendering is updating the mesh to remove the texture/vertices from that position and have the underlying block "become visible". I have already worked on some games that made use of modifying there environment by building, or growing