FredOrJoeBloggs

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

117 Neutral

About FredOrJoeBloggs

  • Rank
    Newbie
  1. Thanks Game Dev

    [quote name='3Ddreamer' timestamp='1344587667' post='4968011'] If I may ask: Isn't C# particulary good for making tools, even object oriented tools? I have read this several times in different websites over the last couple years or so. Is this a myth or a reality? [/quote] IMO its a myth. C# can be used to make tools, but so can other languages. Is C# better, depends on lots of things, but the answer is probably no, its just different. C# and VB both have full access to the .NET libraries so they should be fairly interchangable. C++ can also access all of .NET just using a different mechanisum. C# is probably easier to learn, but once you have learnt it the other languages will be easy to pick up.
  2. Using Visual C++ 6

    [quote name='6677' timestamp='1344423473' post='4967343'] Pretty sure I read somewhere that Dx7 and 8 aren't even supported on windows 8 anymore, probably wrong, then again why would they support it? [/quote] And what makes you think Windows 8 will ever be used on the guy's system I've had to port code from VS6 to 2005, there were so many issues. But I agree, if this guy finds that he can do what he needs to for his personal enjoyment using VS6 then so be it.
  3. Extended Ascii

    Are you using chars or unsigned chars? I ran the following program using chars and it came up with AB|BA but with unsigned it does the expected AB219BA. (| is meant to be the block symbol) chars are only 7 bits, because the top bit is always set, if I remember rightly, so 219 is really 91 (open square bracket). [source lang="cpp"]int CharacterDetectTest(void) { static const int constMaxCharacters = 5; const unsigned char maze[constMaxCharacters] = {65, 66, 219, 66, 65}; for (int i = 0; i < constMaxCharacters; ++i) { if (maze[i] < 127) { printf ("%c", maze[i]); } else { printf ("%d", static_cast<int>(maze[i])); } } printf("\nPress enter to exit\n"); return fgetc(stdin); }[/source]
  4. Creating a new game

    You want to find a Game Engine that will do what you want to do in a language you think you can do it. Since you want it to be web based an easy way to start would be by looking at JavaScript and HTML5. They are not the best places to learn how to program, but you should be able to see if you like writing games. Try [url="http://www.w3schools.com"]www.w3schools.com[/url] and [url="http://www.tutorialspoint.com/index.htm"]http://www.tutorials...t.com/index.htm[/url] for learning the languages. Once you are ready to go beyond clicking on smiley faces and putting up messages boxes then search the web for Javascript game engines, first one I got back was craftjs.com, there seems to be an upwards scrolling shooting game as a demo on there, but I haven't looked at it in any depth. Good luck [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] (Oh you'll need an editor, try Notepad++ from [url="http://www.portableapps.com"]www.portableapps.com[/url])
  5. Creating & deleting pointers

    [quote name='Ubermeowmix' timestamp='1343242845' post='4963039'] [quote name='FredOrJoeBloggs' timestamp='1343206959' post='4962860'] Especially the redundant nulling of the pointers, its good practice, but might have performance issues in games. [/quote] Oh in what sense is that a bad thing, as this is definitely games coding! [/quote] It depends on what your compiler does. If it compiles the code as is, then it will waste a few instructions. If the compiler optimises the code, it might well remove the code. If you want speed remove redundent code before you compile. [quote name='Ubermeowmix' timestamp='1343242845' post='4963039'] [quote name='FredOrJoeBloggs' timestamp='1343206959' post='4962860'] However, I can't see why you are using dynamic memory for this data, why not just let the class members be a string and an int? I apreciate you may have simplified it for the question, in which case ignore this comment. [/quote] So if i want to store floating point numbers and strings they can just be basic type def calls and that will save on CPU power will it?, what would I need to use the dynamic memory for? just the initial instantiation of the class (or Animal) into a vector (as in larspensjo's example), and then delete it if the object dies in game for instance. [/quote] Dynamic memory is useful if you don't know who many of the objects you are going to have. If you know how many objects of a certain type you will have at maximum AND the amount of memory that uses doesn't hinder the running of the program then use stack memory. However since you are using a std::vector you are already using dynamically allocated memory (al be it managed in a library for you). The objects that you are placing into the vector can have dynamic memory, but they could also be 'non-dynamic'. If performance is an issue then write your code such that you can replace the way the data is stored without affecting the rest of the code and then bench mark the two options by performing so many thousand operations that will excersize the code. [source lang="cpp"]#include <afx.h> #include <string> #include <vector> class CAnimalsD { // Animal class using dynamic memory public: typedef std::vector<CAnimalsD> VECTOR; public: CAnimalsD(const std::string& name = "", const int& health = 2) : m_pName(new std::string(name)) , m_pHealth(new int(health)) {} CAnimalsD(const CAnimalsD& other) : m_pName(new std::string(*other.m_pName)) , m_pHealth(new int(*other.m_pHealth)) {} ~CAnimalsD() { if (m_pName) delete m_pName; if (m_pHealth) delete m_pHealth; } private: std::string* m_pName; int* m_pHealth; }; class CAnimalsS { // Animal class using static memory public: typedef std::vector<CAnimalsS> VECTOR; public: CAnimalsS(const std::string& name = "", const int& health = 2) : m_Name(name) , m_Health(health) {} CAnimalsS(const CAnimalsS& other) : m_Name(other.m_Name) , m_Health(other.m_Health) {} ~CAnimalsS(){} private: std::string m_Name; int m_Health; }; // Gash test program. int main (void) { static const int constTestCycles = 10000; CAnimalsD::VECTOR animalsD; CAnimalsS::VECTOR animalsS; const DWORD startTime = GetTickCount(); for (int i = 0; i < constTestCycles; ++i) { animalsS.push_back(CAnimalsS("FRED", i)); } animalsS.clear(); const DWORD midTime = GetTickCount(); for (int i = 0; i < constTestCycles; ++i) { animalsD.push_back(CAnimalsD("FRED", i)); } animalsD.clear(); const DWORD endTime = GetTickCount(); printf("dynamic test = %d\n", midTime - startTime); printf("static test = %d\n", endTime - midTime); printf("press enter to exit\n"); return fgetc(stdin); }[/source]
  6. I need them helps... again!

    Kripis, This might help you [url="http://www.tutorialspoint.com/cplusplus/index.htm"]http://www.tutorialspoint.com/cplusplus/index.htm[/url]
  7. Creating & deleting pointers

    [quote name='Ubermeowmix' timestamp='1343165067' post='4962739'] Does the object still exist on the HEAP, or do I still need to delete it? This is the bit that confuses me, as if it still exists in memory then surely I still need to get rid of it... don't I? [/quote] MyAnimal1 is created on the stack The pointers within the class are created on the stack. The memory that the pointers point to is created on the heap. Because of the way you have written you destructor all the memory will be released when it is called, so you have done everything right. Especially the redundant nulling of the pointers, its good practice, but might have performance issues in games. However, I can't see why you are using dynamic memory for this data, why not just let the class members be a string and an int? I apreciate you may have simplified it for the question, in which case ignore this comment.
  8. Complete beginner

    C++ is a great language, I've been using it for 20+ years. Don't try an learn it as a first language, it will destroy you. C#, VB, etc are really cool languages, but the sheer volume of library functions is enough to put anyone off. Python also has a lot of libraries and again this can cause issues when it come to learning. Also (since I guess you ultimate aim is to learn C++) it has a number of un-C++ like areas that might cause you issues when you try and move over. JavaScript is probably quite a good place to start. It has no cost, Firefox and notepad will get you going and you can get quite complex with it. I think it will be quite easy to get to grips with thinking like a programmer, which is what you really need to learn, not the language, also its quit C like. (see [url="http://www.w3schools.com"]www.w3schools.com[/url])
  9. Can I avoid the hassle of these IDE's?

    I know what you mean. Until the last 12 months I have always used Visual Studio 6 to 2010 for C++ and its always been really simple and easy. At work we team it up with Scons and don't have an issue, at home I spend and extra 5 minutes getting the settings right before I start doing too much. Then I started with PHP. It was an absolute nightmare. Like you said editing the code was easy, but getting it to run was a nightmare. Java was worse still, Netbean might well be a great tool, but its totally alien to me, all the shortcut keys are 'wrong'. IDEs are meant to make things easier, but if they don't then don't use them. You can use Visual Studio from the command line, or you can call the compiler and linker directly, but I think it will get a bit teadious to keep doing it all manually every time, so get a 'make' like tool or script. But is learning how to configure a make tool that much different to learning how to use an IDE in the first place.