Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

292 Neutral

About deepdene

  • Rank
  1. deepdene

    Private vs public

    One thing worth mentioning is the whole data orientated programming movement thats very popular amongst commercial developers. Mike Acton from Insomniac Games is one of the main components. Basically it relies on very clear data sets of your data, then using more the encapsulations of Managers which manage that data. So for example character AI data would be all sequential blocked together where you'd use it, and rather than encapsulating a Update method on a AICharacter object, you'd instead have AIManager which would access like data at once. In this paradigm the data would be exposed potentially through the old C struct style declarations where everything is public because your not so much interested in the traditional object abstraction, your more interested in the data. Classes/Objects and data orientated design aren't mutually exclusively, they can co-exist but you have a different way of structuring your data/classes etc. Read some more if you like: http://gamesfromwithin.com/data-oriented-design-now-and-in-the-future http://altdevblogaday.com/pages/how-does-it-work http://home.comcast.net/~tom_forsyth/blog.wiki.html#%5B%5BData%20Oriented%20Luddites%5D%5D http://home.comcast.net/~tom_forsyth/blog.wiki.html#%5B%5BMoore's%20Law%20vs%20Duck%20Typing%5D%5D The traditional OO view does have many advantages, mainly in regards to potentially higher gains in maintainability. DoD has definite speed advantages and forcing a clean/simple hierarchy can have some advantages in terms of readability at times, but sometimes OO abstractions are much easier on the human brain. If your starting out in your early projects I'd recommend starting out with OO but keep an open mind its not the only approach.
  2. static functions inside the class can be used for the WndProc, obviously outside the object instance.
  3. deepdene

    Best XNA book?

    Some friends found this book quite useful http://www.amazon.com/XNA-Game-Studio-4-0-Programming/dp/0672333457/ref=sr_1_3?ie=UTF8&qid=1295685722&sr=8-3 Both by guys on the Microsoft XNA team.
  4. Remember in C everything is treated as Data. So as long as the data matches up things keep working. Which is different to the OO approach where its about discrete sets of data and functionality combined.
  5. deepdene

    tool to convert C++ code to Java

    Another thing to note is that Java does allow you to interface with C++ through the use of JNI interfaces.
  6. deepdene

    C++ general questions

    They have a button for that now, just so you know! [/quote] There you go button pressed
  7. deepdene

    Undo a dot product

    The dot product of two unit vectors is the cosine of the angle. You can always normalise your vectors. So then you can use the acos to calculate the angle
  8. deepdene

    C++ general questions

    Header files by convention are used to place function and class definitions. The #include <filename> vs #include "filename" is complex by definition but generally in almost all implementations it means: #include "<filename>" will search the current directory (and those defined in the project as additional search locations) for the filename specified. Then it grabs the contents of the file, runs it through the preprocessor and then place the contents directly in the current place in the file. #include <filename> will search the system header directories rather than the project defined ones. Now in reality what it means is the following (copy and paste from: http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename) [font=Arial,]In the C standard (find N1124.PDF), section 6.10.2 paragraphs 2 to 4 state: 2) A preprocessing directive of the form [color=gray]#include[color=black] [color=black]<[color=black]h[color=black]-[color=#00008B]char[color=black]-[color=black]sequence[color=black]>[color=black] [color=#00008B]new[color=black]-[color=black]line searches a sequence of implementation-defined places for a header identified uniquely by the specified sequence between the < and > delimiters, and causes the replacement of that directive by the entire contents of the header. How the places are specified or the header identified is implementation-defined. 3) A preprocessing directive of the form [color=gray]# include "q-char-sequence" new-line[color=black] causes the replacement of that directive by the entire contents of the source file identified by the specified sequence between the " delimiters. The named source file is searched for in an implementation-defined manner. If this search is not supported, or if the search fails, the directive is reprocessed as if it read [color=gray]# include <h-char-sequence> new-line[color=black] with the identical contained sequence (including > characters, if any) from the original directive. 4) A preprocessing directive of the form [color=gray]# include pp-tokens new-line[color=black] (that does not match one of the two previous forms) is permitted. The preprocessing tokens after include in the directive are processed just as in normal text. (Each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens.) The directive resulting after all replacements shall match one of the two previous forms.145) The method by which a sequence of preprocessing tokens between a < and a > preprocessing token pair or a pair of " characters is combined into a single header name preprocessing token is implementation-defined. h-char: any member of the source character set except the new-line character and > q-char: any member of the source character set except the new-line character and " [/font]
  9. deepdene

    C++ general questions

    If you are a student you can also get Visual Studio 2010 Pro for free at www.dreamspark.com +1 on Palidine's opinion.
  10. deepdene

    Connect 4 C++

    Hi there, First thing, I personally find it hard to read an entire two chunk of code like that. i.e. it's better if you ask more tailored questions about a small task you are doing. The reason why his always return 3, is because if you look inside the function aiTurn() it returns 3. You can generate random numbers in C++ by using the rand() function accompanied with srand(). So you'd do something along the lines of #include <cstdlib> #include <ctime> #include <iostream> int main() { // This is a unique value that is passed to the random number generator. // Must be only called once. srand(time(NULL)); // Gives a number between 0..99 int random = rand() % 100; std::cout << random << std::endl; // Gives a number between 0..999 random = rand() % 1000; std::cout << random << std::endl; return 0; }
  11. deepdene

    Difference between C# OVER C++?

    From a more general point of view that isn't a language specific difference, Visual Studio provides alot of tools for doing GUI editing, database hookups etc. So you can create forms in WPF/Winforms which are GUI frameworks, can create entity framework hookups which is a object relational tool etc, plus many other tools I can't think of. C++/CLI has some of these tools but its not as tightly fitted. C++/CLI being a standard produced from Microsoft to make some additions to C++ to provide better syntax for integration into a managed environment. The .NET framework is massive, it takes the kitchen sink approach while in C++ the standards committee took the approach a 3rd party would provide additional functionality outside a core set of functionality. Also from a language point of view, there have been many extensions lately towards being a hybrid functional/procedural language with frameworks like Linq being added, lamda functions etc. Functional language features making it possible to add some constructs to potentially make it easier to scale certain things. i.e. they added the parallel tasks library and parallel linq to provide features such as iterating over large datasets concurrently using a lambda function etc.
  12. Yes but that article, that function sets up some other variables and thus it is slower. The fastest way to batch process is to use MMX for integers and SSE for floats using the CPU. The GPU way would be way faster. Use CUDA or OpenCL.[/quote]No it should be done in the cloud with HTML and variables. [/quote] If you believe the buzz you could almost believe that.
  13. deepdene

    pointers question

    id = ptr sets the id to be the memory address to which the pointer to ptr points towards. So its the address the computer uses internally id = *ptr; the pointer will be dereferenced and will then get access to the contents in memory. So most likely the double value your interested in. Then it will most likely be a truncated double value since id is an int. You may for safety consider using a reference, a reference gets rid of the need of dereferencing the variable while passing around memory addresses.
  14. [font="arial, verdana, tahoma, sans-serif"]In both instances with value types the values are placed onto the evaluation stack and popped into the appropriate stack variable. Our class definition and code we are basing this MSIL off:[/font][font="arial, verdana, tahoma, sans-serif"] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class A { public int x; public int X { get { return this.x; } set { this.x = value; } } public int J { get; set; } } class Program { static void Main(string[] args) { A a = new A(); a.x = 22; int x = a.x; a.X = 32; x = a.X; int j = 0; a.J = 22; j = a.J; } } } Here's the difference in MSIL between accessing the property and the field. [/font] . maxstack 2 .locals init ( [0] class ConsoleApplication1.A a, [1] int32 x, [2] int32 j ) // Load the class onto the evaluation stack L_000f: ldloc.0 // Load the value from the field onto the evaluation stack L_0010: ldfld int32 ConsoleApplication1.A::x // Pop the value from the evaluation stack into the local stack variable 1L_0015: stloc.1 // Now property example // Load the class onto the evaluation stack L_001f: ldloc.0 // Call a late bound method on the object on the top of the evaluation stack pushing the return value onto the evaluation stack L_0020: callvirt instance ConsoleApplication1.A::get_X() // Pop the value from the evaluation stack into the local stack variable L_0025: stloc.1 Also the only difference between a automatic property and providing the backing field yourself in terms of MSIL is the fact that the compiler adds an attribute to the field I believe to indicate it's compiler generated.
  15. BTW automatic properties are the equivalent to the following just to clarify those who haven't seen this newer language feature. class A { private int x; public int X { get { return this.x; } set { this.x = value; } } } is equivalent to : class A { public int X { get; set; } }
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!