Page 1 of 2 12 LastLast
Results 1 to 10 of 12

  Click here to go to the first Developer post in this thread.  

Thread: Java Tech Demo

  1. #1

    Java Tech Demo

    The Java crowd hasn't been getting much love recently, so I thought I would put together a simple "Java Tech Demo" to give people not familiar with Java an idea what will hopefully be in store for us down the road.

    I call this a tech demo because I cover too much ground and don't have time to fully explain everything. However, people should be able to follow along without too much difficulty. I was originally just going to write an article, but that quickly turned into a wall of text that most people would likely find hard to follow. So instead I've make a short (11 minutes) screencast.

    Acknowledgements
    I would like to thank the following people/organizations.
    1. BIS for giving me permission to put the jniscripting.jar on my Maven repository.
    2. [EVO] Dan for permission to use his Convoy Attack as the basis for this demo.
    3. OFPEC for allowing people to use the ofpec.com domain for Java packages (If you have a tag registered at OFPEC). Since I have registered the tag "SLAP" at OFPEC I am permitted to use com.ofpec.slap when naming Java packages, modules etc.


    The Video


    Download the video: Java Tech Demo (101MB)

    Notes

    Here is the information you see me enter into the dialog boxes, etc in the video. This won't make any sense until you watch the video, but instead of trying to write down everything I type I've included the information below.

    To download the settings.xml file
    • Go to http://maven.suderman.com
    • Right click on the settings.xml file and select Save Link as... (or whatever is appropriate for your browser).
    • Close your browser.
    • Open a command prompt.
      • mkdir .m2
      • copy Downloads\settings.xml .m2
    • Close the command prompt.


    Maven archetype information


    The Reaper module:
    • Group Id: com.ofpec.slap
    • Artifact Id: reaper
    • Version: 1.0.0


    The Vehicle Respawner module:
    • Group Id: com.ofpec.slap
    • Artifact Id: respawner
    • Version: 1.0.0


    Modifying the mission
    Remove all SQF code from the init fields of the four helicopter.

    Give each helicopter a variable name (I used helo1, helo2, helo3, helo4).

    The init.sqf script

    Comment out the line that calls cly_removedead.sqs

    Add the following two lines:

    Code:
    GameManager = jLoad "com.ofpec.slap.examples.convoy.GameManager";
    GameManager jCall ["init", [helo1, helo2, helo3, helo4]];
    Conclusion
    I have not tested this mission or the Java code. The mission may not work as advertised and may cause frequent CTDs. The intent is not to provide working code, but to give an overview of some the features available during Java development. In particular we use Maven to build our source code and handle dependency management. We don't have to edit a single line of XML, and we automagically have the source code and documentation avaiable for the "third party" modules (reaper and respawner) that we use.

    Enjoy!
    Last edited by Slapstick; Apr 11 2012 at 15:37. Reason: Added link to YouTube video
    In theory there is no difference between theory and practice; but in practice there is.

  2. #2
    Thanks for your Hard work there
    the video is very good and any insight into TOH and Java is always appreciated
    I am sure when BIS combine elements of Arma2 and TOH this page will be visited alot more

  3. #3
    Corporal
    Join Date
    Jul 17 2009
    Location
    New York
    Posts
    66
    Author of the Thread
    Thanks Thromp. Hopefully there will be better resources than this by the time Arma and TOH come together. I was just bored waiting for the next Java update *cough* and wanted to stir up a bit more excitement in the Java community.

    However, after re-reading my "Conclusion" above, I think I ended on the wrong note. I have tested the mission and the Java code, I just haven't tested it extensively and I've not done any MP testing. But anyone should be able to follow along with the video and have a working TKOH mission that they can run. The bit I wanted to highlight was how easy it is (can be) to import and use external Java modules.

  4. #4
    Well done Slapstick

    I am wondering if it is possible to extract the archetype information to a file and let eclipse import the definition.
    Similar for the modules (dependencies) used - even more I would have expected a drop down list to select the one you want to use
    or some kind of drag and drop of a definition file. The manual typing seems error prone to me and you don't get a good sense of overview.

    That said from what I can tell this is simply Maven/Eclipse interface design and unrelated to TKOH/Java FM usage itself.

    If you enjoy my work and want to my support efforts doing this for a living,
    please consider to become a patreon - Community Funded Modding!


    (292 of 1000$ per month by 33 patrons reached for first tier)


    Current projects: CUP, AiA TP, AiA SA, AiA HQ, IFA3


    Help: Got a crash? Report it! What is the RPT log file?

  5.   This is the last Developer post in this thread.   #5
    Very informative insight into getting started with Maven and TKOH Java Slapstick! Would you consider uploading the video to Youtube, so that it's more easily shared? My downloaded version cut out for some reason.
    Bohemia Interactive
    Arma 3 - Project Lead
    Watch us, tweet us, poke us

    Take On Helicopters - Project Lead
    Take On Noisecontrollers!

  6. #6
    Corporal
    Join Date
    Jul 17 2009
    Location
    New York
    Posts
    66
    Author of the Thread
    Quote Originally Posted by PvPscene View Post
    I am wondering if it is possible to extract the archetype information to a file and let eclipse import the definition.
    You could create a template mission and then simply import that into Eclipse. So you wouldn't actually "extract" anything from the archetype.

    Similar for the modules (dependencies) used
    You could, but you would be making a lot of unnecessary busy work for yourself. For instance, I didn't talk about transitive dependencies. That is, the reaper and respawner modules make use of the com.ofpec.slap.core module, yet we never actually included that module in our project. Maven figured out that we needed it, downloaded it for us, and added the classes to the compiled output.

    Further, every time a module is updated you would have to download the new module, plus its transitive dependencies all over again. With Maven you simply update the version number in the pom.xml and let Maven worry about everything else.

    even more I would have expected a drop down list to select the one you want to use
    or some kind of drag and drop of a definition file. The manual typing seems error prone to me and you don't get a good sense of overview.
    I'm glad I didn't use Gradle for the demo then as Gradle requires even more error prone typing. (I almost used Gradle, but Gradle support isn't built in to Eclipse like Maven support is and I didn't want to start with a tutorial on installing extra plugins). However, once Eclipse/Maven has an index for a repository you can select modules from a drop down list. I just forgot to show that in the demo.

    That said from what I can tell this is simply Maven/Eclipse interface design and unrelated to TKOH/Java FM usage itself.
    I'm not sure what you mean. I don't actually make any calls to RVEngine in the GameManager class, but the core, respawner, and reaper modules do. So the code will not work outside of TKOH. However, the intent of the demo was to showcase Eclipse and Maven and not TKOH/Java.

    Quote Originally Posted by DnA View Post
    Would you consider uploading the video to Youtube
    I'll update the first post with a link to the video on YouTube.

  7. #7
    Master Gunnery Sergeant
    Join Date
    Jan 4 2011
    Location
    Tipton, UK
    Posts
    1,166
    I will have a good look at this and maybe have a go at using Java for my next new mission (might be a little test one though before making a bigger one). Awesome work though!
    My custom missions:
    TOH - COOP5 Operation Pegasus http://forums.bistudio.com/showthrea...ration-Pegasus
    TOH - COOP Convoy attack (both Hinds and stock versions) http://forums.bistudio.com/showthrea...-Convoy-Attack
    A2CO Multi-mission Template http://forums.bistudio.com/showthrea...48#post2182048
    Basic Vehicle respawn script (A3 Alpha) http://forums.bistudio.com/showthrea...72#post2389272

    [EVO] Multigaming Clan is recuiting at ts3.evoclan.net

  8. #8
    Slapstick you misunderstood me somewhat.

    In terms of the modules (dependencies) used I was only suggesting to replace your manual typing with a definition file for this specific text - no more.
    Of course we want to continue to let Maven handle the management of everything else.

    To give you an example. Right now you download a script file (or a set somewhat) to integrate it in your mission.
    The idea would be to click on a link on a website, it will given you a file the defines the reaper module.
    Now you import that into your java/maven project and maven does the rest - vs you did all the typing yourself.
    You even provided the classic case with manual typing is not perfect - your typo.

    My argument at the end is that the ecplise/maven design is lacking in that regards.
    Not your demo/approach or anything related to TKOH etc.

  9. #9
    Corporal
    Join Date
    Jul 17 2009
    Location
    New York
    Posts
    66
    Author of the Thread
    No, I misunderstood you completely

    Part of the reason I had to do so much typing is because my Maven repository isn't actually a real Maven Repository, it is just a directory structure on my web server that Apache serves file from. In particular it lacked a proper index so Eclipse/Maven didn't know what artifacts were stored on it. I've since generated the index so adding dependencies is much easier and more closely resembles the way it would work once a real repository is set up.

    Now to add a dependencies simply type a few letters from the name of the module (any part of the groupId or artifactId) in the Enter groupId, artifactId, or sha1 prefix or pattern (*) field. For example, if you enter com.ofp you will see all modules that contain com.ofp in the name, which is currently only the modules I've deployed. Then double click on the module you want to include and the latest version will be added to the pom.xml file.

    Unfortunately you still have to do all that typing to add an archetype. At least in general, for first time users I could include the archetype-catalog.xml that Maven generates/uses. Also, since I started from a brand new Eclipse install Eclipse didn't have any history to work with. But now if we want to add an updated tkoh-archetype all of the information we typed in the first time will be available in the drop down boxes so we don't have to do all that typing again.

    I may re-shoot the video, or at least parts of it, to reflect these changes.

    Quote Originally Posted by [EVO] Dan View Post
    I will have a good look at this and maybe have a go at using Java for my next new mission
    We might have to wait for some documentation and bug fixes from BIS before we can do anything really useful. I can see lots of really interesting things in the Java API but I have no idea how to use them...

  10. #10
    @Slapstick
    I actually made some question to http://forums.bistudio.com/showthrea...ions&p=2138393 .. but after video some are already answered
    So correct me if I'm wrong .. but I can basically embed jetty and start inside init() and it should work correctly right?

    About events from engine, are those async ones and not keep engine waiting java parts or do I need to make it async in java side (spawn another thread for example) .. like for slow writes to databases.
    And how to hook on for example player events (die,take hit, etc) .. I can only see onPlayerConnect/onPlayerDisconnect handler methods directly in RVEngine class.

Page 1 of 2 12 LastLast

Similar Threads

  1. Take On Java
    By DnA in forum TAKE ON HELICOPTERS : MISSIONS - Editing & Scripting
    Replies: 210
    Last Post: Apr 14 2013, 11:07
  2. Unreal Engine 3 Tech Demo Video
    By Max Power in forum OFFTOPIC - Games & Gaming
    Replies: 24
    Last Post: Apr 9 2011, 05:03
  3. East Tech Vs. West Tech: A plea for Warfare modders.
    By Victor in forum ARMA 2 & OA - USER MISSIONS
    Replies: 5
    Last Post: Aug 27 2010, 01:39
  4. Is there a Real Virtuality Tech Demo?
    By b0b in forum OFFTOPIC
    Replies: 4
    Last Post: Feb 16 2010, 15:57
  5. Reinforcement learning tech demo
    By in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 6
    Last Post: Dec 23 2002, 15:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •