Posts: 746
Threads: 55
Joined: Apr 2008
06-20-2015, 11:24 PM
(This post was last modified: 06-21-2015, 02:23 AM by Som1Lse.)
So the thread "The A-Engine: A new Beat 'em Up game engine" was recently invaded by a discussion about programming languages, so I thought it would be a good idea to take the discussion to a new thread.
Here are the posts: (quotes have been reduced in size so they will take up less space, everything else is a direct copy from the current version of the post)
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Keep up the good work and please don't feel like I'm trying to start a fight...
There are few things I'm going crazy about:
First, why on earth people think writing a game using C++ is a good idea?!! It's horrible, verbose, disgusting, error prone and unproductive meanwhile C#, Java and derivatives are exact opposite and there are a lot of sophisticated and flexible libraries out there that makes your life so easy that you can finish the same project like 5 times faster and I'm %100 sure you would get a better result. Another drawback is that it is extremely difficult to implement an AI system in C++ while you can simply use reflection in C#/Java and let other people to code AI in the same language (which is probably much better than the one you created). Don't argue saying C++ is faster because a LF2 like game does not require such high optimization, remember you're not an AAA-Studio you're A-Man. Also keep in mind that most of the Android games are Java. Some people say garbage collection (GC) is a problem, it's NOT. Not only it will save you from manual memory management (MMM), a qualified GC can perform better if you're not a C++ pro. Even if you need to tweak GC, it's a magnitude easier than MMM. After all, "The Witcher 2" is an AAA-Game that uses GC effectively. C# and Java have so great IDE's (Visual Studio, SharpDevelop, Eclipse, Netbeans) that you feel ultra comfortable while writing code and auto-complete makes you uber fast. (Should I even mention those useful profiler tools and incredibly nice standard libraries?)
Secondly, I don't understand what the hell is wrong with those who are trying to create their own data syntax/format while they can use existing ones (XML, JSON, YAML, Protobuf, BSON...). You're doing nothing but overloading your work to write a new parser library and it will probably not going to be as fast as existing libraries that parse existing data formats. Also, inventing a brand new unique data format results with need for a new data changer, while someone can simply use Notepad++ to change a XML/JSON based data and syntax highlighting, intellisense and auto-indentation will just work. No one actually needs a new data format, existing ones are sufficient. I would recommend Protobuf as it is really fast, takes low space, backward compatible and rock-solid, but it's a binary format, meaning that it's neither human readable nor editable, it needs a special data changer, but with the help of those great high level libraries, it's not a big challenge to provide that.
I would use the following combination:
C#/Mono + OpenTK (or MonoGame for a higher level API) + Protobuf-Net
I must add that bytecode compiled languages are easy to do reverse engineering (so easy that you can extract most of the source code just using a simple program such as ILSpy). Thus, it's more likely that your game is going to be moded (and obviously we're trying to create an extensible game). If you don't like the idea of source theft, you can always obfuscate your code. But if it's not enough, and you still want your code to be compiled into native CPU instruction sets, then do yourself a favor and learn "D Programming Language". With the help of Eclipse + DDT plugin (and a compiler of course), anything is possible.
Now, I'm shouting to all those who wants to make games, don't prefer C++ just because it's popular except you really really know what you're doing and consider other options before C++ cuz chances are high that you don't know what you're falling for. Notice that Unity (game engine) use C# as it's primary scripting language GC enabled. The spoiler was added later after my post in the same thread.
(06-19-2015, 09:46 AM)AmadisLFE Wrote: (06-19-2015, 04:10 AM)Nightmarex1337 Wrote: [ ... ]
Erm, Hate to go Off-topic here, but LF2 is also Coded in C++, And LF2 is Still better than a lot of games out there, because of its Possibilities, Games don't have to be 3D To be Good you know, and also I know that Doctor A can make Custom AI's in this game possible, just like Silva did for LF2.
Also, you don't have to call C++ A Bad Coding Language, reasons are already Told :-)
(06-19-2015, 12:44 PM)Rhino.Freak Wrote: I don't know much about the programming stuff but I think that your post is a bit meaningless NOW because A-engine is very much done and developed no matter how "extremely difficult" stuff was to implement here, the core is all already done.. I know that being an A-insider along with many other things like how the engine itself can handle pretty much what you can throw at it.
Also I can't help but notice your personal hateful bias towards C++ :( you were too harsh at it.
(06-19-2015, 06:29 PM)Someone else Wrote: (06-19-2015, 04:10 AM)Nightmarex1337 Wrote: First, why on earth people think writing a game using C++ is a good idea?!! [ ... ] Oh really? One major reason why you would want to use C++ is CPU caches (here here and here), as you have much more control on how data is layed out in memory.
Granted for a 2D game this is (like you stated later) less of an issue.
It is NOT horrible nor is it verbose, disgusting, error prone or unproductive, nor are C# and Java somehow exactly the opposite. If you this is the case at least provide examples of why you think so.
Java:
JAVA-Code:
MyClass myObject = new MyClass(42,23);//notice MyClass is written twice
|
C++ version:
C++-Code:
MyClass myObject{42,23};//notice MyClass is written once
|
When it comes to C++ there are (just like you stated for Java and C#) "a lot of sophisticated and flexible libraries out there", granted the standard library is smaller than that of C# and Java.
I do not see how using a different language would magically be five times faster.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Another drawback is that it is extremely difficult to implement an AI system in C++ while you can simply use reflection in C#/Java [ ... ] I doubt that it is "extremely difficult to implement an AI system in C++", so please give examples. That said reflection is a feature that C++ is lacking (there is a study group for it though). I would add that one reason for having AI work using a different language, is that you would be able to change the AI without having to modify the source code.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Don't argue saying C++ is faster because a LF2 like game does not require such high optimization, [ ... ] A game like LF2 may not require nearly the same level of optimization, but it is really easy to paint yourself into a corner with poorly performing code (goes for C++ as well). That said I agree that it is probably not a big deal here.
A lot of Android games using Java is an appeal to majority.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Some people say garbage collection (GC) is a problem, it's NOT. [ ... ] I have been programming in C++ for many years, and I seriously do not think memory management is a problem. Use smart pointers (unique_ptr, shared_ptr, whatever you write yourself) for owned resources and the problem is mostly solved already.
Source on The Witcher 2?
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: C# and Java have so great IDE's [ ... ] I am not sure that this was meant as an argument against C++, but yeah three out of four of the IDEs you mentioned also work for C++. There are of course also other C++ IDEs (Code::Blocks, CodeLite).
Profilers are also available for C++, although (like previously mention) the standard library is somewhat lacking in comparison to that of C# and Java. It is being worked on (and there are non standard libraries available) but for the moment that is indeed a valid argument against C++.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Secondly, I don't understand what the hell is wrong with those who are trying to create their own data syntax/format while they can use existing ones [ ... ] This is not necessarily wrong, but I can come up with a good reason for this, namely it can be easier to read and write for humans, which is the same reason why programming languages don't use a markup language structure.
By a special data changer I imagine (correct me if I am wrong) that you mean a graphical interface with textfields and other controls as opposed to just an editor with a large textarea, where you write code, but in my experience such a program can easily be slower than simply writing everything in a texteditor.
Notepad++ would also be usable for any new format, that is stored in plain text. Making a syntax highlighter for a new language is not a problem in Notepad++.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: I must add that bytecode compiled languages are easy to do reverse engineering [ ... ] I do not see how you could at all sell this as a feature. Honestly that is just dumb. You would achive the exact same effect by simply releasing the source code.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: If you don't like the idea of source theft, [ ... ] Honestly source theft is not a thing I would worry about, no matter how easy it would be, so I will not argue against that.
I do not know much about D, but there is certainly some things I like (for example the ! syntax for templates is somewhat nice, and so is the static if stuff), but that is about it.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Now, I'm shouting to all those who wants to make games, [ ... ] I guess I may as well then shout to everyone who wants to make anything: Do not just prefer C# and Java because they are easier than C++, because they are not. Try out the languages a bit and get a feel for the style you like to use, then pick a language that you like. Personally I find Java especially (and somewhat also C#) to be too lacking in core language features.
(06-19-2015, 08:41 PM)Doctor A Wrote:
Quote:First, why on earth people think writing a game using C++ is a good idea?!! It's horrible, verbose, disgusting, error prone and unproductive meanwhile C#, Java and derivatives are exact opposite and there are a lot of sophisticated and flexible libraries out there that makes your life so easy that you can finish the same project like 5 times faster and I'm %100 sure you would get a better result. I've got to admit that a reason that might be why I picked up C++ is because, like you said, everyone was using it. It's pretty natural if you ask me; I just picked what I thought has a bigger community I could learn from. All what you said about the syntax is subjective, so I won't say anything about it. I am not sure about flexibility though. The mere existence of pointers in C++ makes things much more flexible than any of the languages you've named. C++ might be error-prone, but I'd hate to have things work undercover too. People criticize me for constantly trying to "reinvent the wheel", but I like knowing as much as possible about what is going on with stuff I do. I do try to stay away from that premise when time is at stake though, but here I am just doing it to learn. The A-Engine code has been refactored so many times that I could be certain the whole thing went through several rewrites in the process.
Quote:Another drawback is that it is extremely difficult to implement an AI system in C++ while you can simply use reflection in C#/Java and let other people to code AI in the same language (which is probably much better than the one you created). Don't argue saying C++ is faster because a LF2 like game does not require such high optimization, remember you're not an AAA-Studio you're A-Man. Also keep in mind that most of the Android games are Java. Some people say garbage collection (GC) is a problem, it's NOT. Not only it will save you from manual memory management (MMM), a qualified GC can perform better if you're not a C++ pro. Even if you need to tweak GC, it's a magnitude easier than MMM. After all, "The Witcher 2" is an AAA-Game that uses GC effectively. C# and Java have so great IDE's (Visual Studio, SharpDevelop, Eclipse, Netbeans) that you feel ultra comfortable while writing code and auto-complete makes you uber fast. (Should I even mention those useful profiler tools and incredibly nice standard libraries?) I've no idea what reflection is, but I don't think AI would work very different from what SomeoneElse and Silva managed to do. The engine would simply compile the C/C++ AI function files the user writes at launch. In case you don't want to do complicated AIs, there will be a layer script you can write that does the common and skips on the details.
While I am not going to argue and say C++ is faster, I will say that what LF2 is capable of is barely a thing with the A-Engine. As the A-Engine is to support polygonal platforms, one might need to go a bit over simple 2D stuff (using 3D models for platforms, and consequently shadow mapping would be a must. The physics would have to get more elaborate also.) I am not a very good programmer like you are, and C++ being faster in nature is a big plus for me. I still often reach bottlenecks even with C++, and I don't think I can afford moving to something more high-level until I have a good grasp on how things work on a reasonable fundamental level.
As for the auto-completion, I've tried VS, DevC++, Eclipse and Code::blocks IDEs and all those have the auto-completion feature as SomeoneElse have mentioned.
Quote:Secondly, I don't understand what the hell is wrong with those who are trying to create their own data syntax/format while they can use existing ones (XML, JSON, YAML, Protobuf, BSON...). You're doing nothing but overloading your work to write a new parser library and it will probably not going to be as fast as existing libraries that parse existing data formats. Also, inventing a brand new unique data format results with need for a new data changer, while someone can simply use Notepad++ to change a XML/JSON based data and syntax highlighting, intellisense and auto-indentation will just work. No one actually needs a new data format, existing ones are sufficient. I would recommend Protobuf as it is really fast, takes low space, backward compatible and rock-solid, but it's a binary format, meaning that it's neither human readable nor editable, it needs a special data changer, but with the help of those great high level libraries, it's not a big challenge to provide that.
I would use the following combination:
C#/Mono + OpenTK (or MonoGame for a higher level API) + Protobuf-Net Okay, you've made a point there. I am forcing people to learn a completely different language when I could've just used what is already there and commonly used. However, things have proved to be quite readable the way they are currently. I will look up into Protobuf the next time I do something mod-able, but now, it's gotten late. Thanks for the suggestion though!
Quote:I must add that bytecode compiled languages are easy to do reverse engineering (so easy that you can extract most of the source code just using a simple program such as ILSpy). Thus, it's more likely that your game is going to be moded (and obviously we're trying to create an extensible game). If you don't like the idea of source theft, you can always obfuscate your code. But if it's not enough, and you still want your code to be compiled into native CPU instruction sets, then do yourself a favor and learn "D Programming Language". With the help of Eclipse + DDT plugin (and a compiler of course), anything is possible. I take too much from the internet to feel bad about giving away this little. Regardless, I do not wish to start learning a new language with similar purpose to what I know already. C++ as a language has been improving over time, and I am sure it will has most of what D has in the near future.
(06-20-2015, 05:34 AM)Dia6lo Wrote: 0. .NET
1. Syntactic sugar
2. Resharper (crazy stuff)
3. LINQ
4. Tons of syntactic sugar
5. Garbage collection (seriously, this one helps much)
6. No headers or includes
7. No -> or ::, just dot(.)
8. Properties, as wel as auto-properties
9. Readonly fields (not const)
(06-20-2015, 11:01 PM)Doctor A Wrote: (06-20-2015, 05:34 AM)Dia6lo Wrote: [ ... ] 0. Doesn't make a difference.
1. Just a matter of taste and what you've gotten used to really. I know people who find C languages more readable compared to supposedly clearer languages like Python.
2. Oh well, that is pretty cool. I would rather type down these few lines myself though.
3. The functions can be implemented easily with C++ templates. And if you'd like to go more fancy and SQL-like with streams: https://cpplinq.codeplex.com/.
4. Tons of 1.
5. Already on the way for C++.
6. "using" still. Header files are meant to act like blue prints. They can suffice as a documentation, or a reference guide at least.
7. erm. Are you blaming C++ to be more specific? The "->" is used to access data at pointers; that which is absent in C#. References you say? You lose pointer arithmetic.
8. Ah well.
9. I am not sure, but I think they can be said to be like C++'s static variables.
(06-20-2015, 11:13 PM)Bamboori Wrote:
honestly though, as long as the language/engine you are using suffices for your game, why change it?
And here is my response to Dia6lo's post:
(06-20-2015, 05:34 AM)Dia6lo Wrote: 0. .NET While I have little experience with it (and .NET in general), I know that C++ can also be used in order to write programs for the .NET platform (see C++/CLI). It may very well not be as good as a C# given that C# was designed for the .NET platform; I cannot tell as I use neither.
I would like to know what the benefits of using a platform like .NET as as opposed to native code.
(06-20-2015, 05:34 AM)Dia6lo Wrote: 1. Syntactic sugar
4. Tons of syntactic sugar Syntactic sugar is not exclusive to C#, C++ has it as well for example range-based for loop, but many other things could be considered syntactic sugar, like templates or classes.
(06-20-2015, 05:34 AM)Dia6lo Wrote: 2. Resharper (crazy stuff) I have no experience with this, so I cannot comment on the usefulness of it, but from what I can tell it is also available for C++.
(06-20-2015, 05:34 AM)Dia6lo Wrote: 3. LINQ Again something I have little experience with (due to small experience with C#), but I doubt implementing it (or at least something like it) in C++ would be a big issue.
blimp.h:
C++-Code:
#ifndef BLIMP_H_INCLUDED
#define BLIMP_H_INCLUDED
#include <cstdlib>
#include <iterator>
#include <type_traits>
namespace blimp {
namespace detail {
template <typename T>
struct SOwner {
using type = T;
inline static T &&forward(T &&t){ return std::move(t); }
inline static T &deref(type &t){ return t; }
};
template <typename T>
struct SOwner<T&> {
using type = T*;
inline static T *forward(T &t){ return &t; }
inline static T &deref(type t){ return *t; }
};
template <typename T>
using SOwner_t = typename SOwner<T>::type;
}
template <typename T,typename FuncT>
class CWhere {
public:
class iterator {
public:
iterator(typename T::iterator Base,CWhere *Parent):Base(std::move(Base)),Parent(Parent) {}
iterator(const iterator &rhs)=default;
iterator &operator=(const iterator &rhs)=default;
iterator(iterator &&rhs)=default;
iterator &operator=(iterator &&rhs)=default;
inline typename T::iterator &GetBase(){ return Base; }
bool operator==(const iterator &rhs){ return Base == rhs.Base; }
bool operator!=(const iterator &rhs){ return Base != rhs.Base; }
bool operator<(const iterator &rhs){ return Base<rhs.Base; }
bool operator<=(const iterator &rhs){ return Base <= rhs.Base; }
bool operator>(const iterator &rhs){ return Base>rhs.Base; }
bool operator>=(const iterator &rhs){ return Base >= rhs.Base; }
iterator &operator++(){
using std::end;
do {
++Base;
}while(Base != end(Parent->GetQuery()) && !Parent->Func(*Base));
return *this;
}
iterator &operator--(){
using std::begin;
do {
--Base;
}while(Base != begin(Parent->GetQuery()) && !Parent->Func(*Base));
return *this;
}
iterator operator++(int){ auto r = *this; ++*this; return r; }
iterator operator--(int){ auto r = *this; --*this; return r; }
decltype(auto) operator*(){ return *Base; }
private:
typename T::iterator Base;
CWhere *Parent;
};
CWhere(T Query,FuncT Func):Query(detail::SOwner<T>::forward(std::move(Query))),Func(std::move(Func)) {}
CWhere(const CWhere &rhs)=default;
CWhere &operator=(const CWhere &rhs)=default;
CWhere(CWhere &&rhs)=default;
CWhere &operator=(CWhere &&rhs)=default;
inline T &GetQuery(){ return detail::SOwner<T>::deref(Query); }
iterator begin() & { using std::begin; return iterator{begin(GetQuery()),this}; }
iterator end() & { using std::end; return iterator{end(GetQuery()),this}; }
iterator begin() &&=delete;
iterator end() &&=delete;
template <typename Func2T>
auto where(Func2T Func) & { return CWhere<CWhere&,Func2T>{*this,std::move(Func)}; }
template <typename Func2T>
auto where(Func2T Func) && { return CWhere<CWhere,Func2T>{std::move(*this),std::move(Func)}; }
private:
detail::SOwner_t<T> Query;
FuncT Func;
};
template <typename T>
class CFrom {
public:
using iterator = T;
CFrom(T Begin,T End):Begin(Begin),End(End) {}
CFrom(const CFrom &rhs)=default;
CFrom &operator=(const CFrom &rhs)=default;
CFrom(CFrom &&rhs)=default;
CFrom &operator=(CFrom &&rhs)=default;
iterator begin(){ return Begin; }
iterator end(){ return End; }
template <typename FuncT>
auto where(FuncT Func) & { return CWhere<CFrom&,FuncT>{*this,std::move(Func)}; }
template <typename FuncT>
auto where(FuncT Func) && { return CWhere<CFrom,FuncT>{std::move(*this),std::move(Func)}; }
private:
T Begin,End;
};
template <typename T>
auto from(T Begin,T End){ return CFrom<T>{Begin,End}; }
template <typename T>
inline auto from(T &t){ using std::begin; using std::end; return from(begin(t),end(t)); }
}
#endif // BLIMP_H_INCLUDED
|
main.cpp:
C++-Code:
#include <iostream>
#include "blimp.h"
using namespace s;
using namespace blimp;
int main(){
int Numbers[] = {0,1,2,3,4,5,6};
auto Query = from(Numbers).where([](auto e){ return (e%2) == 0; });
for(auto &e:Query) cout << e << ", ";
cout << endl;
return 0;
}
|
There is also sqlpp11 which has a (somewhat) LINQ-like interface for SQL databases, as well as ranges which are also somewhat similar.
I also just saw Doctor A's post with a link to a library that also looks pretty good: https://cpplinq.codeplex.com/
(06-20-2015, 05:34 AM)Dia6lo Wrote: 5. Garbage collection (seriously, this one helps much) I have yet to see a case where garbage collection is better than RAII. C++ smart pointers (unique_ptr and shared_ptr) already solve a lot of memory management issues.
(06-20-2015, 05:34 AM)Dia6lo Wrote: 6. No headers or includes Yeah, I admit #include is not a particularly nice thing about C++. There is a study group working on modules for C++, but it is unlikely that it will make it for C++17, so at the moment that is definitely a valid (although arguable minor) argument against C++.
I have not tried it out, but for anyone interested there is an implementation of modules in Clang: http://clang.llvm.org/docs/Modules.html
(06-20-2015, 05:34 AM)Dia6lo Wrote: 7. No -> or ::, just dot(.) I do not really see this as a problem, as they all have a very specific meaning and thus I never really use the wrong one accidentally.
In C# every object is a pointer, and so "." fulfils the purpose of "->", and C# just reuses "." when accessing members of types where C++ uses "::".
The case where "->" is nice is for smart pointers, as the "->" operator can be overloaded.
Just to be clear I do not think you are wrong here, it is just a minor bugbear if not just a matter of personal preference.
(06-20-2015, 05:34 AM)Dia6lo Wrote: 8. Properties, as wel as auto-properties I found this article on the topic of properties, so the way I understand them is that they are syntactic sugar for a getter and setter methods, for which I can definitely see the purpose, and while I am sure you could write something similar in C++ (using union, friend and operator overloading) chances are that it would be a poor way to do it, and would certainly require more code than in C#. The obvious thing to do here would be to simply write getter and setter member functions, which obviously lack the sweet look of properties, so this is again a (somewhat) minor bugbear, but definitely something I would not mind seeing.
That said I rarely run into code where I would want to use it (likely due to my programming style), so for now I make do with normal member functions.
Also the example on this article uses properties for letting you access the time as both seconds and hours. If something like this was a part of C++, that is not a case where I would use it.
C++-Code:
#include <chrono>
#include <iostream>
using namespace std;
int main(){
auto Seconds = 42s;
Seconds += 23h;
cout << Seconds.count() << "h" << endl;
return 0;
}
|
(06-20-2015, 05:34 AM)Dia6lo Wrote: 9. Readonly fields (not const) Unless I am missing something about how readonly works in C#, is basically the same way const works in C++:
C++-Code:
class MyClass {
public:
MyClass(int n = DefaultNum):Num(n) {}
const int Num;
static const int DefaultNum = 42;
};
|
would be equivalent to
CSHARP-Code:
class MyClass {
public MyClass(int n = DefaultNum){
Num = n;
}
readonly int Num;
static readonly int DefaultNum = 42;
}
|
Feel free to post your own opinions and discuss.
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
Posts: 1,073
Threads: 38
Joined: Mar 2008
Here we get into the discussion of "opinions", or "preferences". This is mine.
Everyone has their own goal, whether it is: - to create a game
- to create a game in a "proper" programming language
- to program in a particular programming language and create a game
- something else
Short version is, each programming language is suited for some goals more than others. C#/Java are easier to debug when things go wrong. C++ gives you more control and performance, but has far more difficult concepts and obscure error messages.
Writing a cross-platform application is easier when your code runs on a VM (.net, jvm), though c++ has mitigated this with preprocessor code + CMake (cross-platform Make).
Dependency management for retrieving and using libraries is way, way better (much easier to do) in C#/Java (yay for Maven), which makes them very nice to work with. But I like working with c++, and dependency management just got much better with [biicode].
So ultimately, if your goal is different to someone else's, you'd probably say what you choose is better than what they chose. At work, debates between "senior" people usually aren't about "what you did is not good/correct", but usually it would be "that's not how I would have done it".
p/s: yes I still work on HQ, but nothing to show yet (sigh)
Posts: 6
Threads: 0
Joined: Jun 2015
Okay, I didn't thought we'll go to "war" and I don't want to continue it. So yea, I would like to agree with Azriel:
(06-21-2015, 03:14 AM)Azriel Wrote: Short version is, each programming language is suited for some goals more than others. C#/Java are easier to debug when things go wrong. C++ gives you more control and performance, but has far more difficult concepts and obscure error messages.
I didn't mean that A-man(or anybody else here) should change his mind and suddenly swap to c#, but I just wanted to tell about features that c# supports natively(not with 3-rd party libraries or self-implemented versions). Ofc, there are many great libs out there and it's totally fine to use them, but I'm more into the idea of having all in one place :p
So, this is my opinion and next will be clarification of Someone else's post.
(06-20-2015, 11:24 PM)Someone else Wrote: (06-20-2015, 05:34 AM)Dia6lo Wrote: 2. Resharper (crazy stuff) I have no experience with this, so I cannot comment on the usefulness of it, but from what I can tell it is also available for C++. Yep, but it was released a couple of month ago, while classic Resharper's age is about 10 years. That's why classic has more features and it's more stable right now. Btw, if you are a student, you should totally try any of them
(06-20-2015, 11:24 PM)Someone else Wrote: Also the example on this article uses properties for letting you access the time as both seconds and hours. If something like this was a part of C++, that is not a case where I would use it. I don't think that it's a good practical use of properties either, but it's just an example that shows how properties work.
(06-20-2015, 11:24 PM)Someone else Wrote: (06-20-2015, 05:34 AM)Dia6lo Wrote: 9. Readonly fields (not const) Unless I am missing something about how readonly works in C#, is basically the same way const works in C++: Yep, it's kind of my bad here. In C# they divided two functions of C++ const into two modifiers. As msdn states:
Code: The readonly keyword is different from the const keyword. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor. Therefore, readonly fields can have different values depending on the constructor used. Also, while a const field is a compile-time constant, the readonly field can be used for runtime constants as in the following example:
CSHARP-Code:
public static readonly uint timeStamp = (uint)DateTime.Now.Ticks;
|
Thanks given by:
Posts: 114
Threads: 13
Joined: Oct 2012
What I wanted to say was people should stop wasting enormous time trying to write C++. There no need for that. It's like starting math with advanced calculus...
This guy deserves a cookie:
Want to be a game developer?
Ultimately, my constant dissatisfaction with the way things are becomes the driving force behind everything I do.
LF2 IDE - Advanced visual data changer featuring instant data loader
LF2 Sprite Sheet Generator - Template based sprite sheet generator based on Gad's method
There is no perfect language, but C++ is the worst.
Posts: 69
Threads: 2
Joined: Oct 2014
Well, it's personal choise and also great experience using [blabla] langauge, create own data parser or whatever.
It's just the same as when people making new tiny OS just for fun. They're getting a lot of experience with programming. Worth it anyway. Knowledge is true power o/
Thanks given by:
Posts: 1,556
Threads: 77
Joined: May 2011
(06-21-2015, 01:50 PM)Nightmarex1337 Wrote: What I wanted to say was people should stop wasting enormous time trying to write C++. There no need for that. It's like starting math with advanced calculus...
This guy deserves a cookie:
Want to be a game developer? If you're trying to get far with Mathematics, then you'll eventually have to learn advanced calculus. What the author of the article is getting at is: going with C++ as a first choice is a bad idea (which I don't believe to be always true). Might be, but C++ is still a great language that is worth picking.
The thing about C++ code always being much verbose isn't always true either. In fact, it's the other way around; C++ code can be much shorter, but that is what has given C++ the reputation of being too abstract.
Thanks given by:
Posts: 114
Threads: 13
Joined: Oct 2012
06-22-2015, 06:39 PM
(This post was last modified: 06-22-2015, 09:12 PM by NightmareX1337.
Edit Reason: eas of use
)
A LF2-like engine does not require every bit of performance a PC offers... Seriously, LF2 runs at 30 fps (AFAIK)... I remember the time I tried to compile OGRE library and all I wanted to do was getting starting a little... .::Epic Fail::. I've got used to the way C#/Java libraries work out of the box so much that I couldn't fall back to C++... Also, I remember the day I managed to get a plugin based LF2.IDE easily: just made form controls public so they are reachable outside of the executable and then used reflection to handle the rest (thanks to cs-script library)...
(06-19-2015, 06:29 PM)Someone else Wrote: (06-19-2015, 04:10 AM)Nightmarex1337 Wrote: First, why on earth people think writing a game using C++ is a good idea?!!It's horrible, verbose, disgusting, error prone and unproductive meanwhile C#, Java and derivatives are exact opposite and there are a lot of sophisticated and flexible libraries out there that makes your life so easy that you can finish the same project like 5 times faster and I'm %100 sure you would get a better result. Oh really? One major reason why you would want to use C++ is CPU caches (here here and here), as you have much more control on how data is layed out in memory.
Granted for a 2D game this is (like you stated later) less of an issue.
It is NOT horrible nor is it verbose, disgusting, error prone or unproductive, nor are C# and Java somehow exactly the opposite. If you this is the case at least provide examples of why you think so.
Java:
JAVA-Code:
MyClass myObject = new MyClass(42,23);//notice MyClass is written twice
|
C++ version:
C++-Code:
MyClass myObject{42,23};//notice MyClass is written once
|
When it comes to C++ there are (just like you stated for Java and C#) "a lot of sophisticated and flexible libraries out there", granted the standard library is smaller than that of C# and Java.
I do not see how using a different language would magically be five times faster. I'm not optimistic about someone would use C++ because of CPU caches.
C++ is unproductive and error prone. C#/Java is exact opposite. That is my (and a lot other people's) constant experience. I can't imagine myself writing LF2.IDE in C++.
Well... C#/Java encourages verbosity in different places than in C++, C# and Java have verbose libraries and function names are almost never shortened but it results with highly readable code. C++ forces you to have header and an implementation file and you end up writing things like:
C++-Code:
MyClass::MyFunction() { /* Some verbose code :D */ }
|
So, meaningless verbosity is meaningless, C++ does exactly that. And, I hate writing strncmp, strrcpy, strcpy, c_str... Do I have to know which means what?..
C#/Java's auto-complete is far far better than C++ ones, believe me I press less buttons while coding C# than coding C++. When a feature is available for both, look at how qualified is that.
Now, because of the language features of high level languages, sophisticated libraries can be desinged in an even more sophisticated way that using them become a breeze (user defined attributes+reflection+syntatic sugars+properties+built-in sync+...).
Okay, let's go verbose
http://simpleprogrammer.com/2012/12/01/w...-not-back/
http://www.fairyengine.com/articles/cppvscsharp.htm
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Another drawback is that it is extremely difficult to implement an AI system in C++ while you can simply use reflection in C#/Java and let other people to code AI in the same language (which is probably much better than the one you created). I doubt that it is "extremely difficult to implement an AI system in C++", so please give examples. That said reflection is a feature that C++ is lacking (there is a study group for it though). I would add that one reason for having AI work using a different language, is that you would be able to change the AI without having to modify the source code. What I actually meant saying 'extremely difficult' is it's so easy to do it in C#/Java that it's feels like super hard in C++ compared to those.
I don't understand why would someone needs to modify the source to make AI work with the same language?
Also, if C++'s binary format is not certainly defined and all compilers are incompatible with each other, how can you achieve a compatible reflection?
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Don't argue saying C++ is faster because a LF2 like game does not require such high optimization, remember you're not an AAA-Studio you're A-Man. Also keep in mind that most of the Android games are Java. A game like LF2 may not require nearly the same level of optimization, but it is really easy to paint yourself into a corner with poorly performing code (goes for C++ as well). That said I agree that it is probably not a big deal here.
A lot of Android games using Java is an appeal to majority. Ummm... OK.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Some people say garbage collection (GC) is a problem, it's NOT. Not only it will save you from manual memory management (MMM), a qualified GC can perform better if you're not a C++ pro. Even if you need to tweak GC, it's a magnitude easier than MMM. After all, "The Witcher 2" is an AAA-Game that uses GC effectively. I have been programming in C++ for many years, and I seriously do not think memory management is a problem. Use smart pointers (unique_ptr, shared_ptr, whatever you write yourself) for owned resources and the problem is mostly solved already.
Source on The Witcher 2? You may be programming in C++ for many years but I'm saying if a person is not that exprienced in C++ then he can easily mess up MMM, we both know cyclic references can not be freed via smart pointers and MMM code sometimes perform worse than GC as it does not allocate/deallocate memory all the time so people have to use resource pool for that. (I know it's an extreme case where GC performs better than MMM)
Source on 'The Witcher 2'
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: C# and Java have so great IDE's (Visual Studio, SharpDevelop, Eclipse, Netbeans) that you feel ultra comfortable while writing code and auto-complete makes you uber fast. (Should I even mention those useful profiler tools and incredibly nice standard libraries?) I am not sure that this was meant as an argument against C++, but yeah three out of four of the IDEs you mentioned also work for C++. There are of course also other C++ IDEs ( Code::Blocks, CodeLite).
Profilers are also available for C++, although (like previously mention) the standard library is somewhat lacking in comparison to that of C# and Java. It is being worked on (and there are non standard libraries available) but for the moment that is indeed a valid argument against C++. I used Visual Studio for both C++ and C#... Same IDE, nothing changes other than the language... Auto-completion was horrible and slow compared to C# and it takes enormous time to parse C++ libraries due to recursive inclusion and hard-to-parse syntax. I've never managed to make Code::Blocks to parse a whole library, it usually pop up saying "Still parsing" forever.
Debug and profile a C# application and a C++ application, you will fall in love with .Net.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Secondly, I don't understand what the hell is wrong with those who are trying to create their own data syntax/format while they can use existing ones (XML, JSON, YAML, Protobuf, BSON...). You're doing nothing but overloading your work to write a new parser library and it will probably not going to be as fast as existing libraries that parse existing data formats. Also, inventing a brand new unique data format results with need for a new data changer, while someone can simply use Notepad++ to change a XML/JSON based data and syntax highlighting, intellisense and auto-indentation will just work. No one actually needs a new data format, existing ones are sufficient. I would recommend Protobuf as it is really fast, takes low space, backward compatible and rock-solid, but it's a binary format, meaning that it's neither human readable nor editable, it needs a special data changer, but with the help of those great high level libraries, it's not a big challenge to provide that. This is not necessarily wrong, but I can come up with a good reason for this, namely it can be easier to read and write for humans, which is the same reason why programming languages don't use a markup language structure.
By a special data changer I imagine (correct me if I am wrong) that you mean a graphical interface with textfields and other controls as opposed to just an editor with a large textarea, where you write code, but in my experience such a program can easily be slower than simply writing everything in a texteditor.
Notepad++ would also be usable for any new format, that is stored in plain text. Making a syntax highlighter for a new language is not a problem in Notepad++. The main reason for using existing formats is that you don't have to write parser code but Doctor A stated that he likes reinventing the wheel.
Notepad++ is a Scintilla based text editor and AFAIK, Scintilla does not support unique syntaxes, in order to do that you need to write a new lexer library-plugin and I have no idea how that is done. (I wish I could support Doctor A's syntax but LF2.IDE is also ScintillaNet (.Net rewrite of Scintilla) based. I need to use IC#Code.TextEditor cuz it's easily extensible and welcomes unique sytaxes but a little lacking when it comes to performance.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: I must add that bytecode compiled languages are easy to do reverse engineering (so easy that you can extract most of the source code just using a simple program such as ILSpy). Thus, it's more likely that your game is going to be moded (and obviously we're trying to create an extensible game). I do not see how you could at all sell this as a feature. Honestly that is just dumb. You would achive the exact same effect by simply releasing the source code. What I'm saying is even if you obfuscate byte code, it's easier to do RE anyway so it's really more likely that a byte code game is going to be moded. I agree it feels stupid, I didn't notice while writing.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: If you don't like the idea of source theft, you can always obfuscate your code. But if it's not enough, and you still want your code to be compiled into native CPU instruction sets, then do yourself a favor and learn "D Programming Language". With the help of Eclipse + DDT plugin (and a compiler of course), anything is possible. Honestly source theft is not a thing I would worry about, no matter how easy it would be, so I will not argue against that.
I do not know much about D, but there is certainly some things I like (for example the ! syntax for templates is somewhat nice, and so is the static if stuff), but that is about it. D is nice in so many ways that I can't count but, it's still immature... I hope it will improve overtime and I'm willing to help in future.
(06-19-2015, 04:10 AM)Nightmarex1337 Wrote: Now, I'm shouting to all those who wants to make games, don't prefer C++ just because it's popular except you really really know what you're doing and consider other options before C++ cuz chances are high that you don't know what you're falling for. Notice that Unity (game engine) use C# as it's primary scripting language GC enabled. I guess I may as well then shout to everyone who wants to make anything: Do not just prefer C# and Java because they are easier than C++, because they are not. Try out the languages a bit and get a feel for the style you like to use, then pick a language that you like. Personally I find Java especially (and somewhat also C#) to be too lacking in core language features. "Do not just prefer C# and Java because they are easier than C++, because they are not" How can you say C#/Java is not easier???
Someone who has little exprience in different languages and the tools should not answer questions like "Which language to pick?"
Personally I find C++ (and also Java) to be lacking in a huge waste of features.
Ultimately, my constant dissatisfaction with the way things are becomes the driving force behind everything I do.
LF2 IDE - Advanced visual data changer featuring instant data loader
LF2 Sprite Sheet Generator - Template based sprite sheet generator based on Gad's method
There is no perfect language, but C++ is the worst.
Thanks given by:
Posts: 358
Threads: 47
Joined: Jun 2014
(06-22-2015, 06:39 PM)Nightmarex1337 Wrote: Notepad++ is a Scintilla based text editor and AFAIK, Scintilla does not support unique syntaxes, in order to do that you need to write a new lexer library-plugin and I have no idea how that is done.
Language -> Define your language...
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
The meaning of life is to give life a meaning.
Stop existing. Start living.
Thanks given by:
Posts: 1,556
Threads: 77
Joined: May 2011
(06-22-2015, 07:49 PM)MangaD Wrote: (06-22-2015, 06:39 PM)Nightmarex1337 Wrote: Notepad++ is a Scintilla based text editor and AFAIK, Scintilla does not support unique syntaxes, in order to do that you need to write a new lexer library-plugin and I have no idea how that is done.
Language -> Define your language... You mean "user defined languages"? That allows adding keywords and all, but limited syntax related options.
Thanks given by:
Posts: 1,556
Threads: 77
Joined: May 2011
06-27-2015, 09:41 PM
(This post was last modified: 06-27-2015, 09:42 PM by A-Man.)
I just remembered one important plus point for C++, and that is it looking really good on your resume :P.
Thanks given by:
|