Showing posts with label 2d. Show all posts
Showing posts with label 2d. Show all posts

Friday, 26 March 2010

Ardor3D: Smaller things, little tweaks, maps

Got some progress again, little things standing in the way of porting were eliminated. DDS images reintstantiated this time not flipped (ardor3d's DDS loading has been recently rewritten from scratch, and it works like a charm, image flipping is now correct too). Save/Load game lacked the screencapture functionality, now that is solved as well, this time at last saving smaller sized images so save games won't take too much space.

One major thing that was successfully ported is the World map window and the Local map HUD element. Those needed realt time texture generation, and that part was nicely restructured in Ardor3D. Following their UpdateTextureExample (which demonstrates the technique how the Renderer can render directly to texture's byte buffer, partially or fully redrawing parts without reallocation), I could finally add that element to the array of ported things.

Tuesday, 23 March 2010

UI is ardorized

Most of the UI and input has been successfully ported to work with Ardor3D. I'm happy to get use of the BMFont feature of a3d, which made it quite easy to turn the used TTF fontset into the non-monospace bitmap based font A3D can use. I had to use this program from AngelCode, which is windows only, but luckily it's only needed once for one font set. Porting the UI spatial picking and connecting in UIMouseAction into the trigger based mechanism of Ardor3D and connecting keyboard event into the InputBase event handling made the whole UI usabel with mouse and keyboard again. Core class of the triggers and player's camera movement is now JClassicRPGClassicControl.

Next major tasks are animated models' loading and particle systems (magical light effects and such). -- side note, still couldn't crash the engine in the native part (driver or lwjgl)

Sunday, 30 August 2009

Optimized text rendering READY!

Till recently I always were a bit uncertain how the previous 2D text rendering might work out on the long run. On screens with dense windows the FPS counter dropped down a bit too much for my taste. There are two different text rendering ways used in the game - one was used for the bottom log, the other for all the UI. The true type font renderer was used for all the UI elements - that renderer was creating a separate quad for each letters in a text. The monospace (bitmap based) text renderer was much nicer and more performant -- but it's working with its own font bitmap format only!

I looked at it and found that if I was able to create my own bitmap out of the current UI ttf font (Vinque), I could replace the slower method and use the low poly version instead. So two things followed by a big refactoring of the UI elements changed the whole UI into a faster performing sweetness. :D

First, I overrode the jME Text class (shape responsible for 2D texts) and thus overrode the default font bitmap path too. Second, I used FontForge to tweak the ttf font into a monospace font set exported into a new ttf set and using 'convert' of ImageMagick converted it into a bitmap. A little tweak with GIMP and voila, there goes the Vinque font and TextureState based font rendering of jME tuned for jClassicRPG. :) After that, a tideous process of reviewing all the UI element and window codes came. But it was worthy! On my Intel gfx card it can even double the FPS on the character creation screens! Saving a lot of polys and also scene graph elements, that's quite understandable. :)

Friday, 28 August 2009

Top button row icons ready, Character creation improved

Still working on the UI part, this time a lot of minor fixes and polishing of the mouse input was going on. Finally I decided to not wait for the top button icons to be contributed, instead 'do-it-yourself', created them by modifying different free icons or painting it myself. I hope you like it. You will be able to click them with the 'pointer mode' mouse, swap between the different windows - that is quite comfortable. :)

The other major upgrade is of the Character Creation part. Following the idea of TheAncientGoat @ freegamer, I changed the profession selection process. Instead of letting professions be chosen after tweaking the attributes to unknown minimums, now player can select a profession which automatically sets the minimum attribute levels that are required for the given profession. This makes it a lot more easier to select a profession. The other change is on the skill setting page - added a Reset button, which will reset the skill value set to the original values.

Next I can move back to enhancing the map. After that I will integrate the new 3D content (made by tidbit & TheAncientGoat). That done a test release is due - so there'll be a new release before moving on to the next chunk of bigger development goal (story/dialog/commerce system).

Wednesday, 19 August 2009

[Updated] Mouse support READY!

Currently I have narrowed down my attention to the process of providing full mouse support for the UI. I've added mouse event processing to 70% of the UI elements already, and also cursor replacement, different cursor types for normal/scrolling/tuning values etc. Still more is to be done, the remaining UI element classes awaiting, along with the addition of new Close signs for the windows that lack them, reviewing the UI mechanisms of the already present windows. And of course more and more testing. :) Things are in SVN, so anyone interested can help in testing as well.
Update: spending some more hours on the matter today, now it's time to announce: the mouse support dev is completed and committed to SVN!

Monday, 1 September 2008

Direct memory buffer pool and DDS

Well, it's been a long time since I had checked some really important aspects of the 3d core of jClassicRPG, and looking at that part I was a bit scared. :) Now it's not a secret, it's the memory consumption ratio of the game. But don't fear -- ways to improve are at hand.

With the long ago addition of an extended version of GeometryBatchMesh (created by Snylt @ jme) a new factor was secretly creeping into the memory usage of jCRPG: the direct memory buffers are heavily allocated especially because of the dynamic nature we use the batches, adding new batch instances every step walking around in the 3D world. In Java 5 and 6 there's this thing called direct memory buffers which is handled out of the heap of jvm for quick direct access e.g. by video cards. This speeds up things a lot with jME, so it's a handy thing. But there's a small problem with that (just like with the normal garbage collection), and it is that it's freeing is out of control of the programmer. This is not necessarily bad but in a game you would aim at controlling it - and allocate as little as possible because it takes time, fragments memory etc. jCRPG could end up with a big size of memory allocated to it rather quickly while walking around in the game.

Now my solution to circumvent the inability to free the buffers is the same as always: pool them! :) And it's mostly done committed to SVN repository. I've tuned GeometryBatchMesh to get and release its buffers from/to my BufferPool object. The handled buffer's size are always multiples of bigger numbers (say 500) and are limited down to the needed size (this helps the reusability of the buffers for different capacities). Thus the consumption is more or less stable and adds less stress on to the jvm's decision mechanism (how to allocate/free/reallocate). It's a good thing! :) I've even written a speedy QuickOrderedList to store the buffers in order of capacity with quick lookup/put/remove functions.

The other thing to lessen the consumption is the good old ace of using DDS files (which possibility I was not aware of till some days ago). DDS files are by default compressed (in sys and video memory too) and with pre generated mipmaps, quickening the load of them. I've started the process to migrate the textures to .DDS format with the help of GIMP and the GIMP DDS plugin. For use with jME I had to tweak the plugin's source ( mipmap.c's get_num_mipmaps() ) to add more mipmaps (jME DDS loader is picky about it, and accepts only an exact number of mipmaps for a given image size).

So the bugfixing, optimization phase is still going on... ;) (PS.: added two screenshot of my improved Depth Of Field render pass with 'bleeding' prevention.)

Monday, 21 July 2008

Polishing before release + new 2D elements

Many small fixes and minor enhancements are being added to the codebase. New 2D elements were created by Zphr meanwhile. HUD main log is now 2 rows longer thanks to the 2D changes. These are all in SVN. Light effect was added to spells, turn act window inventory lists are supporting item icons as well now. Some new sounds were added. Encounter Grounds generation was perfected, adding Cave Encounter ground for example. Logging to console was moved completely to text file logging to help later bug investigation.

Twitter