Forum

> > Stranded II > General > j(ava)Stranded, the O-O approach
Forums overviewStranded II overviewGeneral overviewLog in to reply

English j(ava)Stranded, the O-O approach

35 replies
Page
To the start Previous 1 2 Next To the start

old j(ava)Stranded, the O-O approach

Master_Aricitic
User Off Offline

Quote
While I have always, and will probably continue to always, hate it when people announce the start of some project only to drop it a few months later, it is official, I have started making a Java version of Stranded II. I call it jStranded.
I am using Java because the Object-Oriented approach to programming is 'superior' to the data oriented one (C++ over C) in that it becomes far easier to define multiple similar objects rather than redefining everything every time you make something new. So, in Stranded II each new 'type' of tree had to copy everything from the previous 'type' of tree; in jStranded if tree (a) and tree (b) have everything in common except for the graphical model, all that needs to be defined is the model itself.
Once I get to the point of having a usable world, something close enough to the original Stranded II, I will also create an XML format that will allow people to easily extend or override 'hard coded' objects. I will use XML because it is already clearly defined, and it is fairly easy to use:
<object><name>Tree</name><model>some location</model> (etc.) </object>
I am using jMonkeyEngine3 as the game engine, an engine that is currently in development, and open source. This is the first time I've used something like this, much less the engine itself, so I have to learn it... The majority of the time that I'll be putting into this will be just figuring out the engine, while putting in the pieces from Stranded II in will be much shorter.
I hope to put everything from Stranded II (original), and from MassiveMod into jStranded. Things will not necessarily be exactly the same as the originals, but will hopefully be at least as good as... Then I will begin adding my own concepts.
As I progress I hope to update this post, and once I'm satisfied that it is playable I'll post a compressed copy of the *.jar file.
While I do not wish to sound arrogant, but for the most part I probably won't need help coding this program. However I will probably periodically ask for help or assistance on something. An example of that which I can give right now is this: the models used by Stranded II are Blitz3D (*.b3d) and the models usable by jMonkeyEngine are (*.obj) and Ogre mesh.xml (*.mesh.xml). I have looked for a way of converting from a to b (*.b3d to *.mesh.xml) but have yet to find a one step method.
More >

Any questions or comments are welcome, and I will try to answer them as quickly as I can.

EDIT (2/24/11): So, I've been using jMonkeyEngine as the game engine thus far, but recently I realized that instead of using my Christmas money (and some that I had since before) to upgrade my computer parts, I could actually buy a 'professional' game creation program. I've looked up ones online but it's rare to see Java game engines, let alone 'professional' and 'for profit' ones.
So, does anyone know of any?
END (2/24/11);

Also, NOTE: I will modify this post in preference to making new ones when possible. If necessary I will reply directly rather than editing here, but in the case of new information I will make a link here to that post.
edited 1×, last 24.02.11 03:11:32 pm

old Re: j(ava)Stranded, the O-O approach

Master_Aricitic
User Off Offline

Quote
UnIdEnTiFiEd has written
i can convert .b3d files to .obj if you like, i have the correct programs to make .obj too


Edit: I am, currently, operating on (going by) the engine's limitations, not my personal preference.

I would appreciate that, though I do need to mention that the reason I am hesitant to use .obj files is because, in so far as I know, they don't keep the animations or materials (or bones). I do know that jMonkeyEngine will not register the materials on an .obj file, so I'll have to add them manually.

Certainly, if you know that I am wrong about the animations part, I'd love it if you'd convert them. This has been the biggest problem for me, as I could find some form of satisfactory information on all the other problems I've had... but I simply can't get the models...

I would prefer them in .model.xml format, but anything that I can use to simply represent the objects visually would be a blessing.

Thank you for the offer.

old Re: j(ava)Stranded, the O-O approach

bezmolvie
User Off Offline

Quote
Heh. I started loosly learning Java a few weeks prior, and this is a very intriguing proposition. I'd rather mod in Java than XML, as it would help my learning. I do have a couple questions: Will this be open-sourced? If not, will it become open-sourced after the drop of development? And, have you or will you ask permission if using anything created by DC (Models, ported code snippets, fonts, bitmaps, etc.)?

Micro-Edit: Ah, the intelligence center of US.de that the Stranded II forums are. Reminds me of the olden days...

old re: Bloodshot

Master_Aricitic
User Off Offline

Quote
Bloodshot has written
Heh. I started loosly learning Java a few weeks prior, and this is a very intriguing proposition. I'd rather mod in Java than XML, as it would help my learning. I do have a couple questions: Will this be open-sourced? If not, will it become open-sourced after the drop of development? And, have you or will you ask permission if using anything created by DC (Models, ported code snippets, fonts, bitmaps, etc.)?

