Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Which language to use?  (Read 12176 times)

0 Members and 1 Guest are viewing this topic.

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Which language to use?
« on: April 14, 2010, 02:44:32 pm »
Hello. I am a hobbyist programmer. I do not have academic programming knowledge, only the things I learned on my own.

I would like to write a 2D racing game of my own, and I really like SFML. However, there are many obstacles when I try to write it in C++. I lack the flexibility of PHP, I can't really grasp the whole low-level programming stuff, like memory management, pointers. Converting numbers to strings is a real pain in the ass.

I have heard about Python, although I do not know how to program in this language.

So I would like to have some advice from more advanced programmers. For a hobbyist programmer, who does not like to fiddle much with the source code to get things done, which programming language should I use? Are the SFML bindings fully functional? Or should I stick with C++?

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Which language to use?
« Reply #1 on: April 14, 2010, 03:12:57 pm »
Firstly, I'm not formally educated in programming or anything similar.

I would really recommend C++ above the rest, I found parts of it ridiculous while I was learning the basics but now I am glad C++ is what I focused on.

I'm not a real fan of programming in Python, it can be a useful tool for scripting and automation, but I do view it as a tool rather than a "proper" programming language, I've never looked into the Python SFML binding.

I'm pretty sure the .NET binding is very close if not the same as the C++ one, if you are interested in a .NET language.

If you already are learning C++, I say stick with it.

Hopefully this is of some help and not just confusing :)

Converting numbers to strings pisses me off too lol :P

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Which language to use?
« Reply #2 on: April 14, 2010, 03:32:27 pm »
All version of the .Net bindings are up-to-date (even in SFML 2) ;)
Laurent Gomila - SFML developer

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Which language to use?
« Reply #3 on: April 14, 2010, 03:44:09 pm »
Just use C++ and keep it simple. You don't have to use pointers or anything complex. If you are just making a simple game you can hardcode most things (and that can even make it faster).

The real answer is that you need to make your game simple until you become a better programmer.

IE, make a shmup--there are a bunch of people here making those too.

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Which language to use?
« Reply #4 on: April 14, 2010, 04:14:37 pm »
so, by .NET you mean C#? I know that C# has some nice functions included, which make eg. type conversion easier. But is this whole "binding" a simple thing to do for a noob? Are there no compatibility issues, do the binding work 100% and are they efficient to use? How about portability, if I write in C#, will I be able to compile it under Linux?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Which language to use?
« Reply #5 on: April 14, 2010, 04:29:40 pm »
Quote
so, by .NET you mean C#?

I mean all .Net languages. Once an assembly is compiled, it can be used by all the .Net languages. There's a VB.Net sample in SFML.Net to demonstrate that.

Quote
But is this whole "binding" a simple thing to do for a noob?

The .Net API is almost the same as the C++ one, there are just a few things that have been modified to better suit the language.

Quote
Are there no compatibility issues

Compatibility with what? :)

Quote
do the binding work 100%

As far as I know.

Quote
and are they efficient to use?

Absolutely, the overhead of accessing the actual functions through several DLLs is in fact pretty low.

Quote
How about portability, if I write in C#, will I be able to compile it under Linux?

I've written the binding with Linux compatibility in mind. I've never tried to compile it on Linux with Mono, but it should be ok.
Laurent Gomila - SFML developer

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
Re: Which language to use?
« Reply #6 on: April 14, 2010, 04:31:23 pm »
Quote from: "kolofsson"
I lack the flexibility of PHP, I can't really grasp the whole low-level programming stuff, like memory management, pointers. Converting numbers to strings is a real pain in the ass.

If you know and are used to php I definitely suggest not to use C++. I suggest you to try Phyton or Ruby, they are more like php style.

Quote from: "kolofsson"
I have heard about Python, although I do not know how to program in this language.

There's plenty of information out there, just have a look at Phyton site, it's documentation and wiki beginners guide.

I think C++ is too much powerful and complex for what you want, give Phyton a try and see what you think about it ;)
I actually never used Phyton or Ruby, but I have an idea about it...
Pluma - Plug-in Management Framework

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Which language to use?
« Reply #7 on: April 14, 2010, 04:43:31 pm »
Asking what language to program SFML in is kinda like moving to Japan and asking what language you should speak.

Yeah, you can speak whatever you want, but depending on who you want to understand and help you is important. It depends on your background and what you want to do.

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Which language to use?
« Reply #8 on: April 14, 2010, 05:18:16 pm »
Quote from: "Laurent"

I mean all .Net languages. Once an assembly is compiled, it can be used by all the .Net languages. There's a VB.Net sample in SFML.Net to demonstrate that.


OK, I read a bit about the .NET. I did not know that there are more languages than C# working with the .NET framework.

So, I have found out that there is such thing as iron Python, which is Python for .NET. So the question is, which would be better: PySMFL or SFML.NET with iron Python?

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Which language to use?
« Reply #9 on: April 15, 2010, 02:58:23 am »
If you are going to be coding in Python, PySFML is most certainly the better choice.

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Re: Which language to use?
« Reply #10 on: April 15, 2010, 08:26:09 am »
Quote from: "kolofsson"
Converting numbers to strings is a real pain in the ass.
Why do you want to do that ? Don't you think you could do better by using strings for string stuff and numbers for number stuff ?
Mindiell
----

pdusen

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Which language to use?
« Reply #11 on: April 15, 2010, 12:52:11 pm »
Quote from: "Mindiell"
Quote from: "kolofsson"
Converting numbers to strings is a real pain in the ass.
Why do you want to do that ? Don't you think you could do better by using strings for string stuff and numbers for number stuff ?


Anyway, it's not really hard at all.

Code: [Select]

int number = 5;

std::stringstream num_stream;

num_stream << number;

std::string num_string = num_stream.str();


And besides that, Boost (and C++0x, I believe) offer a lexical_cast to do pretty much the same thing in one line.

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Which language to use?
« Reply #12 on: April 15, 2010, 11:01:27 pm »
Quote from: "Mindiell"
Why do you want to do that ? Don't you think you could do better by using strings for string stuff and numbers for number stuff ?


Wow, I almost don't know how to respond to that. I need to print some values to check how some variables behave. Anyway, I'm using the good old sprintf. For me, the c++ way of working with strings is terrible.

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Re: Which language to use?
« Reply #13 on: April 16, 2010, 09:22:24 am »
Quote from: "kolofsson"
Wow, I almost don't know how to respond to that. I need to print some values to check how some variables behave. Anyway, I'm using the good old sprintf. For me, the c++ way of working with strings is terrible.

Why don't you simply use std::cout ?
Code: [Select]
int main()
{
 int a = 3;
 float b = 3.4;
 std::string foo = "bar";

 std::cout<<"int : "<<a<<std::endl;
 std::cout<<"float : "<<a<<std::endl;
 std::cout<<"string : "<<a<<std::endl;
}


Be careful, I'm just asking questions, not judging you. It's always interesting to see what others do.
Mindiell
----

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Which language to use?
« Reply #14 on: April 16, 2010, 11:08:29 am »
std::cout is fine until you want to use something like sf::String and have numbers to print to it. I imagine this is what kolofsson is trying to do.

As pdusen said it's not that hard anyway, although it is a little bit more difficult than string += someInt;  :lol:

 

anything