JVERGE: what is it?
JVerge is an attempt to bring all the Verge engine into Java. All the C-dependent code was removed and changed by a Java counterpart.
That means: all video/sound/music/keyboard/mouse code. The VC library code was adapted as needed (rect/circle/triangle/blit/etc), and some functions weren't implemented, specially the File, Socket, Movie playback and Window functions.
JVerge has some new features: wrapable maps, as described in another topic, and the ability to play VGM/VGZ files (from Sega Master System, Genesis and other consoles).
JVerge does NOT parse VC or LUA scripts. It's more like a Java API, so you write code in Java and use JVerge functionality.
Java is multiplataform, so I hope JVerge runs ok in any Windows, Mac, Linux and other systems with a Java Virtual Machine (JVM). In the future, maybe it could be possible to adapt it to Android and other similar platforms.
I have implemented three demos to show JVerge working:
- Phantasy Star remake: I've converted just a small portion of my original Verge PS remake, because I plan to come back later and actually finish this project. It's a common FF/PS-like game, with a top view and 2D chars walking in the map. It's using a 480x320 resolution, same as Ipad, I think.
- Alex Kidd: It's here to show that Verge is not just about RPGs. Alex Kidd was a popular 2D platform game in Sega Master System. I've added my own levels and plan to extend it later.
- Sully Chronicles: Well, converting Sully was very useful to fix a lot of errors, misconceptions and buggy code in my JVerge engine conversion. Now the engine is way more stable. But I've performed a direct conversion - that was faster than rewriting the Sully code to the Java paradigm.
I've packed them in .JAR executable jars (just run java -jar X.jar). It's also possible and recommended to developers to use an IDE like Eclipse or Netbeans, place the project there and see the source code running smoothly, understand it better, etc.
They are also separate projects/GIT repositories. For developers: Ak, Ps and Sully are dependent of JVerge. If you just want to experiment the demos, there are a 'redist' folder in each project with an executable JAR.
There are some screenshots in JVerge 'screenshots' folder.
Some important notes
- F5 for sound off/on
- F6 for full screen
- F7/F8 to increase/decrease frame delay.
- You can write your custom verge.cfg and place it in the same folder of the .jar file
- If it is running very slowly, try to run via "java -jar X.jar" or install a new version of Java and associate it with .jar files. Windows comes with a very outdate version o Java.
JVERGE: The Future
In a next release, I plan to change the JVerge code into something more OO, like placing the methods inside the domain classes, e.g., printstring inside VFont, rect/circle/blit/etc inside VImage, playmusic inside VMusic, and so on.
There are some unimplemented functions, possible bugs, and interesting things to do.
If someone is interested in the project, I'd be happy to help extending JVerge to whatever we can think of. I'm eager to receive some feedback, suggestions, etc.
NOTES ON SULLY CONVERSION
My initial goal was to show that the main tech demo would work properly with the Java engine, but now it is an example of a mindless bad programming practice: lots of static and public methods and properties, lots of static imports, and a general disoriented object programming.
- Some variables were converted to boolean. In Java you can't do: "while(count)", if count is an int. Need to change to "while(count !=0)"
- Add "break" clause after each "case" in the "switch" clause (unlike VC).
- A lot of methods and properties were changed to static. This is so anti-OO. :-(
- There is no script code being interpreted, it's just Java code. So the map() function can't just stop the remaining code to run.
- In order to implement the Sully introduction (that can be escaped anytime with Esc), I've opted to create a Java thread and use the ugly and deprecated method stop. I could have done this in a more elegant way, but the code would be changed a lot more.
- Java imports are different from C includes. So in order to call a function of an outer file, that would be normally included in C, I had to add a "path" parameter to the callfunction method.
- Unlike VC, Java is case-sensitive. A lot of calls were changed because of this.
- As SetClip is not yet implemented, I've changed a little the textbox behavior to produce the same effects.
- The "|" text delimiter was changed to "&", because "|" has another meaning to regex String function. Needed to change this in all Menus and Shops.
- I've performed some changes in the simpletype_rpg package, creating the structs (in Java, classes) in the corresponding classes. Not enough to be really OO, though.
- Reimplemented the data_load with Java File API. Not very hard to convert (just text files). But the token separator was changed to a tab ("\t"), and just ONE tab in the .dat files.
- Data_load strcmp was different from expected, so changed !strcmp to strcmp and vice-versa
- The item "Cap" is just three letters long, so was interpreted as junk, because of MIN_LINE_LENGTH. Changed to LongCap.
- I've changed some MenuOff() and MenuOn() calls to EntStart() and EntFinish(), because somehow, the player wasn't stopped in the dramatic scenes, shops, etc.
- There were some bugs in the original code, like accessing a -1 index in an array in the AddPlayerI() function. Those bugs become evident in the Java code, as it's now allowed.
- There were some strange TextBox without the comma (like TextBox(PORTRAIT, "a" "b", "c"); How these were working?!
- Load/Saving works fine outside the executable Jars (like in Eclipse or just running java directly). But when packing the code in a .JAR, I wasn't able to deal with saving files externally to the JAR, but loading files works fine. I'm thinking about a solution to this problem.
- I had a lot of problems with case-sensitive stuff (because JAR files are case-sensitive).
- There were some unused variables.
- I see that there is another version of Sully somewhere, judging by screenshots. Is the code available?