UFO:Alien Invasion

Development => Coding => Topic started by: Mattn on December 22, 2009, 07:48:52 pm

Title: Requesting help from Java programmer
Post by: Mattn on December 22, 2009, 07:48:52 pm
Hi,

if you are a java programmer and want to contribute to our little nice project - now you have the chance. We could really need an eclipse plugin that is able to read our UFO-scripts. The first step would be an outline, that would already help a lot to navigate in the scripts. The next step would be syntax error checks. The last big step would be searching for references or completion help.

If you are interested in helping out with writing an eclipse editor plugin, please let me know.
Title: Re: Requesting help from Java programmer
Post by: Mattn on December 22, 2009, 08:11:36 pm
Might be interesting:

http://www.eclipse.org/Xtext/documentation/0_7_2/xtext.pdf
http://www.eclipse.org/Xtext/documentation/0_7_2/xtext.html
Title: Re: Requesting help from Java programmer
Post by: Destructavator on December 23, 2009, 06:46:45 am
I've written in Java before - I took a class for it a while back, and used a freeware IDE called JCreator - but it was a couple years ago since I've touched it.  I've got other things to work on at the moment though, so you might be able to consider me a backup if no one else is available for the job.

I'm honestly not familiar with what eclipse is or much about it, I'll have to Google it later at some point...

Ah! It's an open-source IDE - Sometime soon I'll download a copy and compare it with C::B.
Title: Re: Requesting help from Java programmer
Post by: bayo on December 23, 2009, 08:36:48 pm
One problem is "our UFO-scripts" have not a real syntax consistency. Common code for script only provide a low level of lexer, but each part of the code use the syntax it want. Then, for the syntax coloring, i think it need to implement something very generic (something we can update if it is need). Anyway, even a low level of coloring will be very usefull.
Title: Re: Requesting help from Java programmer
Post by: Ain Soph Aur on December 23, 2009, 11:15:05 pm
i am programming in java and working with eclipse right now. so maybe i could help. but one thing is that i never wrote a plugin for eclipse, so i absolutely dont know how to do that at this time and the second thing is, i am studying right now and my tests will come at the end of january.

so i could maybe look into that but not before the tests are over... if you can wait that long, i could look into that
Title: Re: Requesting help from Java programmer
Post by: Duke on December 23, 2009, 11:29:32 pm
@Ain Soph Aur:
I think that's a mid-range task anyway. At least 'not before 2.3' (TM).

@bayo:
Good point. Maybe it's time to consolidate the script syntax, making the plugin code easier and the usage of the scripts easier/more consistent ? From my perception only few (if any) users change the scripts, so it's a devteam thing only ?
Title: Re: Requesting help from Java programmer
Post by: Mattn on December 24, 2009, 09:41:02 am
indeed, what i want is a plugin that handles "the new syntax" (at least for the menu) and creates a warning if it doesn't match. If this is the case we can fix things a lot faster and easier. i've already started to write such a plugin, but it does not do a lot but just adding an ufo icon to ufo script files.
Title: Re: Requesting help from Java programmer
Post by: RudolfoWood on December 28, 2009, 10:00:13 am
In my study time I've seen a presentation of some eclipse plugin/project which was used to generate editor, syntax highlighting and outline just from defining the language that should be used.
I'll try to find out which project this was and how to use. Perhaps it is very easy to use this.
Title: Re: Requesting help from Java programmer
Post by: RudolfoWood on December 28, 2009, 10:24:17 am
http://www.emftext.org/index.php?title=EMFText
completely developed at my university (at the chair where I wrote my diploma and where a friend of mine still works)

it is a competitor to xtext, don't know which is easier to use.
I'l try to play around with it, should be easy to use it (and the plugins will be standalone so no need to add something to eclipse besides the plugins generated there).

