Getting started on JPCT-AE

Started by S4milli4, March 04, 2011, 04:23:31 PM

Previous topic - Next topic

S4milli4

Hey there !

I've been looking around for some examples of code in order to get started on JPCT-AE but all i've managed to found was some terrible source codes (all code in the activity FTL !)... Is there any tutorial or codes (with a GOOD structure like MVC or at least an understandable one) that you guys could give to me so i can finally understand something to JPCT-AE ?!

Thx really much to the one that will bring me the light ! Srsly !!!

Kaiidyn

#1
I dont think you will be able to find them, as that will clutter the examples..
What you can do is make a new file with your class implements GLSurfaceView.Renderer..
And split different things up from there, use your imagination. :)

Also browsing the forums gave me good inspiration..
jPCT and jPCT-AE are not that different.. have a glance at the code on the wiki to get started..
If there is something specific you dont understand, check the forums (search function) and if you can't find it.. make a new topic with your question.. there are always people that will answer your questions..
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

EgonOlsen

I'm not sure if it's a smart idea to enter a community by calling the source code of the examples terrible. It took me some time to make up my mind if i should take this post offensive or not...i decided to try not to.
Most examples in the forum are based on the HelloWorld example from the wiki or some similar test case. They are not meant to serve as examples for brilliant software design (i'm not going to start an argument if MVC for Android games is always a brilliant idea or not...) but to show how to deal with a certain problem in the simplest form possible. IMHO, it's much simpler to put such examples into a single file that anybody can copy, read and compile in one step instead of spreading it out to a dozen classes and force people to think more about the taken design decisions than about the actual problem itself.
If you want to look at some more or less MVC based stuff done with jPCT (not -AE), you might want to look at the Robombs sources here: http://jpct.de/download/robombs_src.zip. As said, they are for desktop jPCT, not for the Android version, but both are pretty similar so they might still be helpful. Personally, i don't see the point why looking at more complex sources should be better for learning then studying simple one class examples but that's just me. I don't dare to point you to the Alien Runner sources, because i'm doing a lot of stuff in the Activity too and view and model became one in there...which, as we all know, is nothing but pure evil...well, i think i did not quite succeed in not taking it offensive...but i tried my very best. You are still welcome... ;)

icarusfactor

I plan on doing a code how-to with JPCT and Android.  But mine will be command line and Unix based(as that is all I have ) but should work on other platforms, again that is in my TODO list. currently I am busy working on my first app with JPCT right now , so a code review will be helpful to me as well as on the web. But not there yet.

I started out with the default code that comes with Android 2.x SDK
samples android-9 apidemos for OpenGL ES and also JPCT hello world AE
and hacked away until i could not find a resolution to a problem , then
came on the forum here and asked how to, so far have not been stopped
in my tracks  yet.

S4milli4

Well, i didn't mean to hurt you Oo... i was just saying that a clear code i much more understandable (at least in my opinion) and that when the while code is in the main activity that don't teach you much. A project is not harder to download or to import as a project so i still don't get your way of thinking because i tried to play with your "helloworld" and it turned out that actually there is no way to reshape it in a structured code (as there are some attributes dirty declared, etc). Here is why my post could have seemed a little frustrated because i have to evaluate quickly JPCT-AE (in terms of physics engine) in order to know if it suits to our project or not (either regarding the performances or the support). In the end i dont know how you do work but i really think that learning (or even teaching) the things right from the very beginning has always been the way to avoid bad habits. You're the main support, it means that if i start a project using JPCT-AE, i can only rely on you and i cant if i always have to doubt you.
No offense really, im just used to say what i think.
But anyway thx for the answers.

dectar

#5
I have to agree with kaiidyn on this one. I, for one, am glad that the examples are clear and to the point. Any MVC or multi-class structure would just detract from learning about the specifics of the jpct-ae library. It should not be hard to apply your imagination and coding experience to structure your application the way you want - its kind of assumed that if you realistically hope to write any application that you have the ability to at least do that much. Its not Egon's job to show you how to write java.

EgonOlsen

It's a clash of philosophies, i guess and further discussion is most likely pointless. HelloWorld uses in fact 5(!) jPCT related attributes (1 World, 1 Object3D, 1 Light, 1 FrameBuffer, 1 RGBColor). I don't get, why it should be hard to refactor that given that one is familiar with design patterns like MVC, i.e. an experienced coder... ??? Anyway, i couldn't say it any better than dectar did. And finally, the comment in HelloWorld says:

Quote
This shows more how to use jPCT-AE than it shows how to write a proper application for Android.

;D


xsynergy

#7
Quote from: EgonOlsen on March 04, 2011, 10:21:27 PM
I'm not sure if it's a smart idea to enter a community by calling the source code of the examples terrible. It took me some time to make up my mind if i should take this post offensive or not...i decided to try not to.

but you have to admit that most examples are actually snippets of code that are hard to read for someone who just enters the community. especially because they are really "quick and dirty" solutions. Besides this, from a software technical perspective jPCT-AE seems (for me) to be a quick and dirty solution anyway (please excuse me for beeing that honest).

Its too bad jPCT-AE is not open source, it's really good work you did up to now, considered that there are no other comparable free 3D engines for android out there right now. but it will change really quickly when google improves the android market payment possibilities (and it will happen, google already announced). wouldn't it be a good idea to re-release (at least) jPCT-AE based on some sort of an open source license and set up a developers environment. that wouldn't be much work for you and the development progress of jPCT-AE would increase really really fast. It's too sad to see such a good preliminary work is going to just become irrelevant to the android community in future. take a look at AndEngine, it's growing massively because of this, and it already kicked Cocos2D, that has been more popular (because of its capability to deploy to iphone and android).

EgonOlsen

#8
Quote from: xsynergy on March 13, 2011, 05:26:21 PM
but you have to admit that most examples are actually snippets of code that are hard to read for someone who just enters the community. especially because they are really "quick and dirty" solutions.
They are not quick and dirty, they are simple EXAMPLES. What's so wrong with that? The approach of writing this kind of examples served the community well so far IMHO. You'll always find somebody who thinks different...and this person is free to contribute other kinds of examples.

Quote from: xsynergy on March 13, 2011, 05:26:21 PM
Besides this, from a software technical perspective jPCT-AE seems (for me) to be a quick and dirty solution anyway (please excuse me for beeing that honest).
You don't have to like it nor do you have to use it. It's not quick and dirty. Granted, it's not packed with interfaces, packages and whatnot and it's pretty monolithic in design. But that's the way it's supposed to be and that's what works really well on Android.

Quote from: xsynergy on March 13, 2011, 05:26:21 PM
Its too bad jPCT-AE is not open source, it's really good work you did up to now, considered that there are no other comparable free 3D engines for android out there right now. but it will change really quickly when google improves the android market payment possibilities (and it will happen, google already announced). wouldn't it be a good idea to re-release (at least) jPCT-AE based on some sort of an open source license and set up a developers environment. that wouldn't be much work for you and the development progress of jPCT-AE would increase really really fast. It's too sad to see such a good preliminary work is going to just become irrelevant to the android community in future. take a look at AndEngine, it's growing massively because of this, and it already kicked Cocos2D, that has been more popular (because of its capability to deploy to iphone and android).
One of the main reasons, why it's not open source is exactly this kind of "oh it's crap, but i can make better by (choose one) (a) renaming some methods, (b) move some classes, (c) refactor (and break) some inner workings to improve (c1) performance or (c2) code beauty or (c3) my gut feeling"-kind of thinking. Just have a look at what happened to Android support for JMonkey...it's open source and popular and all...and the Android version isn't barely working, limited to OpenGL 2.0 devices, slow...and nobody seems to pick up to improve it. It's all a lot of talk but nothing happens. You can't compare 3D to 2D in this regard IMHO. A lot of people can contribute to a 2D engine...for 3D, it's much harder to find somebody who does.
I'm happy with the way the engine is now...and if it goes down the drain because the next big thing comes around the corner, then so be it. I can live with that.

xsynergy

#9
Quote from: EgonOlsen on March 13, 2011, 05:51:28 PM
Granted, it's not packed with interfaces, packages and whatnot and it's pretty monolithic in design. But that's the way it's supposed to be and that's what works really well on Android.
good software design does not mean to throw a bunch of interfaces inside the source nor does it mean to write anything that is monolithic in ANY way. short and quick: if the software someone writes using jPCT-AE is maintanable too hardly it is not going to be used in some major projects. it's that simple.

Quote from: EgonOlsen on March 13, 2011, 05:51:28 PM
One of the main reasons, why it's not open source is exactly this kind of "oh it's crap, but i can make better by (choose one) (a) renaming some methods, (b) move some classes, (c) refactor (and break) some inner workings to improve (c1) performance or (c2) code beauty or (c3) my gut feeling"-kind of thinking ...

no, i said its good work :-) see here:
Quote from: xsynergy on March 13, 2011, 05:26:21 PM
... it's really good work you did up to now ...


Just try to not take it personal, its software and nobody can write software perfectly, and i just have thrown up an idea on improving it. nothing more.

EgonOlsen

I wasn't refering directly to you with my OS-rant...it just comes up naturally when reading this "OS will make everything better"-stuff, because i've read it a dozen times and i simply don't think that it's true.