Results 1 to 5 of 5
  1. #1
    DylanDog is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Default Modifing a single file in a game application

    I would like to improve the Artificial Intelligence of a "Risk/Domination" game developed in Java (Domination). The source code is available to download.

    Looking at the source code of the AI I can manage to understand 80% of the java language and of the scope of each class in the AI file. My issue is not therefore on java language but more on "playing with jar files and compiled java files"

    The structure of the source files (provided in src.zip format) is the following (AIHard.java is the file I would like to modify):


    The question is, once changed AIHard.java file, how can I re-compile the whole package and re-create the jar file to run the game? I know I have to compile the sources first and then to create the jar package. I managed to compile the famous HelloWorld.java (therefore I installed already JDK) but I have no idea what to do in this situation where multiple java files compose the game/application.

    Thanks in advance!

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    woud this game have its own build mechanism already ? Many projects use "Ant" or "Maven" to do the work of automating the compiler and jar file building operations. So I would see what this project is happening to do already, it could be as easy as just invoking their existing "build the application" targets in their what ever they use build system.

    Failing that, depending on the runtime deployment and folder paths, some Java applications have a batch file or a shell script to launch the java process. These either already have, or can be modified to, have several folders and jar files in the class path, so it should be possible to create a folder called "classes", and dump in the your single compiled .class file in the proper package folder into this classes folder, where your classes folder is higher up on the classpath than the jar files.

    For example:
    Java Code:
    set CLASSPATH=./classes;./lib/jarfile1.jar;./lib/jarfile2.jar
    Where any class found in the classes folder will be discovered first and 'override' the classes that live in the jar files. This approach is handy if you wanted to keep a clear separation between the original jar files of the software and the ones you created to customize some stuff.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Did you try to re-compile them? Just forget about the jar at the moment. If you can compile the file properly then you've done the modification correctly.

    Then as travishein explain above, you've to check that the package comes with it's own build mechanism. Check weather it use any additional packages and how it connected at the moment. Based on that you can build the jar package if you want.

  4. #4
    DylanDog is offline Member
    Join Date
    Nov 2010
    Posts
    2
    Rep Power
    0

    Default

    thanks, yes you are right! The game uses Ant, also I managed now to get in touch with the game developer which is now helping me out a bit...So now I need to learn also to use Ant...wow, I thought it would have been easier but I am not giving up! thanks again for the support.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Modifing a eclipse export function
    By Drun in forum Eclipse
    Replies: 0
    Last Post: 03-26-2010, 05:09 PM
  2. Applet to Application (Game)
    By AndrewM16921 in forum Java Applets
    Replies: 3
    Last Post: 04-12-2009, 12:24 PM
  3. Merged TIF file size is more larger than the sum of single TIF files
    By subrahmanyam.adapa in forum Advanced Java
    Replies: 3
    Last Post: 01-26-2009, 01:19 PM
  4. Saving and updating a single file
    By AkisV in forum Advanced Java
    Replies: 1
    Last Post: 09-27-2008, 02:42 PM
  5. Replies: 1
    Last Post: 06-06-2007, 04:20 AM

Posting Permissions

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