[Edit] I played around a bit and defined the syntax for two parts of ufo code: messagecategory and messageoptions. Attached are the plugins (requires java 1.5) for eclipse that do outline and (basic) syntax coloring. In Eclipse settings some highlighting settings can be changed, this could also be done directly in syntax file, did not play with that. File name must have extension "ufogui" to be recognized, don't know why it ignores "ufo" as extension, but this is something which probably could be fixed with some investigation. Icon for ufo files uses a default ecore icon, could also be changed probably.
Putting this together was work for some hours, I did not use that EMFText before. I don't know why it ignores the "there must be a linebreak" setting in my syntax.
Code assist is working for msgoptions -> there it helps you to add either a new optionname or pause|sound|notify if optionname is specified.
Title: Re: Requesting help from Java programmer
Post by: Mattn on December 28, 2009, 02:43:54 pm
how can i install these plugins? just add them to the dropins?
Title: Re: Requesting help from Java programmer
Post by: RudolfoWood on December 28, 2009, 03:09:46 pm
for installing: these plugins must be located next to other plugins (should be inside plugins subdirectory from eclipse)

Here a quick step by step what I did:
http://www.emftext.org/index.php/EMFText_Installation_Screencast
- Install EMFText from http://reuseware.org/update updatesite

http://reuseware.org/screencasts/screencast-EMFTextEdit-simple-gui.htm
- create a new java project
- create a model subdirectory
- create an ecore model
- Create classes that represent different objects, link appropriate
-- container attributes (e.g. list of content) must set the correct boolean
- Create a genmodel for ecore model
- declare default package for code generation
- generate model code (from genmodel context menu)
- create a cs file for syntax
- fill in some syntax rules, keywords in "", content fields...

- the tricky part (I did not figure out what the next step was for some time as the wink source is somehow broken in the end):
on the cs file generate text resource (from context menu), this will create a second plugin project next to the one

- create a new launch configuration (new eclipse) which uses the newly created plugins.
- create a file with appropriate extension, be glad to see syntax highlighting and content assist

another example with audio, perhaps easier to understand:
http://www.emftext.org/index.php/EMFText_Getting_Started_Screencast

some things I noticed:
- if you change the underlying model, you have to generate the model and ressource code new, clean out the old (java) files before, otherwise there could be compile errors (e.g. for renamed/missing classes)
- root node of genmodel supports "reload model", so no need to throw away the genmodel file if you changed the ecore file.

my syntax and ecore model is in ufo_gui.jar/model, jar can be renamed to zip to extract.
I tried to move the definitions into a subpackages, so different script parts may be defined in different syntax files, these may be imported into one file for all (so that we have one editor supporting all ufo files)
Title: Re: Requesting help from Java programmer
Post by: RudolfoWood on December 30, 2009, 11:37:30 am
for completeness I also looked into Xtext (without playing through an example, only reading through http://www.eclipse.org/Xtext/documentation/latest/xtext.html#getting-started )

XText takes an almost similar approach, but uses own definition files.
you have to create a xtext file which defines the syntax and model (imo mixing the (data) model and the concrete text syntax)
the easier part: to generate the plugins you only have to start one action "run as WME Workflow" which does all (opposite to generate model, generate text ressource)

I did not find hints how to change the highlighting/syntax coloring.
I found, that internally they also use the ecore model somewhere.

Imo ecore models can also be edited with emf visual editor, but I did not try it yet.
Title: Re: Requesting help from Java programmer
Post by: RudolfoWood on January 08, 2010, 10:01:00 pm
I will meet the EMFText developers next thursday to get some help with my desired model plans, hopefully get some answers that help me to fix some of my current problems with it. If so, I'll prepare a commit for these.
Title: Re: Requesting help from Java programmer
Post by: wishper on February 15, 2010, 10:45:45 am
Hi to everyone! This is my first post here :)

Now I'll tell you a funny story:
I really enjoyed this game (I completed the 2.2.1 version about a week ago, and now trying the 2.3...). I looked at the changelog in the home page and noticed that the coding activity is really strong around this project, and was really amused of that. Then I came in this forum to see how the things were going (and to see if someone had a working binary to let me try 2.3 (there are not on the home site...).

Today, I asked myself a question: could I contribute to this marvelous project? I guessed I could not,since I'm not a C++ programmer (I'm a java one). Then I came in this forum: a sticky note calling for java programmers! I couldn't believe, requiring eclipse pluginning :) (my current work, though I'm not an expert...).....

A suggestion: from my knowledge, xText looks far better, but if you can get expertize from EMF better to get that one...

Now a question: assume I don't know anything about UFO:AI, beside having played standard campaign in 2.2.1. What are you looking for?  I think it is something related to scripting. Where can I know more? In the wiki?

