JGame Todo and Changelog To do, fixes: * report jgameerror when audio resource not found * input lag when trying to run opengl beyond screen frame rate? * check textrenderer maximum font size: about 100? * cancel button does not work for some settings (android) * StdGame dialogs do not pause activity * line number does not take into account lines skipped by readline * make local store suitable for multi-midlet suites (i.e. multiple stores) * make jgame canvas resizeable (currently only works on android) * refactor init() and other duplicate code * refactor common StdGame functions to superclass * ensure exit dialog always on top -> can only be done in java 1.5+ * ensure taskbar does not obscure playfield * look at possibility of non-integer scroll and drawing/sprite offsets, and compatibility between them. In JOGL, even scaled offsets may be noninteger. * add a flip x/y function for OpenGL images * add image getsize, existsImage to JGEngine interface * sprite textures should have transparent 1-pixel border around them, otherwise strong magnification will not look right around the borders * fix scrolling bug on MacOS. I found that there is something wrong with the bounds of the copied bg areas. * fix scaling artifacts on MacOS. I found that graphics may get scaled to the wrong background colour so you get whitish borders around graphics. This may be a Macos bug; the behaviour is not always reproducible and sometimes plain erroneous. * more complete MIDP support: highscores, font size/style, debug facilities. * implement MIDP hideNotify/showNotify? * give error when setCanvasSettings or setScalingPreferences are set at the wrong point * There is no warning in dbgShowBoundingBoxes that a bbox is not defined * appletviewer may give security exceptions when loading a jar from the local filesystem * fix the ugly volatileimage code which doesn't work in applets by means of a conditional compile scheme * fix the font alignment problem which aligns vertically according to text height, making alignment dependent on the particular letters used. To do, new features: * dynamic depth sorting (by depth value) * implement canvas layer for drawing arbitrary persistent background * option to turn off automatic scaling * shorthands for handling sequences in the sprite table file * Port the gamegen concept to a more general non-PHP implementation. The basic work has been done, but is not yet presentable. * further extend the library of standard objects, and include them in the gamegen framework * animated tiles * add scaling to image definition operations * full multiple background layer support? * autodetect OpenGL / switch between OpenGL/AWT runtime Changelog 3.5 -> 3.6 * J2ME compatible and optimized hack of JBox2D now included in the distribution * New game billiardberzerk demonstrates JBox2D. * jgame-all.jar has (at least temporarily) been removed. Instead, games.html now includes download links to the jars. * jnlps are now generated by ant script * Keyboard support for Android added * Bugfix: dbgShowException failed on stack traces with < 3 elements. * Bugfix: destroy() was not called for objects that were removed while still in obj_to_add list. * Fixed some games with old APIs / which were not suited for Java 1.3 compilation * New game pacmandandzombies; new standard class StdVirtualKeyboard (for emulating directional movement with touch screen and accelerometer) * Antified all make scripts; all games are now in their own directory. * Fixed grow bug in SortedArray; added test method to SortedArray * Addobject queue is now added to SortedArray in one go for faster performance * random() methods added to JGObject * fixed scaling bug in OpenGL -> scaling was applied twice * new drawRect added with fill pattern image * Bugfix: android drawString font was affected by setStroke. * Added settings API, currently implemented in Android only * Implemented persistent store API in Android * added NO_CURSOR as alternative to hide mouse cursor, for compatibility with JGame Flash * Android now handles JGColor alpha properly * Fixed bug in drawPolygon which did not draw filled polygons properly * Accelerometer calibration support (only implemented in Android). StdGame now has accel_set_zero_menu setting and getAccelZeroVector and getAccelZeroCorrected functions. * Improved StdMazePlayer diagonal controls * Bugfix: skeleton app was not compatible w/ android * Added flash-style drawImage methods and JGObject constructors * Android screen no longer goes to sleep when a game is running * AndroidManifest now specifies that games can be installed on SD card 3.4 -> 3.5 * fixed retrigger bug in disable/enableAudio * added method invokeUrl * Added Android platform. New functions isAndroid and functions for reading accelerometer. * made EngineLogic.splitList/imageutil/undefineImage public static for Android version * Added code for resizing images when the screen resizes. * improved Ogrotron and Caverns of Fire * JRE now centers the canvas properly for all scaling preferences. JOGL now centers and constrains aspect ratio properly. * load progress bar is lowered a little to be more splash screen friendly * html/ now includes games.html and mobile.html; moved screen grabs to html/grabs 3.3 -> 3.4 * Tall splash images now align with the top of the screen. * There is now a gen-skeleton script that generates a minimal application with the proper makefiles * StdGame: added new method startGame with level as parameter * added store... API for accessing persistent store * added Loader and SelectLevel to supported midp game states. * Fixed setPFWrap bug. It resetted viewoffset because it called setViewOffset with the wrong parameters * added length parameter to drawPolygon so array does not have to reinited every time * added mouse support to midp * Ogrotron now has mouse support * fixed frame skip bug where repaint was called instead of drawAll * added defineImageRotated (and rotateAny to JGImage) * fixed bug in drawPolygon where canvas_ofs was not added * fixed bug in MIDPImage.scale which didn't work for bg colors other than black * bugfix: bgimage could not be null * added tileStrToID and tileIDToStr to public interface * attempt to fix sound bug where music keeps playing after applet exits (needs to be tested) * new method initEngineComponent enables embedding the game canvas into a frame or panel * bugfix: changing bgimage did not take effect unless tiles were changed * defineImage now also loads files and urls. * redefining an image with the same name and filename no longer causes the old image to be undefined and reloaded, but rather, reuses the old image. (this is an optimisation useful for jyturtle) 3.2 -> 3.3 * moved adGLListener upwards in initialisation because it seemed the listener did not always catch init events * fixed race condition where Animator was not always started * load screen now works properly in OpenGL * fixed bug where rotated sprites went wrong for non-square aspect ratio * scrolling now works without needing the NPOT extension. Seams are still visible if the graphics are enlarged, no NPOT is available, and the texture is not a power of two in size. * parallax scrolling is now available for the OpenGL platform. * View rotate/zoom is now supported in OpenGL * fixed old bug involving scaling a partially wrapped rectangle. * Debug facilities are now available in JOGL * Guardian and tutorial Example9 now use parallax scrolling. * new OpenGL game "Dingbat Attack" 3.1 -> 3.2 * Added new platform: jogl. A game compiled for jgame-jre can be linked to jgame-jogl without any changes. Some common code shared between jre-awt and jre-jogl has been moved to a separate class, JREEngine. * added new methods get/setVideoSyncedUpdate for vertical sync based updates * added extended drawImage and drawRect for JOGL, and new method drawPolygon. * added pfwidth/pfheight variables to EngineLogic * added alpha value to JGColor * added startApp, pauseApp, destroyApp methods to standard interface to ensure these can be called/overridden without becoming platform-dependent * renamed JGObject finalize to destroy, to prevent name clash * fixed bug in StdGame checkTime, which did not work for gamespeeds < 1.0 * fixed bug in appconfig stop/restart code because it only seemed to work for applets * added new JME game ogrotron, and OpenGL-specific example tutorial.Example9 * some of the games are now video-synchronous when running under JOGL. 3.0 -> 3.1 * optimised checkCollision (25%), checkBGCollision, repaintBG, moduloFloor, scaleXYPos, getCenterTiles(4x), calls to moduloXYPos. * replaced central Hashtable "objects" by SortedArray. Objects are now always sorted, and enumeration is about 10 times faster, while the other operations, which are very rare, are only about 2-5 times slower. * game keys are detected only when no other keys were detected first. This is because some phones map both numeric keypad and cursors to game keys, so you couldn't separate them properly. * removed the getGraphics from drawTile. getGraphics is very slow and calls 10 or so other methods. drawTile is much faster now. * new variable gamespeed (get/setGameSpeed()) influences: (1) animation speed (passed every time to JGObject.updateAnimation and anim.animate) (2) object x/yspeed multiplier (in moveObjects) (3) object expiry speed multiplier (4) JGTimer tick multiplier (passed to JGTimer.tick) (5) StdGame timers multiplier (6) default grid margins * fixed old bug in calculation of tile bounding boxes for negative coordinates * moved is_suspended to public because it is accessed very often * removed tilechangedmap; mapping to bg_defined is now done in setTile. This increases speed of repaintBG a lot and saves some memory. * used x/y_scale_fac for scalex/y pos * all operations which use a string prefix to select a subset of objects are now implemented by taking advantage of the sorted object list, saving a lot of calls to String.startsWith and making them several times faster * removed the getLast*BBox/getLastCenterTile* because they were never used and took significant CPU cycles in frameFinished. * added new method tileIntToCid to avoid double conversion in setTile * copied some JGEngine game/playfield settings into JGObject local variables for fast access, making some of the methods 3-4 times faster. * fixed inclusive bug in intersects * fixed assumption problem for transparent pixels. It turns out some phones do not remember the colour you assign to transparent pixels! * is_opaque setting is now used to create MIDP images. The setting is also inherited now when one image is created from another. * with help of the WTK memory monitor, i managed to reduce typical object creations to less than 1 per frame. * adapted the games to work better with MIDP. * repositioned the loading files display * customisable progress and author message 2.3 -> 3.0 * New platform-independent versions of Point, Rectangle, Color, Font. * Changes in package structure. Base classes are now in jgame, platform independent implementation details in jgame.impl, platform dependent classes in jgame.platform. * Major changes in JGEngine/JGCanvas. A platform independent interface JGEngineInterface has been defined. The platform-independent code has been moved to jgame.impl.*, and for each platform there is a platform-dependent version of JGEngine, delegating functionality to jgame.impl.EngineLogic where possible. * ImageUtil has been split into a platform-independent interface JGImage, and platform implementations JREImage and MIDPImage. * StdGame now has two versions, the original for JRE and a somewhat simplified version for MIDP. * The package tree has been changed. The sources are now in src-*, classes are compiled into classes-*. Compilation of the JGame classes and the examples and applications has been split. * The code has been optimised: object creations in the most important tight loops have been reduced to near zero, repaintBG has been optimised by a factor 2, isOnPF/isInView were optimised. * a small bug in background copying where the area bounds would exceed the size of the source image was fixed. * A few methods were added specifically for use the Midlet platform, such as isMidlet(), displayWidth/Height(), setScalingPreferences(). * setCursor has been renamed to SetMouseCursor. * there is a new engine getTiles method that copies the data into an existing object. Semantics of the getTiles methods in JGObject have been changed to return a local variable with the information copied into it, rather than create an object every time. Semantics of some other methods such as getImage is changed so as not to create a new object every time. * fixed bug in exitEngine which did not set the JGObject default_engine to null * fixed access exception occurring in unsigned webstart. * improved frame skip logic so that game runs smoothly even if the machine is way too slow 2.2 -> 2.3 (20070622) * wraparound playfield support, new methods setPFWrap and getX/YDist. * audio no longer starts the same sample twice in the same frame * fixed bug in setTile, which did not draw the tile properly when view offset not 0. setTile now invalidates the tile, to be redrawn by repaintBG. * fixed bug in highscores which did not handle empty names properly. * SpaceRunIII is extended with wraparound levels * changed isAlive semantics so it returns false when the object is pending to be removed. * a tutorial has been added in tutorial/ * Window sizing now uses insets, so it should be the right size now. * fixed bug in getTileBBox (reference to wrong variable) * fixed bug in JGObject.checkBGCollision(xofs,yofs). It did not calculate the bbox properly taking into account the floating point position. * added new game Guardian. 2.1.1 -> 2.2 (20070531) * volatileimages are now used for the draw buffers * moved getConfigPath to JGEngine * improved exit code, esc can now be used to exit StdGame * added ...LastKey... functions * added highscores to StdGame and a couple of the games * fixed bug in JGObject.remove(): it isn't actually always called as advocated for disposal purposes. A new method finalize() is now used to define disposal code for JGObjects. * improved games: Ramjet, MatrixMiner, Insecticide, ChainReaction * new game Packetstorm (still beta) 2.1 -> 2.1.1 (20070518) * fixed rounding bug in scrolling; rounding of sprites and background was different. * fixed fileseparator bug: resources didn't load properly from jars in Windows * updated MANUAL 2.0 -> 2.1 (20070510) * changed initialisation code; a new method initCanvas is now used to do pre-engine initialisations; applet parameters can now be used to determine the view settings * offscreen margins are now configurable with setOffscreenMargin * fixed concurrency bug that sometimes caused glitches when scrolling * fixed debug bounding box draw bug in scrolling playfields * implemented tile pre-draw so that the tile drawing work due to scrolling is subdivided more evenly over frames * replaced pfTileWidth/Height by the better names tileWidth/Height * paths used for media and table files are now relative to package (unless starting with "/") * moved gfx/ and sound/ to examples * moved Nebula Alpha to subdirectory; split game jars so that applets will take less time to load. * applet html generation code can now generate the same applet with different settings * added suspended option in countObjects and removeObjects * new method setTextOutline for drawing text with outline around it. * fixed some small bugs: coordinate swap in setPendingViewOffset; image unloading was not done properly when redefining image; window border dimensions are better in windowed mode; fixed odd getImage method in JGObject; small fixes in docs * some small changes: objects suspend immediately when created and off-view; * Caverns of Fire now has scrolling version 1.3 -> 2.0 (20070430) * Scrolling. This implies several changes and additions to the base API. There are methods for setting playfield size, pan the view, get the view parameters, checking if objects are off-view, and a mechanism for object suspension. Also, all paint methods can be used both relative to the playfield and to the view. * The paint methods now take double coordinates instead of ints. * A new game, Space Run III, illustrates scrolling. * Dungeons of Hack has been adapted to include a scrolling version. 1.2 -> 1.3 (20070330) * sound; the ...Audio... methods handle sound. Some of the games now have some sound. * added "online game generator" application in gamegen/ * committed shift-esc fix by Jeff Friesen * new game: Ramjet * made AppConfig a bit more robust * minor changes: defineGraphics has been renamed to defineMedia, made i_am_applet public; some changes in docs. 1.1.1 -> 1.2 (20061023) * much improved output of getKeyDesc, and added its inverse, getKeyCode * added a new class, AppConfig, for game configuration. StdGame now starts AppConfig when pressing [enter] in title. * The games are adapted to work with AppConfig, that is, their keys are now properly configurable, and the proper start game key is displayed. * Forgot to add Munchies to the launcher. * Added HTML for "fullscreen" applets * added "performance" section to manual * defineImage now cleans up old images 1.1 -> 1.1.1 (20061015) * Fixed concurrency bug where objects are concurrently accessed by game thread and repaint thread. This gets rid of some of the rare null pointer exceptions inside Sort. * Included a game launcher in the examples package so that the games can be run with -jar * fiddled around with the JGEngineThread dynamics, without much effect though. I now yield every frame, and do the yield/sleep after the call to repaint(). * after trying out on a slow machine and finding that the gc causes a small jerk in the animation about once a second, I fiddled around with reducing the number of objects created, without much effect however. * I found that javac -source 1.2 -target 1.2 works neither for the source nor for the target for jdk1.4.2. I'm filing a bug report to sun, and have compiled this version on a "real" 1.2 compiler. 1.0.2 -> 1.1 (20061007) * new game: caverns of fire * API change: ...BGTile -> ...Tile (these methods are used very often) * bugfix: no more errors for objects with undefined bboxes in dbgSetBoundingBox * fixed rounding bug causing the tile span not being correctly defined for negative coordinates. * bugfix: setBGImage(null) never worked. * changed protected members to package-protected. * Change in update sequencing: moved "frame finished" actions on object out of paint loop to the end of the update loop; moved animation update to moveObjects. * fixed broken getTopLeftTile() * fixed sleep mode bug by clearing the wake-up key on wakeup 1.0 -> 1.0.2 (20061002) * Full-screen mode didn't work in Jdk 1.2. This has been fixed. * Image rendering has been improved. There's a new method setRenderSettings. * Changed fire key to Z in Insecticide (because of Windows trouble with pressing 5x shift). * StdGame no longer requires you to start with setGameState("Title"). * Fixed pause game frame size in StdGame, and changed getFontHeight Version 0.9 -> 1.0 (20060928): * fixed ignore condition bug in StdGame, where gameOver was not ignored; fixed bug in JGEngine, which could be in the same state multiple times. * added debugging options: an option for printing the game state, a dbgPrint method which enables printing on console and in the playfield * inproved error handling/catching: neater error messages and an on-screen failure message for applets. * cleaned up the setfont and setcolor code, added debug font and debug colours * The application now opens a window without decoration in full-screen mode * Yield updatethread when it can't sleep, so it hopefully gives more time to the input handler thread. * moved StdGame to jgame package. Version 0.8 -> 0.9 (20060924) * made a standard game framework that simplifies global game state handling, and some standard game objects. * added new games: ChainReaction, PubMan, Munchies, DungeonsOfHack, SpaceRun; improved MatrixMiner and Insecticide * custom paint() method in JGObject, plus some extra paint methods in JGEngine * mouse support * Bugfixes/minor improvements: setFont, better animation timing, check...Aligned/snapToGrid now have a larger margin, images are now loaded using getResource. * JGTimers now have parent * defineImage and tables improved: the transparency flag is no longer needed, and the image size can now be used as default bounding box. Wrote some docs on *.tbl files. * miscellaneous extra methods: integer random, counttiles, alignment in drawImageString, getImage, getImageSize, getKeyDesc, wakeUpOnKey * added special tile cid handling: setBGTileSettings, and set/and/orBGtileCid() * api name changes: renamed the get...Tile... API to shorter names: getTiles, getCenterTiles, getTopLeftTile, getCenterTile. Changed defineImages to defineGraphics. * gamestate extensions: removeGameState, state transition method calls: start * images are now pre-scaled so that no in-game delay is introduced * startup progress bar and splash screen * used smoother image scaling algorithm * included jar support and a "make jar" Version 0.8 (20060907): This project started in September 2005, but here is finally the first "official" release. The project is modelled after a previous project of mine: XGame, an X11 game library. In the JGame project, I wanted to have easier tile handling, and also devised a more consistent and convenient parallel model.