Micro-Edit: Ah, the intelligence center of US.de that the Stranded II forums are. Reminds me of the olden days...


Yes, I have already asked DC if I can do this, though since he already provided us the source for Stranded II, he basically gave an open invitation. I have also asked Builder (of MassiveMod) if I could implement his things.
Next, I could make it open source, but as I am doing it for my own education and entertainment I need to keep my hands/mind around the source. Basically, it isn't closed source, but I am neither anywhere near done, nor do I want 'all the answers...' If you'd like to learn Java with me, and are willing to document what you do, I would certainly be willing to work along side you. However, I won't hand out what I've written (thus far) and say, "Have at it."
Basically, if you'd like to help me in the creation, and are willing to follow some simple, basic rules/guidelines (best practices really), I'll gladly export it to a .zip and send it to you.
The reason I will be doing the modding language in XML is because it will be the easiest for non-programmers to follow. Once I get to that point it will also probably be mod-able in Java because I'll be creating classes that read files to get the information to create new classes...

If you want to work with me on this project we should set up contact via email.

old re: UnIdEnTiFiEd

Master_Aricitic
User Off Offline

Quote
UnIdEnTiFiEd has written
the models are not animated like you said, but i can probably convert the items and objects though, it will take lots of time seeing im working on a project

I am curious what you are using to convert them, are you importing/exporting them, or are you using a program that allows you to simply select all of them and just process through the list? Biturn allows you to select all of them and convert from a number of formats to another number of formats.
I neither can, nor will ask you to manually convert all of them, or even all of the objects, as I could do the same and get them to the exact, so-called 'best' format for jMonkeyEngine.
What I may ultimately end up doing is finding an open-source program that 'imports' *.b3d, copy the method, and copy the export python script from Blender, then make a Java program that will do it for me... The problem is finding the open-source for importing *.b3d...

old Re: j(ava)Stranded, the O-O approach

bezmolvie
User Off Offline

Quote
I didn't mean to make it seem like I was proposing to help (I have not near the skills to do that), but for the modding, which I assume to be nearer to the rather 'controlled' type that the current Stranded II has; one 'away' from the source. However, I suppose you need a DSSL to accomplish that, which completely defeats the purpose. I just thought it might help learning to see something not too complex in development, but not to put any responsibility on yourself. Please don't let my rather trivial educational motives change your plans.

old re: Bloodshot

Master_Aricitic
User Off Offline

Quote
Bloodshot has written
I didn't mean to make it seem like I was proposing to help (I have not near the skills to do that), but for the modding, which I assume to be nearer to the rather 'controlled' type that the current Stranded II has; one 'away' from the source. However, I suppose you need a DSSL to accomplish that, which completely defeats the purpose. I just thought it might help learning to see something not too complex in development, but not to put any responsibility on yourself. Please don't let my rather trivial educational motives change your plans.

The modding, as I see it, will be done away from the source itself, but, with Java, that doesn't mean it can't be part of the source. Unless you have a specific program or *.jar, any Java program, as a *.jar, can be opened like a *.zip file and viewed and extracted... I neither have the money for the program, nor the convenient friend who has the program, to create a protected *.jar.
But, even beyond that, Java is/can be compiled on the spot within the virtual machine, so if you have a *.jar, and some *.java files, you can compile the *.java files into the *.jar file (as is how eclipse creates *.jar, but in a separate file). In this way I intend to also allow direct modification.
With regards to your skill, I'm making this up as I go along... I have ~one year's classroom experience, i.e. two college semesters, and utterly no experience with jMonkeyEngine, so, really, beyond the way my mind thinks (it often does in terms of programming), I have no literal or practical experience.
At this point I'm not at a stage where anyone but me, or even me, can understand the code... at least not without a lot of explanation.

old Re: j(ava)Stranded, the O-O approach

Master_Aricitic
User Off Offline

Quote
UnIdEnTiFiEd has written
fragmotion opens .b3d and exports to .obj but unless you buy it, it has these extremely annoying smilies everywhere

>Bows deeply in gracious admeration< Oh, wise one, I should have listened directly to you in the first place. I have attempted to use a number of programs that import and exports the files I need, but they all made me do it manually... Fragmotion has a 'batch' convert. I was, or would have been able to get them all done in one go-if I hand't tried to clean out the same directory at the same time...
Again, thank you!

old re: Bloodshot

Master_Aricitic
User Off Offline

Quote
Bloodshot has written
Heh. Will this be compatible with the old map files?

I have no idea... Right now I'm focusing on trying to get everything set up in such a way as there are generic classes; then I'll write a file parser to read through the current script files and create their equivalent objects for jStranded. If I can figure out how the map files are saved-what their saved information looks like-I could also write a parser for them.

