• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Programming Thread

Status
Not open for further replies.

mr. ck

कुछ मीठा हो जाये
  • 308
    Posts
    14
    Years
    Every new[] should have a delete[] paired to it... Just like a malloc() call needs a free() call (C).
    Yes the example program will have memory leaks...

    But say:
    int myValue = 10;
    int *myPointer = new int;
    int *ptr2 = myPointer;
    myPointer = &myValue;
    delete ptr2;

    This will not.
     

    Chad -

     
  • 687
    Posts
    14
    Years
    • Seen Aug 27, 2012
    Oh right. Memory leaks are dangerous. They eat up free memory from the program you're making and others, too. They also affect the computer, right? It happened to me once and my PC started acting..slow. There were many memory leaks, btw!
     

    mr. ck

    कुछ मीठा हो जाये
  • 308
    Posts
    14
    Years
    Oh right. Memory leaks are dangerous. They eat up free memory from the program you're making and others, too. They also affect the computer, right? It happened to me once and my PC started acting..slow. There were many memory leaks, btw!
    Yup, memory leaks are evil... :)
     

    Chad -

     
  • 687
    Posts
    14
    Years
    • Seen Aug 27, 2012
    Is C# OS-compatible? Meaning, if one were to program in it, is it solely used for Windows or is portable to other OS?
     

    twocows

    The not-so-black cat of ill omen
  • 4,307
    Posts
    15
    Years
    Is C# OS-compatible? Meaning, if one were to program in it, is it solely used for Windows or is portable to other OS?
    You can run C# applications on other OSes using Mono, but it's not the greatest thing ever. C# applications work better on Windows.
     

    Chad -

     
  • 687
    Posts
    14
    Years
    • Seen Aug 27, 2012
    ^ Okay, thank you for that.

    Suppose I want to make a game engine and I need to use a particular programming language. From what I grasped from the GameDev website, C++ is the way to go. However, there are many who do not use C++, but are suggesting to use C#/Java. There are many who see C++ slow as compared to other, more recent languages and inefficient. I'm pretty much confused, because each person there told me a different thing. Hopefully, someone here might know the right decision to take. I want to stick with one language all the way and do not want to change it.

    If I ask too many questions, please tell me to shut up -..-
     

    twocows

    The not-so-black cat of ill omen
  • 4,307
    Posts
    15
    Years
    ^ Okay, thank you for that.

    Suppose I want to make a game engine and I need to use a particular programming language. From what I grasped from the GameDev website, C++ is the way to go. However, there are many who do not use C++, but are suggesting to use C#/Java. There are many who see C++ slow as compared to other, more recent languages and inefficient. I'm pretty much confused, because each person there told me a different thing. Hopefully, someone here might know the right decision to take. I want to stick with one language all the way and do not want to change it.

    If I ask too many questions, please tell me to shut up -..-
    If you know what you're doing, C++ is way more efficient than C# or Java. Development time might be a little longer, and you could always have memory leaks and the like. Most corporation-made games are done in C++, as far as I know.

    I'm pretty sure OpenGL and DirectX are compatible with C++, I know DirectX is compatible with C# and OpenGL might be, and I'm not sure about Java.
     

    twocows

    The not-so-black cat of ill omen
  • 4,307
    Posts
    15
    Years
    I "star" in HTML, CSS, javascript, PHP, and SQL, but thats about it
    None of those are really programming languages. HTML is markup, CSS is styling, JavaScript and PHP are scripting, and SQL is purely for databases.

    If you want to learn programming, C# is a good place to start.
     

    mr. ck

    कुछ मीठा हो जाये
  • 308
    Posts
    14
    Years
    Suppose I want to make a game engine and I need to use a particular programming language.
    It doesn't really matter. Use what you are comfortable with.
    From what I grasped from the GameDev website, C++ is the way to go.
    Yup, that's what most professional games are built in.
    However, there are many who do not use C++, but are suggesting to use C#/Java. There are many who see C++ slow as compared to other, more recent languages and inefficient.
    I call that BS. C++ is much faster and efficient. And at least it is portable. Yes something like C# or Java would be much easier to use.
    If you program in say C# with XNA, you'll spend more time creating the game rather than fixing technical problems with the code such as memory leaks, etc.
    I'm pretty much confused, because each person there told me a different thing. Hopefully, someone here might know the right decision to take. I want to stick with one language all the way and do not want to change it.

    If I ask too many questions, please tell me to shut up -..-
    I'll just say, make games which ever way you want to or are comfortable. The languages that you find easier, that you are more comfortable with.
    If you are just starting out, have a look at
    1. Python and PyGame
    2. C# and XNA (great community tutorials)
    If you want to do it with C++, have a look at NeHe's tutorials for OpenGL. For DirectX, I'm really not sure.

    If you know what you're doing, C++ is way more efficient than C# or Java. Development time might be a little longer, and you could always have memory leaks and the like. Most corporation-made games are done in C++, as far as I know.

    I'm pretty sure OpenGL and DirectX are compatible with C++, I know DirectX is compatible with C# and OpenGL might be, and I'm not sure about Java.
    Java has it's own implementations as far as I know.
    Latest versions of C# only work with XNA (a framework for DirectX) and not DirectX. C# does not support OpenGL. To use OpenGL you, must third party libraries or combine C++ and C# code.
    C++ works with both DirectX and OpenGL.
     
    Last edited:

    Chad -

     
  • 687
    Posts
    14
    Years
    • Seen Aug 27, 2012
    I'm most comfortable with C++, for it was my second serious language, after failing to be creative/productive in Ruby. I like its syntax and though somehow considered low-level, still is efficient to me.

    I'll most likely stick with this, because I doubt it will die anytime soon. And I'll probably learn C# or Java afterward. For gaming purposes, OpenGL seems the right choice for me, but I will probably start by making simpler 2D games using either the Allegro library or Troll2D one. Can you recommend any other libraries for basic 2D graphics, audio and text outputs, image manipulations and the such? The library should have C++ as its primary language.
     
    Last edited:

    mr. ck

    कुछ मीठा हो जाये
  • 308
    Posts
    14
    Years
    I'm most comfortable with C++, for it was my second serious language, after failing to be creative/productive in Ruby. I like its syntax and though somehow considered low-level, still is efficient to me.

    I'll most likely stick with this, because I doubt it will die anytime soon. And I'll probably learn C# or Java afterward. For gaming purposes, OpenGL seems the right choice for me, but I will probably start by making simpler 2D games using either the Allegro library or Troll2D one. Can you recommend any other libraries for basic 2D graphics, audio and text outputs, image manipulations and the such? The library should have C++ as its primary language.
    SDL... That's the easiest to use and works with both Unix based OSs and Windows. SDL has libraries to do everything you would need to create a 2D game.
    Read LazyFoo's tutorials.
    I started with SDL. It was the easiest set of libraries to use. Then I came across this book "Beginning Game Programming" by Michael Moore (It has many errors, but it's a good book to get you started) And he used DirectX so I started using it.

    If you want you can do 2D games with OpenGL... But you'll need other libraries to handle sound and networking etc.

    I haven't used Allegro or Troll2D but I've heard that Allegro is good.

    I'm not sure what you mean by Image Manipulation. Games don't require image manipulation. Do you mean something like the GD library? I don't think you'll need that for a game.
     

    Chad -

     
  • 687
    Posts
    14
    Years
    • Seen Aug 27, 2012
    Is SDL free/open-source? I will handle OpenGL when I can do simple games for now. I'll leave to later, for 3D.

    By image manipulation, I meant it like the GD library, which is to create our own images, right? In Allegro, image manipulation is a feature in the library and I'm not sure if they mean something similar to the GD graphics library. Since GD is somehow obsolete now, I probably won't use it anyways.
     

    mr. ck

    कुछ मीठा हो जाये
  • 308
    Posts
    14
    Years
    Is SDL free/open-source? I will handle OpenGL when I can do simple games for now. I'll leave to later, for 3D.

    By image manipulation, I meant it like the GD library, which is to create our own images, right? In Allegro, image manipulation is a feature in the library and I'm not sure if they mean something similar to the GD graphics library. Since GD is somehow obsolete now, I probably won't use it anyways.
    Yes SDL is free, not open source though. And yeah, even I'd suggest you to leave OpenGL for 3D only.
    EDIT: Thanks for correcting me Chad. It's Open Source.

    GD can edit images, create them, everything... You don't really have to that when creating games. By images I mean, PNGs and JPEG and BMPs etc...
    If you just want to draw those images on screen, or you want to create shapes, you would not need GD. Why would you need to dynamically create images in games? Textures and sprites should be already created during development anyway...
     
    Last edited:

    Chad -

     
  • 687
    Posts
    14
    Years
    • Seen Aug 27, 2012
    According to this, SDL is free AND an open-source software. And you're right, I won't use the GD library. Thanks for the reply, mr. ck.
     
    Last edited:

    mr. ck

    कुछ मीठा हो जाये
  • 308
    Posts
    14
    Years
    According to this, SDL is free AND an open-source software. And you're right, I won't use the GD library. Thanks for the reply, mr. ck.
    Sorry... My bad :P

    I just googled whether SDL was open source and didn't get any useful results, so I assumed it was not.
     

    Chad -

     
  • 687
    Posts
    14
    Years
    • Seen Aug 27, 2012
    ^ Lol.

    Okay. So I started with SDL and it's pretty direct and has an easy syntax. Thanks for the recommendation, mr. ck. It's actually better than Allegro.
     

    mr. ck

    कुछ मीठा हो जाये
  • 308
    Posts
    14
    Years
    I am glad I could help you... SDL is how I started as well :)
     

    Chad -

     
  • 687
    Posts
    14
    Years
    • Seen Aug 27, 2012
    "What PL do you use?" discussion thread

    Who here knows how to program? What languages do you know? Did you master one and how long did it take you? Discuss why you chose this language and what features and such made you stick with it, and why it's better than others.
     

    Dawn

    [span="font-size:180%;font-weight:900;color:#a568f
  • 4,594
    Posts
    15
    Years
    I know Python, Java, and PHP mainly. =3 Each one was taken as part of a school course over the course of 2 years.
     
    Status
    Not open for further replies.
    Back
    Top