Newbie programming question (AS3 draws to "stage" as C++ draws to "?")
Members - Reputation: 148
Posted 17 July 2013 - 08:19 PM
GDNet+ - Reputation: 3722
Posted 17 July 2013 - 08:32 PM
The Java standard library includes a Graphics2D object that allows you to render to GUI elements in one of its two GUI packages (the Abstract Windowing Toolkit (AWT) or Swing), but C++ has nothing like that. Most Java game developers eschew the built-in stuff for third party libraries. In C++, that's your only option. Libraries like SFML, SDL, and Allegro provide everything you need for cross-platform 2D rendering. Then there's a plethora of 3D engines to choose from. Or you could go more low-level with OpenGL and D3D, APIs which communicate directly with the graphics card and are what the other libraries are built on top of.
Members - Reputation: 148
Posted 17 July 2013 - 10:53 PM
So in order to get images on screen I would need to use a library like the ones you've listed that facilitate the process. I asked about this on another forum and realized that flash seems to be designed for visual purposes almost exclusively so naturally they provide a stage element for easy drawing. Thanks for the clarification.
I also hear that C++ is something you learn for a long time before you can get very good at it. Is Python a good pitstop along the way?
Crossbones+ - Reputation: 4506
Posted 17 July 2013 - 11:33 PM
There are ten kinds of people in this world: those who understand binary and those who don't.
Members - Reputation: 197
Posted 18 July 2013 - 01:13 AM
The two languages aren't really comparable in that way. AS3 is a high-level language, with very abstracted graphics drawing. If you're after a gentle transition from AS3 to something else, I'd suggest Java over C++ as its more similar (though, probably not quite as useful in the long run) and OpenGL. If you have an Android device, Java and OpenGL ES is a lot of fun to learn. I'd also suggest OpenGL ES2 over OpenGl 1.x as well, because its almost the same standard as WebGL and writing your own shaders is a useful life-skill. I'm sure what I just said is probably a lot to take in, but just do some research into the things I just mentioned and it might help you decide where to go next. I've been a Flash programmer for a couple of years and have been transitioning to other languages to make games and this was a comfortable road for me. Of course, if you're just trying to make a game as quickly as you can, Unity is a pretty neat engine with a lot in common with Flash.
Members - Reputation: 148
Posted 18 July 2013 - 02:52 AM
Thanks for the suggestions! I actually could understand what you said quite well (...probably). I've been slowly wrapping my head around flashes stage3D and its relation to the GPU pipeline so I think I have an idea of what you mean with shaders. Right now Im dealing with 2D games so its not so much a big deal performance wise. But ultimately I will want to do 3D programming. I'll stick with flash awhile longer until I know I need to upgrade for the extra processing power. I'll keep track of the progress of each languages libraries in the mean time.
Members - Reputation: 1869
Posted 18 July 2013 - 04:43 AM
If Java and OpenGL ES on an Android embedded device looks like a little too much of a learning curve for you from AS3 2D drawing, perhaps have a look at C++ and SDL. That way you can learn the C++ language in an easy manner without being bogged down unnecessarily with platforms and technology.
Then when you are ready for 3D, you can still use SDL but then also start looking at some examples of how to use it with OpenGL.
Remember, just because C++ allows you to do pretty technical stuff which is close to the hardware, it doesnt mean you have to. There are loads of libraries that are as high level and simple (or simpler) as those found in Java and AS3.
As an aside, I personally find OpenGL with C++ a lot easier than doing it with Java since Java's Garbage collection system doesn't really work with memory stored on the graphics card whereas C++'s RAII works great. Also converting java arrays into a format suitable for uploading to the graphics card is pretty awkward.
Edited by Karsten_, 18 July 2013 - 04:48 AM.
Crossbones+ - Reputation: 1558
Posted 18 July 2013 - 11:14 AM
a few random comments:
while syntactically, AS3 is closer to Java, in some areas its semantics and language features are actually a little closer to those in C#.
granted, others may disagree.
the Flash APIs are fairly specific to Flash though, and likewise some AS3 features don't map exactly to the other languages.
as for GC:
yes, for a lot of problem domains it kind of gets in the way, and getting good performance out of Java may involve some level of ugly and convoluted code.
also, while it tries to infer the lifetime of objects to release them early, this requires some care to utilize effectively (basically: don't store it anywhere outside of local variables or newly created temporary objects, otherwise it will become part of the global heap and typically wont be cleaned up until the next GC pass).
my vote is probably mostly for investing the effort in learning C++, though this may not be an ideal choice if one is intending mostly to target Android or a web-browser or similar (can be done, just there is a lot of "hair" in these areas...). for Android or for web-browsers, Java is a little better.
if going cross-platform (and developing traditional games or applications), C or C++ is probably preferable IMO.
personally... I mostly just use C... but this is mostly for personal reasons (often with a fair bit of custom tools and infrastructure, so isn't really raw C by itself for the most part, *1). otherwise, at this point, I would probably more likely go with C++.
*1: note: using C does not necessarily mean being limited to writing procedural-style code (what the language provides built-in is secondary to what can be done in the language, and actual development practices may diverge considerably from what many people seem to assume it implies, ...). all this has turned into big pointless arguments in the past, which is not my point here.
a personal dislike about Java is that vs the relative freedom of C and C++, it is can be fairly constraining.
granted, it can also be noted that this is one of the areas that makes it commonly viewed as making it easy to learn.
as far as relative programming freedom and expressiveness, I prefer C# a little more than Java, but its "general portability" is a little weak on many targets (vs Java or C or C++). it is pretty solid if it is reasonable that the code not really be highly portable (IOW: Windows and maybe traditional Linux distros, with 3rd party tools for other targets). some of its features can still be a little annoying to someone who is more used to C or C++ development though (as well as there being a few seemingly arbitrary language restrictions).
sadly though, there are no "perfect" languages...
mostly just relative tradeoffs...
Current Status / Downloads: http://cr88192.mooo.com:8080/wiki/index.php/BGB_Current_Status
YouTube Channel: http://www.youtube.com/user/BGBTech