Anything is possible, I just have to get to that point... and figuring out how to code the equivalent O-O friendly versions of everything is slowing me down.

UPDATE: I've modified the structure of visible objects in the game. JObservable is now the most basic form, followed by JItem, JMineral, and JLife. Each has a sub-interface that extends it further. I am doing it this way so that I can have things originate as generic as possible and add only a small bit of functionality each extension, this is so that making new things will be much simpler.
edited 1×, last 18.01.11 04:05:03 pm

old re: Bloodshot

Master_Aricitic
User Off Offline

Quote
I recently discovered that I have a tendency to try and 'code perfect,' which has gotten me in trouble in class on numerous occasions... and is stunting my progress. The problem is this: I try and figure out what problems may occur in the future and code in preparation for them, including any new information I have learned about what ever source I am using... (i.e. JMonkeyEngine, or Java), this tends to mean that I create 'untested' source code, and rewrite everything effected when I learn something new (or at least the single parts that need to reflect the new information). Basically, I reinvent my wheel each time I learn something new about 'wheels' in general, or I try to add the ability to move up irregular surfaces before I can even move along roads...
NOW, I am trying to relearn my practice and JUST WRITE SOMETHING THAT WORKS!!! so I can actually give everything something to test and try...
In other words, before I was trying to create a moddable system for Animals, Items, etc. before I even had a working world to put them into... /head smack; now, I am trying to get a working world, and THEN add 'working' things to that...
Once I have animals and plants displayed I'll post something you all can try. (That will be after I have a base world to put them in...)

old Re: j(ava)Stranded, the O-O approach

palomino
User Off Offline

Quote
Master_Aricitic has written
So, in Stranded II each new 'type' of tree had to copy everything from the previous 'type' of tree; in jStranded if tree (a) and tree (b) have everything in common except for the graphical model, all that needs to be defined is the model itself.

You mean like Classes in Python?

old re: Master_Arictic

bezmolvie
User Off Offline

Quote
I have realized I do similar things, and build the building going from the bottom to the top in small chunks instead of building a short version of the building and work from the bound up.

old re: Sunny Autumn

Master_Aricitic
User Off Offline

Quote
I assume that Classes in Python are the same or very similar to classes in Java and C++. If this is true, then the answer is yes.
I hope to set up the program such that making mods will have the ease of Object-Oriented programming, with the ease of scripting. Using Object-Orientated programming ideology what ever classes I write to make the game moddable will essentially discover what class the modder is trying to change and create an extension of that class. Because I am trying to write the program from the beginning with modding in mind, hopefully it will make writing the classes for the actual in game objects much easier. Ideally I will have a Factory class that actually will take the files written for Stranded II and convert them into Java classes, or the XML format I will use for 'easy' modding. (Anyone who has done any web design has essentially done XML as XML and HTML use <tag> </tag> to identify things; XML just lets you define the tags, while HTML has them predefined.)

old Re: j(ava)Stranded, the O-O approach

palomino
User Off Offline

Quote
Master_Aricitic has written
I assume that Classes in Python are the same or very similar to classes in Java and C++. If this is true, then the answer is yes.

I think that yes, those are pretty much the same things.
I don't think I will ever use classes though. Despite the ease of the code WITH them, I am very (and I mean very) inattentive, and I will screw up. So I will do better WITHOUT them.

old re: Sunny Autumn

Master_Aricitic
User Off Offline

Quote
Sunny Autumn has written
I think that yes, those are pretty much the same things.
I don't think I will ever use classes though. Despite the ease of the code WITH them, I am very (and I mean very) inattentive, and I will screw up. So I will do better WITHOUT them.

I checked shortly after writing that (or during) and found that python is object-oriented and extensible, so it is similar to Java.
There will be two ways to mod my version: using the original scripting language, and using XML. The original scripting language will have one simple change: Extends <ID>, which will copy the code from what ever the ID is, or Extends <Name>, which does the same thing but uses the 'name' rather than the ID.
For XML it will be similar but in XML which will make identifying what you are changing easier.

Also, re: bloodshot
So, JMonkeyEngine basically keeps everything 'you' program in 'one class' that extends 'SimpleApplication.' I don't like this, I hate and despise it, as it is bad programming, so I've been trying to separate my code into multiple classes. This chore has been proving difficult. Finally, I've decided to write it in one class, but separated by /* <--Begin Some-Such--> */ so that I can extract the pieces into separate classes one by one and be sure it works. Hopefully this will allow me to get something testable for myself to add more testable things to, so I can actually get somewhere... /cry /whine
To the start Previous 1 2 Next To the start
Log in to replyGeneral overviewStranded II overviewForums overview