thanks.
Title: Re: Requesting help from Java programmer
Post by: wishper on February 15, 2010, 12:55:51 pm
Never mind, I found everything in the wiki  ;D
Now I could start experimenting. I actually have atm very few spare time, but if I make progress I'll post them here. A question: since the semantics look like very different from script to script, I think that a dedicated editor is a better choice.

Is there an order of preference (I guess so) for the editors to be written?
Title: Re: Requesting help from Java programmer
Post by: Mattn on February 15, 2010, 02:59:20 pm
hi - and welcome ;)

menu scripts have the highest priority at the moment.
Title: Re: Requesting help from Java programmer
Post by: RudolfoWood on April 10, 2010, 09:48:03 am
I have to say that I started working on EMFText plugins since my last post here, but did not put anything into svn yet. I really should do that as I have syntax for many of the most-needed scripts (e.g. research, item) ready, currently working on the most-wanted gui part (which is imo the most difficult one).
Title: Re: Requesting help from Java programmer
Post by: Mattn on April 10, 2010, 09:53:52 am
if you add this to the svn - please also add an article to the wiki how to install and use it. thanks a lot for the work you put into this. i think that will really help us to clean things up and find hidden bugs.
Title: Re: Requesting help from Java programmer
Post by: Marte on April 27, 2010, 11:51:28 am
hi!
i'm new Java coder , could i help with this project?
Title: Re: Requesting help from Java programmer
Post by: bayo on April 27, 2010, 12:33:11 pm
If you know a == b is not the same as a.equals(b), maybe you can help  ;D
Title: Re: Requesting help from Java programmer
Post by: MCR on April 27, 2010, 12:37:00 pm
/joke
It can take some time until you get an 'real' answer here...  ;)
/joke off

I saw RudolfoWood was active here some 10 days ago the last time & I know mattn has quite some coding stress @ the moment, so I would suggest that you simply check out & learn everything referenced to in this thread, so you can start fully prepared & know about problems & stuff.
I suggest looking into the wiki also as it is always good to know how this whole stuff works, even those parts you do not want to touch or which are not related to Java directly... ;)
Title: Re: Requesting help from Java programmer
Post by: Marte on April 27, 2010, 03:07:37 pm
hi again!
wiki are really a big source of information, in particular this topic http://ufoai.ninex.info/wiki/index.php/UFO-Scripts/ui/*.ufo is up-to-date or old ? It's seems really important about menu/compiling topic :D
Title: Re: Requesting help from Java programmer
Post by: MCR on April 27, 2010, 03:14:27 pm
The wiki can be hard, I know that  ;)

But eventually you will find your information there in most of the cases... We are all trying to keep info there up-to-date, but with fast progression of things it is not always possible...

You should try this wiki pages instead:

http://ufoai.ninex.info/wiki/index.php/UFO-Scripts/ui/*.ufo

http://ufoai.ninex.info/wiki/index.php/UI_node_behaviours
Title: Re: Requesting help from Java programmer
Post by: Mattn on April 29, 2010, 05:11:04 pm
wiki should be up-to-date
Title: Re: Requesting help from Java programmer
Post by: Marte on April 29, 2010, 05:25:40 pm
hi again!
I've added a little page on wiki, here:

http://ufoai.ninex.info/wiki/index.php/Script_syntax_coloring (http://ufoai.ninex.info/wiki/index.php/Script_syntax_coloring)

where I explain syntax coloring with Notepad++, think could be useful from starting point for this project?

Title: Re: Requesting help from Java programmer
Post by: bayo on April 29, 2010, 08:55:22 pm
Not a lot of devs use Windows, i think. Anyway it can be very useful for some people. Thanks.
Title: Re: Requesting help from Java programmer
Post by: Marte on April 30, 2010, 08:04:52 am
You can use Notepad++ for linux using wine (read from Notepad++ forums)
Title: Re: Requesting help from Java programmer
Post by: BTAxis on April 30, 2010, 09:42:29 am
But why would you want to?
Title: Re: Requesting help from Java programmer
Post by: RudolfoWood on May 02, 2010, 02:40:43 pm
I know I did not put anything into svn yet. Most parts of what I actually did for the EMFText plugins needs little java knowledge - almost all code is generated.
I told mattn that I think it would not be worth working with that plugins before 2.3 as they would need adjustments in script names here and there. I even don't know whether it is worth to wait for EMFText developers to switch parser engine (I know they are working on it) to have less need for script adjustments.
Title: Re: Requesting help from Java programmer
Post by: Marte on May 04, 2010, 11:26:59 am
I know I did not put anything into svn yet. Most parts of what I actually did for the EMFText plugins needs little java knowledge - almost all code is generated.
I told mattn that I think it would not be worth working with that plugins before 2.3 as they would need adjustments in script names here and there. I even don't know whether it is worth to wait for EMFText developers to switch parser engine (I know they are working on it) to have less need for script adjustments.

