Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Newbie programming question (AS3 draws to "stage" as C++ draws to "?")


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Genocode   Members   -  Reputation: 148

Like
0Likes
Like

Posted 17 July 2013 - 08:19 PM

Hello people. Um...I'm a bit new and have been learning programming in Flash Actionscript 3.0 for some time. I dont know too much about Java and C++ (...yet) but I've noticed that the overall structure of how code is put together in Java and C++ seems somewhat similar and I've been looking into expanding/graduating to C++ or Java in the future. I've noticed that flash comes with a stage element that pretty much provides a place to blit sprites and graphics on to. This is probably a stupid question but I wanted to know if there was something similar to that in Java or C++ or just generally any other language that doesn't come with a 'stage' element like flash does. If so, how would it be done?

Sponsor:

#2 Aldacron   GDNet+   -  Reputation: 3281

Like
3Likes
Like

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.



#3 Genocode   Members   -  Reputation: 148

Like
0Likes
Like

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?



#4 Khatharr   Crossbones+   -  Reputation: 3084

Like
0Likes
Like

Posted 17 July 2013 - 11:33 PM

If you want to learn C++ then start studying C++. It has some complex interactions, but it's not hard to learn the basics, and from there to begin the process of improving your skill. Python is not a bad language, but don't think that you should use Python as a stepping-stone for C++. It's like a screwdriver and a hammer. You don't have to learn one in order to qualify yourself for the other.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#5 Tchom   Members   -  Reputation: 193

Like
0Likes
Like

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.



#6 Genocode   Members   -  Reputation: 148

Like
0Likes
Like

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.



#7 Karsten_   Members   -  Reputation: 1655

Like
0Likes
Like

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.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#8 BGB   Crossbones+   -  Reputation: 1554

Like
1Likes
Like

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...



#9 Genocode   Members   -  Reputation: 148

Like
0Likes
Like

Posted 18 July 2013 - 02:11 PM

Thanks everyone. You've given me a well of information to think about moving forward. Much appreciated.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS