Chapter X: v1.4.2 toolkit
Chapter 1 covers Actor / World / Main. This chapter is the rest of the public surface that shipped with v1.4.2: a unified clock, interpolated drawing, classpath assets, camera, config, and the utils package.
Simulation vs render
GameLoop updates on a fixed tick and sets a render alpha on the world between ticks.
Gameplay code should keep using getX() / getY(). If you override
paint, draw with the interpolated helpers so motion stays smooth:
Actor.getRenderX()/getRenderY()getRenderPreciseX()/getRenderPreciseY()for sub-pixelgetRenderDirection()World.getRenderAlpha()if you blend something yourself
Missed ticks are absorbed in the loop so a hitch does not spiral. Target FPS still comes from
Activerse.properties.
ResourcePaths
Images and sounds resolve through ActiverseUtils.ResourcePaths: existing filesystem path
first, otherwise a classpath URL (so java -jar still finds assets). Prefer relative keys such
as assets/images/player.png and keep the same layout on disk and in the jar.
setImage(new ActiverseImage("assets/images/player.png"));
ActiverseSound step = new ActiverseSound("assets/sounds/step.wav");
Camera
ActiverseEngine.Camera is a viewport helper for scrolling worlds. World does not
construct one for you; create it, call update() each tick, and convert coordinates when you
paint or handle clicks.
Camera cam = new Camera(800, 600, 0.1f);
cam.setWorldBounds(worldWidth, worldHeight);
cam.setTarget(player);
cam.update();
double alpha = getRenderAlpha();
int screenX = cam.worldToScreenInterpolated(player.getX(), player.getY(), alpha).x;
setTarget(Actor)— keep the actor centeredsetClampToWorldBounds(false)— allow effectively infinite mapszoomIn()/zoomOut()/setZoom(double)— zoom is clamped about 0.6–1.4isVisible(...)— skip drawing off-screen actorsgetInterpolatedOffsetX/Y(alpha)— match the render clock
ConfigPuller
ConfigPuller.getBoolean, getInt, getString read engine keys only
from Activerse.properties. Other keys may fall through to settings.ini. The
settings menu can persist engine toggles back to disk with saveEngineSettings (writes
src/Activerse.properties when a src folder exists, otherwise the working
directory copy).
KeyboardInfo extras
isKeyDown(int)/isKeyDown(char)/isKeyDown("shift")isLetterDown(char)— case-insensitive lettersisAnyKeyDown(...)justPressed(keyDown, wasDown)/justReleased(...)— you store the previous sampleappendAlphaNumeric(current, keyWasDown, allowSpace)— typed names, thensyncAlphaNumericStatewhen entering a field so held keys do not dump characters
Actor extras
setStatic(true)— no debug-list spam; treat as sceneryisTickInert()— override to return true soWorldskipsact()enableInventory(),addItem/removeItem,setInventorySize- Velocity:
getVelocityX/Y,setVelocityX/Y
ActiverseUtils map
| Class | Use |
|---|---|
Physics, ActorVector, MathUtils | Motion, vectors, clamps, distance |
PerlinNoise, WorldGeneration | Procedural terrain |
WorldManager, WorldKeys | Save/load under a Worlds/ folder |
ParticleSystem | Simple particle actors |
Shaper, TextLabel, UIBar, PanelPainter, TextRenderUtils | HUD and shapes |
ImageUtils, ColorUtils | Image size and color helpers |
FileUtils, JsonUtils, IniUtils | Files and config formats |
Timer, DelayScheduler, DaemonExecutors | Timing and background work |
ErrorLogger | ACEHS formatting — Chapter 3 |
Full method lists are in the generated JavaDoc at /Activerse/. For the architecture write-up (clock, interpolation, lineage from v1.0), see Developers Insider Release 2 (PDF). Return to Chapter 0 or the Activerse home page.