I’ve just done a round of fixes for the source-examples of ES’s. Github projects updated on this page:
- Added a complete Java implementation of the most basic ES example
- Fixed some minor bugs in the Objective-C basic ES example; added some missing classes
- Added a missing class method from the documentation (System.
6 replies on “Entity Systems: updates to source code”
Based on your Java implementation i created a “port” of some sort for scala
It seems that you are working on iOS and Android and that you have chosen to code your games in Obj-C and java. Because I’m planning to make a game on these two platforms, I’d like to know the reasons why you did not use C++ for both?
Thanks for this awesome framework !
I don’t generally do both platforms in a single project – normally another programmer will do the other platform. So I pick the language that works best for the platform I’m on.
For the example code, it’s VERY easy to write code that works well on one platform, but when ported you port stuff that wasn’t needed on the new platform. By sharing the ported versions, and commenting on them, I hope to make it easy for everyone to pick the “example for my personal favourite language”, and not have to worry about misunderstanding / mis-porting from another language.
Also, an extra issue:
Obj-C is many times worse than C++. But most people doing iOS development are using it, so it makes a good example to share with others. There’s a large number of people using C++ on iOS – but they tend to be the more experienced programmers who’d have no trouble reading and interpreting the Obj-C.
(NB: that’s the *only* reason for giving iOS examples in Obj-C: “because most iOS programmers know Obj-C, but only the minority know C++”)
Java is a pretty good language for writing games – on Android it’s both better and worse than C++. But an even larger percentage of Android devs use Java, because it works a *lot* better than Obj-C.
Thanks for your answer.
In fact, I am about to finish a little indie game on Android (unfortunately not based on ES but on Replica Island which has nice things too by the way!) written in java which is my favourite language. But thinking of porting it to iOS and rewrite all the code is scaring me a bit ! That is why I’m considering writing games in C++ to factorize developments. But that is maybe a “wrong good idea”!
Java to C++ port is – IMHO – a very time-consuming thing to do.
Basically: every improvement on C++ from the 10+ years between C++ v1 and Java v1 … you’re throwing away.
But you probably made use of them in your code, and in your code-design. So, now you’ll have to re-implement things in an inferior way to make them work properly in C++.
…of course, at the same time, you have the opportunity to re-implement other bits to take advantage of C++’s unique features. So you get to improve the end result.
But, added together, those two things (one required, one optional (but tempting!)), mean that any Java – to – C++ port is likely to take quite a long time.
Sorry, I think I did not make myself clear, unfortunately my english is not that good…
I won’t port the current version of the Android game to C++ but I’ll have to port the game to C++ (or/and Obj-C) to make it work on iOS platform. And I’m considering making my next game just in C++ in order to avoid porting (too much) code next times. But as you said, I’ll have too give up some java’s nice features!