sorry but i didn't understand why you don't commit your work ?
Title: Re: Requesting help from Java programmer
Post by: Kildor on May 04, 2010, 12:44:04 pm
Because we will merge to trunk big branch before 2.3 release, and to minimise work on this merging he will commit his big patch after.
Title: Re: Requesting help from Java programmer
Post by: Marte on May 04, 2010, 01:17:04 pm
Because we will merge to trunk big branch before 2.3 release, and to minimise work on this merging he will commit his big patch after.

ok!
Can pm when code will be available ? So I'll can help!
Title: Re: Requesting help from Java programmer
Post by: MCR on May 09, 2010, 11:57:36 am
Thanks for this notepad++ thingy... Very useful @ this state of development already  ;)
 8)
Title: Re: Requesting help from Java programmer
Post by: Marte on May 21, 2010, 11:44:29 am
you are welcome :D if i can help more, please pm me !
Title: Re: Requesting help from Java programmer
Post by: Mattn on May 24, 2010, 01:32:30 pm
first version of the md2 viewer is uploaded to the update site at http://mattn.ninex.info/eclipse - it does not yet work for all models
Title: Re: Requesting help from Java programmer
Post by: bayo on May 25, 2010, 08:26:02 am
very nice. BUt why do you use both "features" and "plugins"? i only use "plugins", what is the differernce?
Title: Re: Requesting help from Java programmer
Post by: Mattn on May 25, 2010, 05:48:53 pm
the feature was needed to export the metadata for an update site. we are also able to pack several ufoai related plugins into this feature group now.
Title: Re: Requesting help from Java programmer
Post by: bayo on May 25, 2010, 07:10:22 pm
will you create a site.xml and move it to ufoai.ninex.info site? It can became a very nice thing
Title: Re: Requesting help from Java programmer
Post by: Mattn on May 25, 2010, 07:28:48 pm
this http://mattn.ninex.info/eclipse  can already be used as an update site to install the plugin from within eclipse. what is the site.xml for?
Title: Re: Requesting help from Java programmer
Post by: Marte on June 17, 2010, 01:41:00 pm
How can I help now?
Title: Re: Requesting help from Java programmer
Post by: Mattn on June 17, 2010, 05:05:33 pm
help us writing eclipse plugins that will make the editing in the ufo world easier: see http://ufoai.ninex.info/wiki/index.php/User:Mattn/Eclipse
Title: Re: Requesting help from Java programmer
Post by: Marte on June 22, 2010, 02:07:12 pm
i need something more precise so I can start to help
Title: Re: Requesting help from Java programmer
Post by: bayo on June 22, 2010, 03:40:27 pm
About the UI script, i think:

1) implementing a way to allow UFONodeSubParser classes to provide content into the "Property page" of Eclipse
 * maybe something like registerProperty(name, type)
 * A property will be a name, a type, and a value
 * Update the property page when according to the cursor, according to the overview
 * ...
 * then we can improve preview/edition according to the property type

2) first step with a graphic editor/viewer
 1) Eclipse use a common way to display files (for example we can see XML files with text or with node tree).
 ** It should be very usefull to have the base code for that
 ** then we can display the text in one tab, and a text list and graphical box in the second one
 2) The second way is to implement MenuPreviewer (according to the cursor position, according to the overview...)

It can help me a lot. Cause i can help to display content, but i dont know how to do interactions between Eclipse pages.
Title: Re: Requesting help from Java programmer
Post by: bayo on June 26, 2010, 01:01:44 pm
If you want to learn/playwith model format and opengl, the model viewer code (md2viewer) need some fix. Only few models are well displayed.