Sunday, October 7, 2018

HBF, experimental version

I've been playing for a while with the attribute [unsafe], the reason is that I use interfaces all over the code but I manage my own objects, so I don't need this COM overhead, I need basically interfaces behaving as clever pointers.

The game offers to all entities the following interface which returns many interfaces to handle any part of the game behaviour, like this nobody is aware of the implementations of the classes.

  IGameServices = interface
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetSession: ISession;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetEvents: IEvents;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetPlayers: IPlayers;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetCoins: ICoins;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetMap: IMap;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetDrawer: IGraphicDrawer;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetGraphicInfo: IGraphicInfo;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetLog: ILog;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetProfile: IProfile;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetFont: IFont;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetSmallFont: IFont;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetWindow: IWindow;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetLayer(aIndex: integer): ILayer;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetCameraHelper: ICameraHelper;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetHud: IHud;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetEffects: IEffects;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetSound: ISoundDispatcher;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetMusic: IMusic;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetFileSystem: IFileSystem;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetOptimizer: IOptimizer;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetFactory: ISpriteFactory;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetBack: IBackground;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetSettings: ISettings;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetHighscore: IHighscore;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetLevels: ILevels;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetVars: IMemVar;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetAchievements: IAchievements;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetRunes: IRunes;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetShop: IShopHandler;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetTimer: ICrono;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetInput: IInput;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetCurrentScreen: IScreen;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetTrigger: ITriggerDispatcher;
    {$IFDEF _UNSAFE_}[result: unsafe]{$ENDIF}function GetChat: IChat;

So a typical enemy would do GameServices.GetSound.Play() in order to play a sound.

GameSprite.pas.4293: begin
00A6BA50 53               push ebx
00A6BA51 56               push esi
00A6BA52 8BF2             mov esi,edx
00A6BA54 8BD8             mov ebx,eax
GameSprite.pas.4294: Exit(FGameServices);
00A6BA56 8BC6             mov eax,esi
00A6BA58 8B93A4030000     mov edx,[ebx+$000003a4]
00A6BA5E E8D5739AFF       call @IntfCopy
GameSprite.pas.4295: end;
00A6BA63 5E               pop esi
00A6BA64 5B               pop ebx

00A6BA65 C3               ret 

The classic IntfCopy() is there and of course their counterparts InfClear(). When you have a system which continuously passes interfaces then is quite an overhead.

In the experimental version we get:

GameSprite.pas.2834: result := GameServices.GetSound.Play(aFileName, aLoop, True);
00A63218 6A01             push $01
00A6321A 8BC6             mov eax,esi
00A6321C E863390000       call TGameSprite.GetGameServices

GameSprite.pas.4293: begin
00A66B84 51               push ecx
GameSprite.pas.4294: Exit(FGameServices);
00A66B85 8B80A4030000     mov eax,[eax+$000003a4]
00A66B8B 890424           mov [esp],eax
GameSprite.pas.4295: end;
00A66B8E 8B0424           mov eax,[esp]
00A66B91 5A               pop edx

00A66B92 C3               ret 

Hooray!, all that overhead is gone. The problem is that the compliler very often makes a mess and the code explodes as an AV (I haven't found a pattern), so I change the way the calls are done and then it no longer crashes.

For example this crashes (in some places of the code some others not):


changing the code  a bit as:

players := GameServices.GetPlayers;

Not a big deal but quite cumbersome to do all over the code, so I change it when it crashes.

Still not convinced?

Performance test with classic interfaces:

About 40 FPS for 50000 triangles.

Now with this UNSAFE stuff:

Almost 48 FPS for 50000 triangles.

I believe if worth the effort. It is important to note that interfaces should all be declared as const and never as inline.

So once I'm happy with the results I will publish this version.


Friday, October 5, 2018

Summer is gone...

Well, still not bad weather but summer "mode" is gone...

Anyway, as usual I always find time to improve the framework (which is the main idea behind all this) and the game itself.

Main changes are performance boost here and there, framework improvements, game stability and a new secret level.

Found binaries at OneDrive, here is the what's new:

  • All sounds are now played in 3d mode, panning and volume are continuously recalculated from hero
  • New class TChat 
  • Hero can sell items 
  • New class TColorTileHandler
  • Some lasers throw sparks when collide with a block
  • New trigger functions: IsDoorOpen(), SkipIfTrue() and SkipIfFalse()
  • Inventory had a memory leak, fixing that memory leak lead to many issues...
  • Now when throwing a weapon another one can be choosen and the old one still visible
  • Inventory now internally uses TStrings<T>
  • TShopHandler.Remove() is now faster 
  • Gift stuff removed, now they are invisible
  • Items now can also be sell
  • Shop/Inventory items code cleaned a bit
  • Platforms graviting was detecting itself...
  • Now when handling collision with blocks over a tape, tape speed is taking into account
  • New Headshot property distance 
  • New shop item Invisibility
  • All entities that could react to the presence of hero now take into account Invisibility
  • Teleport system rewrited, it was not handling properly the guests
  • Now boomerang distance is configurable
  • Shop shows information about items
  • New red boomerang (level 2)
  • Game now distinguish between vertical and horizontal slopes so everything is easier
  • Horizontal slopes take into account Facing property
  • Spider runs away when hero has immunity
  • New TSelf that reflects entities
  • New Mirror.Alignment property
  • Now arrow has a power = 1
  • Now stone has a power = 2
  • Now golden shield can stop lasers
  • Property Chest.Z changed
  • Left and Right collisions with slope tiles improved a bit
  • Now when shopping game shows the owned quantity of each item
  • A door can connect to other door from different level 
  • When connecting doors selection screen is not shown anymore
  • When selecting the next level, a sound is played
  • Now TLiquid implements IExecutor
  • Now Rotator can have different colors with ColorMaskA/B
  • Now rotator uses two light colors
  • Rotator now has a counter property so start Angle can be controlled
  • Now laser properly bounds in Mirrors
  • New class TFlyingEnemy
  • Now weapons can have a quantity (so bow does not have infinite arrows for instance)
  • Now Shop offers Ammo, a new shop item
  • Now any enemy can have wings and fly 
  • New aligments acBottomLeft and acBottomRight
  • Time shader off was not working
  • New Bomb bitmap
  • Now droid has a new laser color property 
  • New trigger CallElevator()
  • Trigger ItemOffset() renamed to TileOffset()
  • New trigger method MotionItem()
  • Unknown level is finished
  • Now teleport connection is per name and not per group, so teleports can freely connect to any teleport
  • Now Teleports can be disabled 
  • Now Teleports now can also handle enemies 
  • Door now can be closed automatically after open it with property CloseAfter
  • Door now can be half open but not accessible
  • Platforms can be executed from scripts 
  • Platforms bouncing adjusted at pixel level 
  • Now triggers and their timings are script dependent internally
  • Now weapons are used in grid collision matrix 
  • Improved code like "interface as TClass" with "TClass(interface.AsObject)" (seems to be faster)
  • Now when you get a coin you get a message with the number of coins 
  • Certain coins now use a Distributed Random Number Generator
  • Slots and Sounds per Slot are now configurable within the SoundDispatcher class
  • Sword cannot longer break walls, use bombs (hint...)
  • Extras code improved
  • New item property IsContinuous
  • Now monologue is now shown when in shop or inventory screen 
  • Graviting is done with walking animation
  • New inventory function ActivateOnlyOne()
  • Now inventory can be navigate it with up and down keys
  • Clear inventory was not working properly after the first game 
  • Fixed an issue pushing items recursively
  • In game menu now will always start with index 0 no matter how many times you access it
  • Now menus can be locked 
  • Now game fades properly when exiting game 
  • TBell renamed to TBells to avoid collision with extra.TBell 
  • Now triggers can have required items 
  • Countdown now has a direction property
  • Lamp has new style
  • Now game can be paused when fading
  • Fixed lamp light priority
  • TInventory.ActivateFirst() is now faster
  • Fixed error in magnet, when trying to read non IGameSprite interfaces and then AV
  • Map light is now blue
  • Pushable stuff now does slippery properly
  • GameServices.EnterInventory() moved to GameServices.GetPlayers.GetInventory.Enter()
  • GameServices.EnterShop() moved to GameServices.GetShop.Enter()
  • New TGameSprite properties MinAngle/MaxAngle to adjust the bounds of the gravity orientation 
  • TGameSprite.IsIce property removed (it was unused)
  • Countdown now uses Y for position
  • Spring weird movement fixed
  • Shield code moved to GameSprite 
  • Jumping force now uses property Power, so jumping enemies can have different jumping power 
  • TColumn can use now different sprite sets
  • Maximum camera zoom set to 1024
  • Fade step set to 4
  • Gravity orientation code refactored
  • Pushing objects use property Power 
  • Under some circumstances PushedByBlocks() got hero stuck
  • Shield can now stop fire bullets
  • Music timers are now local
  • Crepuscule is not a bit yellow
  • Now Pause key can also be redefined
  • When hero dies he also releases its chest keys
  • New class TRay
  • TCustomScreen refactored
  • Platforms can rotate with certain cadency
  • Game.GetTarget()/SetTarget() moved to CameraHelper
  • New trigger Sleep() (more complex than it sounds)
  • Ice can be sloped
  • Now any sprites supports multiple fellows
  • Now arrows can be called from the trigger system since they implement IExecutor
  • Shield and armor now takes into account hero's balance
  • Some maps now have floor traps in tiles
  • Fixed a bug when on top of ladder and jumping
  • New Scepter bitmap
  • New Explosion bitmap
  • Nulling some interfaces when destroying some entities
  • New helper Coins
  • New property TPlatform.SleepAfterBounce
  • Now message key can be set in the config 
  • Stalactite was not breaking when falling on top of a map item
  • Preparing screen code improved a bit
  • Gametrigger was not settting Script to nil when destroyed (AV)
  • Now there is a secret coins per map, jump to find it!
  • New TVanishPlatform
  • TRotatingPlatform fixed
  • Spring behavior improved
  • Top/bottom collisions are not checked when items are invisible
  • Left/Right collisions are done against rectangle and not BB
  • Liquid can now load any particle system
  • Now NEW_ATTRIBUTE is part of the non breakable attributes
  • New TFloatHelper.Abs(), faster by just clearing bit 31
  • Collition Matrix system improved a bit
  • TSurface.Blit(add) is now MMX 
  • New TRGB.Clamp() as MMX
  • Some buffer triangle functions writed as MMX
  • Now using TFloatHelper.Sqrt(), TFloatHelper.Trunc(), TFloatHelper.Round() which are MMMX optimized
  • Now TMatrixEx uses some MMX assembler optimizations
  • Now TVectorx uses MMX assembler optimizations
  • Removed inline from functions returning interfaces (Delphi makes a mess)
  • Removed inline when function result is string (bad optimization from compiler)
  • Cleaned functions that didn't need to be virtual
  • Sprite.Pause is no longer virtual (that was actually slowing down the game accoring to profiler)
  • New Sprite.CanPause property, useful when you want some sprites to never be paused
  • Improved sprite engine main loop by creating local vars of global vars and duplicating the loop with IF and not IF
  • New TObject.PopTag()
  • Now trigger calls must implement the Caller and script Name (this avoids some mess code)
  • New TLaser.CurrentSegments property 
  • For specific triangle routines Buffer.Tag is used rather than Shape.Tag
  • Now particles store the filename making debugging easier
  • New collection helper to sort as Insertion algorythm (good for almost sorted collections)
  • New YTLayer.GetCells() that works with map coordinates
  • TLayer.Trace() now works with map coordinates rather than pixel coordinates 
  • TSimpleSprite.CalculateQuad() reordered so that performance is improved
  • Fixed Z in Layer.AddItem()
  • TScript.RemoveWhenTaken removed, now use Counter = 1 (the default)
  • Now with RTTI system if enumerator does not exists an exception is raised
  • TEvents renamed to TEventEx
  • TEventEx loop forced to be forward (so calls order in scripts is respected, very important!)
  • TScript moved to its own unit
  • New LinkType property in triggers to allow more behaviors like mutual connexion
  • TStrings<T> is now used in TIni rather than TDictionary<K,V>
  • Scripts improved with TicksBetweenExecutions, Executor and Counter new properties
  • Distortions were not free properly
  • New TObjectEx.Error(), so that one does not need to do raise exception
  • TStateDirector<T>() improved a bit
  • Fading system improved a bit
  • property TSprite.FreeSurface removed (was always the negative of Cached)
  • Fixed a AV in Glow and Shadow surfaces  (double free)
  • Now when addings events if steps is zero then the CallBack is executed immediately
  • Fixed TMapInfo.HasTile(), my goodness...
  • Now script Input property can be any key
  • Fixed a silly typo error in collision library
  • New property TFont.Uppercase

Saturday, April 14, 2018

First 2018 update, it was about time...

I've been lazy lately, but that has to change, still from time to time I move my ass and code a little bit, this is the outcome:

  • Now game is paused, Shop, Inventory and Fight screens are substates, now code is cleaner and shorter
  • Curtain code cleaned
  • Now Shunenbukaidesu brings rain
  • Now when pause screen is gray
  • New TDirector code improved
  • Now Boom does some random rotations
  • Now Lights do some random zooming
  • New property TTriggerDispatcher.Player so code knows who did execute the trigger
  • TBell behavior improved
  • Backgrounds now can be setup in back.ini per level 
  • Now TGameSprite.Magnetized property
  • Now when adding a sprite to an engine it will enter the collision grid so that it can be search since the very beginning
  • UFO laser fixed (since when it was wrong? :)
  • New methods TGame.GameServices FadeIn(), FadeOut(), LockEntity() and LockExcept()
  • Left and Right collisions with moving objects improved
  • Now Dialogs have a Edit type so game can interaction can be done
  • Now game allows to add text (useful for chat)
  • Now Ropes can have different textures
  • New triggers IfItemThenSet(), RemoveItem(), ExecuteActionTile() and ExecuteActionEntity()
  • Now enemies can also activate triggers
  • Some levels now have a fourth layer (pipes and others)
  • Now TTriggerDispatcher has a Target reference (who did execute the trigger)
  • New trigger Velocity()
  • Pushed by blocks code fixed
  • New trigger Sleep()
  • Fade code refactored a bit
  • Fixed a bug in dialog system with NPC 
  • Extra Wand execution simplified
  • Now hero balance when standing
  • Added a new layer to all maps to handle better the trigger interactions
  • All layer are now declared as constants
  • Now circles shrink when interacting
  • Stalactite now works with gravity 
  • Graphics unused removed
  • Now game does Continuous Collision
  • Now Post is static
  • Now left/right collision with slope items/tiles works properly
  • Some fonts are shown with shadow
  • Collisions improved
  • New layer in the labyrinth
  • Owner property renamed to Hero
  • CarryItem property renamed to Owner
  • TGameSprite.IsUnderneathOf() fixed when gravity is up
  • Now music can fade in/out
  • Music now fades with screen
  • Now in mapping.ini one can assign directly the default animation, so for simple sprites there is no need to create a class 
  • Some new fonts
  • Now some level has a countdown...
  • New Door graphic
  • New wind effect
  • Notifications are now easier to code
  • New princess bitmaps

  • TStateMachine<T> renamed to TStateDirector<T>
  • TStateDirector<T> now supports substates as Push(T) and Pop(T)
  • Surface blur performance improved
  • TSurface Lightmap() performance improved
  • Many internal lists changed to TColony<T>
  • In TCollisionMatrix.Enter() Occupation was updated inside loops, that makes no sense and affects the performance
  • New classes TObjectColony<T> and TFastObjectPool<T>
  • INI class moved to its own file 
  • INI now uses internally TDictionary<K,V>
  • New TSprite.GetOldRectangle()
  • TCollisionMatrix performance improved
  • Particles now have a better management of internal textures
  • Now triggers have an Input property 
  • New TInput.ReadChar() so that game can read commands from user
  • Now triggers can only by executed by specific entity with property Holder/
  • Now Triggers can have Cadency, so the trigger can be only be updated every N Frames
  • Now triggers might have a Hint
  • Now triggers are called scripts
  • Now surfaces can have slopes left and right
  • TCollisionMatrix now checks for top/left and bottom/right corners
  • Now shadows are TBoolean rather than boolean
  • Now some fields are now TNullable<T>
  • Now map layers can have alpha configuration
  • Overhead with rotated matrix when angle = 0 reduced
  • Using [unsafe] tag when possible since my interfaces behave as pure interfaces with no reference counter
  • Now TTimerEx no longer uses an event but a callback
  • Some [UNSAFE] fixed
  • Many GUID removed from interfaces
  • Many const added to interfaces when parameter
  • New Glow properties color and blur  
  • New class TCountdown

Found binaries at OneDrive

Sunday, October 22, 2017

HBF can now be played on a LAN with up to four players!

Not because there are no news it means I'm doing nothing,  I was focus on net playing, not an easy topic, but as usual I love the concept "learning by doing", so this is the result of that process.

What's new in the game?

  • New unit Camera, all camera code moved from Game to new unit
  • New achievement "Finish the Labyrinth with a partner"
  • Now bat moves faster
  • TPlayerHandler.GetClosestHeroAt() fixed
  • When a platform is pushed, some particles are rendered
  • Stalactite has now some alpha
  • Fixed an issue with casting interfaces (suddenly it crashes...)
  • Mine now rotates a bit
  • Fixed offsets of lightmaps in darkness
  • Minimum resolution is 1024x768
  • All release inventory code moved from Game to Hero
  • Hero can have a partner on top of it
  • Monologues are now created on demand
  • Now when loosing a fight, owned runes are released, beware!
  • New Mine.Shake property
  • New trigger Follow()
  • New service GameService.GetEvents
  • When hero touches the ceil it liberates some Particles
  • Camera lerp enhancements to make the usage easier
  • Now Liquid might have a Tide
  • Rays colors changed in order to look better
  • Now Camera does all movements with interpolation, new method for lock/unlock
  • New Weapon properties Range and Quantity
  • Now Camera can focus any entity
  • New property TGameSprite.Triggers, so that any entity can execute any trigger/s
  • Doors can now be closed after being opened
  • Fixed an issue with the stalactite particles
  • New property Items.IsAutoso can be auto activated after they are taken
  • New triggers: AchievementDone(), ExecuteIfEqual(), ExecuteIfNotEqual(), KillAll() and Focus()
  • New Weapon.Maximum (as bullets)
  • New weapon Bow
  • Now extras can be automatic applied (like live)
  • Entities can execute triggers OnCreate, OnDestroy and OnTake
  • Monologues are delayed
  • Better Door states
  • Annoying bug changes have been fixed
  • Camera follows hero in a more stable manner
  • New inventory functions ActivateFirst() and Push()
  • New change action (to cycle weapons)
  • Snowball generates different particles than before
  • Items are not draw when exiting a level
  • Game can now be set to fullscreen/window at any time with Alt+Enter
  • Background also tries to adapt to camera Z
  • New Item.Detail property
  • Bell item sounds more continuous rather than per volume
  • New golden bow and golder arrow items
  • Arrow can have now an angle depending on how long the action button is pressed
  • Scores moved from inventory to players class
  • Map read cells event improved
  • When in shop background is rendered as sepia to make contrast
  • Entity.Excite() code refactored
  • HBF now can be played remotely (new menu option)
  • New host/port settings
  • New hero property Scope: local, remote
  • New dialog type Abort()
  • New level...
  • Better handling of network delayed games
  • TCPClient/TCPServer connected properties not used during game (seems they they corrupt network buffers)
  • Entities inside a thread/task using random functions will take a local Copy
  • Closing dialogs won't unlock the game if still locking pending messages
  • Better control of locked situations (visual messages VS waiting network)
  • New TNetBuffer PeakX()
  • New sound when hero is underwater
  • New item Water of Rhand
  • Menus now can show dialogs
  • Session id is send in every message, so client can refuse their own messages
  • Coins moved from inventory to TPlayerHandler class
  • TPlayerHandler refactored, now it is easier to follow the code
  • Dialogs, question can persist after callback
  • SessionId is send in all net messages so that clients can ignore messages at their own discretion
  • Terminal animation is different
  • Now input is in the form of K;J1;J2;J3
  • New screen Sync
  • Input read improved
  • New Hero.JoyId
  • Inventory moved to Players class
  • Stalactite now also also falls when top tile disappears
  • TCameraHelper.CoversAllPlayers() now does not take into account heroes that have already entered then door
  • New GameServices.GetImpersonateKeys()
  • Players iteration improved shorting edges (first/last)
  • Hero sessionId moved to Players class
  • New message to request the list of sessions
  • Now servers controls the maximum amount of players
  • Now game can be played with up to 4 players
  • Hero.Scope moved to Players class
  • New callback TPlayerHandler.GetPlayers()
  • New TPlayerHandler.MinPlayer() / TPlayerHandler.MaxPlayer()
  • Player removed from inventory
  • Added player Alias so when joining network games, players can be identified
  • New TPlayerHandler.FindPlayer(session)
  • New TNetBuffer Readstring & AddString, so now strings can me send in net protocol
  • if master leaves the game, then server finds a new master
  • New TPlayerHandler.GetSlots()
  • Game can now do multi-ping
  • NetworkPlayer concept removed (everything is in player and slots)
  • New TPlayerHandler.RemoveSlot()
  • More robust network control
  • Remote locks improved
  • New concept in network code channel (rq, all, target)
  • Max zoom improved
  • TPlayerHandler.GetDistance performance improved
  • Wand item now glows
  • Now when hitting enemies a white effect is done
  • Pushing moving blocks improved
  • When playing over net, camera focus on local player
  • Blind and Many players achievements are now configurable
  • New skin for player 2 (tough still ugly...)
  • Avoid Z players overlapping
  • Network locking simplified
  • Now HBF comes with a standalone server called GameServer.exe
  • Now dialogs are rendered correctly when title is short
  • Now network seed is taken from ticks and not from network, this makes the game more deterministic
  • Server now sends back the available slots
  • Network input is stored in a buffer so if we receive more than one packet all packages are processed in order
  • Reading joy process improved
  • Now game check if there is enough input devices
  • CheckPoint is back to Hero class
  • More control over disconnected sessions
  • Now TSpriteEngine uses TColony<T> as a main iterator class
  • Cannon had a AV when hero is dead
  • New THUd.Visible
  • New TPlayerHandler.RandomPlayer()
  • Now when entering Door a red flash is shown
  • When no lives and going to main menu, the in game menu will not be displayed
  • Falling controller is not always created by default
  • Some non used songs deleted
What's new in libraries?
  • DirectZ removed from sprite properties
  • Map does not longer creates a default camera
  • In TSpriteEngine.SpritesAt() there was an overloaded version that didn't use the spatial grid, speed boost!
  • Particles adaptive view fixed
  • TArrayEx<T>.Delete fixed
  • Object names are no longer used in release mode
  • Now maps have infinite loops again
  • Now sprite quads have a default Tag
  • TSpriteEngine.Find(name) was not working at all!
  • Maps now use frustum to check boundaries
  • Improving frustum in 2d maps rendering
  • New Map.FindTrigger()
  • New Trigger Context, so that engine knows when to execute the trigger (create,destroy,taken)
  • New buffer default size
  • New TPerspectiveCamera and TBasicCamera
  • Sprite engine searches are faster
  • New particles property RandomDirection
  • TInput now can keep track of now many frames a certain button was pressed
  • TSprite.SetAngle() now does not apply matrix if camera is not set
  • New inline TRGB _R(), _G(), _B() _A() and _32()
  • New laser aspect
  • Horizontal and vertical gradiants now take into account alpha channel
  • Blur() performance improved
  • TLayer now have a Glow property so that tiles can be glowed
  • New TRandomHelper useful for threads, otherwise random generators are corrupted and net game is not deterministic
  • Particles use their own random generator
  • TSurface.AverageColor() fixed
  • Now when creating Direct3D, flag D3DCREATE_FPU_PRESERVE is used
  • Many raise moved to their own function (performance)
  • Fixed a Lock() issue in TSound
  • New TParticles.IsSystemDown()
  • New classes TRingBuffer<T>, TSet<T> and TColony<T>
  • Now system can handle up to 4 gamepads
  • TInput improved
  • New TJoyData.JoyReleased()
  • Now levels are loaded with rtti
  • Triggers now can have a counter (executed when counter = 0)
  • Finally joy direction pressed are no longer simulated
  • Shadow and Glow helpers classes are not created by default
  • Queue particles are not created by default
  • Collection iterators improved

And that's all folks.

Saturday, April 29, 2017

HBF is not alone anymore, say hello to a new player.

Like a month ago I was thinking, why not add a second player?, but as usual new ideas bring new challenges.

Adding a second player to the game means many aspects of the game have to be modified, like who enters the Shop, how Items are split, some enemies need to decide the proper victim, how to handle when heroes are far away from each other, what do to when one die, change the behavior of the Door, who enters the Fight, rewrite most of the input system, etc.

That was as usual very funny. The most difficult part was to handle the Camera and order of sprites, so I decide so change the 2d engine to be more 3d (visually still the same), so now Camera can play with Z axis, then many Z issues appear..., so I had to revisit all game.

But anyway, the work is done after some tough weeks :-)

Found binaries at OneDrive
  • Now two players can play the game, big improvement
  • Now when a coin is taken it executes a different particle
  • Now levels starts differently
  • Item cross code improved
  • Sprite.AttachedSprite code improved
  • New emerge particle
  • Now Focus element blinks
  • New FadeIn() styles
  • New HUD layout
  • Keys code is now handled directly in the inventory class
  • Now checkpoints are handled in the player class
  • Camera now needs to cover correctly all situations (when one hero dies and checkpoint cannot be covered by camera when in two players, etc)
  • Now doors still closed when taking the key and can only be opened by the owner of the key
  • When in two players, if one player looses of lives, then he releases all inventory so that the other player can take it
  • When in two players, if one player looses of lives and the other player has already entered the door, then the level finishes
  • Input reading code optimized
  • Now Fight, Shop and Inventory can only be used by the player that activate it
  • Shop/Inventory/Items code improved
  • Fight changed a bit
  • New heart item
  • New class TPlayers
  • New extra TPresent
  • New EntityType Magma
  • Scepter is no longer spawned in Lava
  • If hero looses the Rune Fight he also looses his coins
  • Now when finishing level, camera focus and zoom on Door
  • Now aspect ratio can be selected (4:3, 19:9, 16:10), so game should fit properly with all resolutions
  • Camera Lerp now also takes into account Z
  • Drawing air moved from hero to HUD
  • Now heroes are able to push many blocks in a row either vertical or horizontal
  • Some interfaces were not set to nil on destroy

  • Doing a render to target and losing the surfaces does not work, it raises an AV, why?!
  • Sleep properties in Particles now talk about milliseconds rather than steps
  • Lightmaps now also interpolate alpha channel
  • Some internal array improvements (aligned to next power of two)
  • Surface.Blur() quality improved
  • TArrayEx<T> improved
  • Now the 2d engine is completely dine in 3d, so that one can freely play with the camera
  • Fonts performance improved
  • New TCamera2D.Rotate()
  • Shadow silhouette improved (a bit of blur applied)
  • New TMenu.Find() in order to find menu items and optionally be able to modify them
  • New events for particles OnBefore/OnAfter Create/Tick
  • gamepad set to DISCL_NONEXCLUSIVE

New aspect ratio option)

 HBF now is accompanied by his partner ABB (say what?)

Camera zoom out to fit both players (until a certain point)

Saturday, March 11, 2017

HBF now in 64 bits!

I had a silly bug (typical one that works on WIN32 and does not in WIN64):

    FillChar(d3ddm, SizeOf(d3ddm), 0);  <-- this line didn't exists
    if Failed(FD3D.GetAdapterDisplayMode(D3DADAPTER_DEFAULT, d3ddm)) then
      raise Exception.Create('Error retrieving display modes');

    FD3Dpp.BackBufferFormat := d3ddm.Format;

So now there is a 64 bits version, I guess only math is faster, but this would be only noticeable when lots of  particles are rendered, but let's see..

Found binaries at OneDrive

Anyway, I also was able to change the following:

  • Now HBF also comes in 64 bits flavour
  • Now Diamond emits light
  • As usual some minor map changes...
  • Some new blurred backgrounds
  • ell/Boom/Chest/Fires/Lava/Mine/Planet are now glowed
  • Liquid splash is now done with particles
  • Enemies won't discover anything
  • New toxic particles
  • New excited particles
  • New particles when Hover is excited
  • Magnet also attracts Keys and Scepter
  • New sound failure.wav
  • Gatashi's laser when collides draw some particles
  • Now all mechanic enemies can be excited
  • Now when correcting gravities, moving platforms are take it into account
  • New worm, fits better in the game
  • New bell and shoes, more retro
  • Planet changed
  • Ice floor is now properly applied when gravity is up
  • Snowball now also stops fire
  • Static sprites do not longer correct gravity orientation
  • New warp based on particles
  • New spark based on particles
  • New Achievement "finish labyrinth blinded"
  • Main menu does some new effects
  • Ending now is a bit different (guess what!)

  • Multiplication texture error fixed (not happy about it)
  • Sprite hash for buffers now takes into account shadows
  • New concept TBufferHelper, in order to handle the buffer easier and avoid some double links
  • Removed effects and filters from surfaces (makes no sense, sprites dictate the behaviour)
  • Added surface filter to Materials
  • Fixed massive bug in Move32() POP ESI rather than POP EDI
  • D3D buffer preparation improved (VertexType is now precalculated)
  • Now TFloat is double when in 64 bits
  • New Particle emitter Movement type
  • Stream buffer when decompressing changed from 16kb to 64kb
  • Finally DirectX works in 64 bits
  • New TSurface.ExtractPoints()
  • New TParticles First()/Last()
  • Now particles are able to do formations based on a bitmap

Thursday, February 16, 2017

ChessKISS still alive

ChessKISS won two minor leagues, I'm very proud of this little creature :-)

Nothing spectacular, but hey..., I think soon I will try to create a new version, let's see

Found binary at OneDrive


Final Standings

39.0 - ChessKiss 1.7c 64-bit
36.0 - Dorpsgek Cosmopolitan 2 64-bit
30.5 - Isa 1.9.51 64-bit
29.0 - Obender 03.2016 64-bit
25.5 - Blitzkrieg rev337 64-bit
22.5 - Barbarossa 0.4.0 DJ 64-bit
21.5 - Cinnamon 2.0 64-bit
20.0 - BigLion 2.23x


Final Standings

19.0 - ChessKiss 1.7c 64-bit
19.0 - Obender 03.2016 64-bit
15.5 - Blitzkrieg rev337 64-bit
15.0 - RamJet 0.13
14.5 - NGplay 9.86 64-bit
14.5 - Napoleon 1.6.0b 64-bit
13.5 - Isa 1.9.51 64-bit
13.5 - Soldat III 0.178 64-bit
13.0 - Cinnamon 2.0 64-bit
10.5 - BigLion 2.23x
10.5 - Ecce 1.0 64-bit
8.5 - Abbess 2016.11.12
8.0 - Smash 1.0 3 64-bit

When performance matters

First entry of the year, one month and half later... , found binaries at OneDrive

I've been focus this past two months on improving the performance, in some screens mixing many elements, enemies, particles, lasers, liquids and moving backgrounds was affecting the performance, so I did what I love, to dig into the code and start measuring and comparing, I'm quite happy with the results, now I can throw many particles here and there that performance is not affected.

I did focus on DirectX buffers: hash created only when needed, buffers only sorted when needed, tailor-made drawing triangle functions, RGB to int conversions.

Surfaces are now generated faster when they are in 32 bits.

Also the new TFastPool<T> used in particles it excels, and indexed array for fast access with a pool mechanism in the same structure (maybe I will explained in another post)

What's new:

Clear camera also clear perturbation values
New StartSize/EndSize particle properties, autoSize particle removed
Camera constructor does not longer sets the size in the constructor
All primitives now use InView() to check whether this primitive has to be rendered or not
Line with thickness is now done properly with perpendicular vectors
Now GlowLine() uses a line with thickness
Now particles have X and Y radius
Fixed some Z issues in primitives Line() and Triangle()
New TScreen.WaitBehaviour, buffers can be only resorted when creating new buffers
General improvement in the hash keys of the maps
New TLayer.FindProperty()
Glow rendering improved
Particles now can have a trail
New TMath.CircleInRectangle(): bool
TScreen.DrawSurface() fully improved
Particles.Gravity is now a vector
TScreen.Circles() now has a solid parameter
TRGB.Multiply() & Add() improved
New TRGB.ToInt32()
TScreen.TexCol_Triangle() improved
TVectorEx non operators improved
Particle Editor/Engine vastly improved
New TRGB.AsString()
New TPriorityQueue<T>
New TScreen.CircleGlow()
New TScreen.LineGlow()
New TVectorEx.AsString()
Particles can have Attractors
More triangle buffer optimizations
Added BigFile to Particles
New TFastPool<T>
New TParticleEmitter Sleep and SleepEvery properties
Now Particles uses TFastPool<TParticle2D>
Particles can be glowed
Alpha32 surface detection improved
Particles generated in Sphere fixed
All internal sin/cos calculations in particles are done in RAD so no conversion needed (extra multiplications)
Particle generator loop improved
Render buffer improved
Color performance in buffer improved for surfaces
Queue<T> improved
TPolygon.GetHash() improved
TScreen.FillSurface() improved
Surface cache improved
Sprites now maintain the hash of the buffers
Surface.AndMask() performance improved
Buffer hash generation had collisions (bad key)
Now particles work by time and not steps
Now TObjectEx implements IGroup
Added friction to particles
Some critical functions checks are executed only in debug mode
Particles now do some kind of occlusion via BB
New particles spread mode Expand
Now particles can take the form of shapes
Now Particles can have up to 8 different textures by default
An emitter can be inactive

Cables throws more sparks
Camera size is update when resolution is changed
In menu the text scroller is left/right
New ColorTile element
Fixed an issue when a throwable weapon landed on a moving platform
Now reverse Disintegration works 100%
Now there is a global Gravity
Now color tiles got a tail
Lasergrid was not shown properly
New Path helper to create entities following map attributes
New enemy Rotator
Shover is shown properly when gravity is up
New Achievement "burn the block!"
Hero input code moved to Hero class
Added moving tapes to some levels
New element Wheel (HL2?)
Now all entities might target a tile (by name) and do something
Lava melting ice code fixed
Now demos can also track input from attack and action
New item Wand
Hero does no longer breathe in lava
Some elements now are glowed
TGameSprite.IsUnderneathOf() improved
Game can now load particles from map and/or triggers
Beetle and Titan show sparks when colliding
Flame was not working properly
Background are no longer mandatory in each level
Handling of entities on top of tapes improved
Arrows emit particles when collide
Now boomerang returns when collides with an item
All particles effect are now read froma file
New fireworks with forms
Hero's dust when landing is now done with particles
Air bubbles is now done with particles
In game menus, input is reset to not interfere with hero input
Hero now is got a candle on dark screens
Some backgrounds are now blurred

Thursday, December 22, 2016

Last entry of the year, glowing...

I've been playing a bit with glows and ropes, the result in this new version, merry xmas!!!

Found binaries at OneDrive 

What's new?

  • Lava throws now go always outside the magma
  • Lava trail is made by particles 
  • Now hero can be idle but facing left or right
  • Equipment upgrades are now activated by default
  • New triggers AddItem() and Deposit() and Concatenate()
  • Item is removed from Inventory just after execution (if applies) and not when has finished
  • New Item Shovel 
  • Coin is no longer Static
  • Focus is now centered properly
  • Now shop is shown differently, also some items are no longer available...
  • Liquid was sounding even when height was zero
  • Extras search improved
  • Items can yield coins 
  • New achievement "Full Equipment"
  • New achievement "Find the Soul of Ginkgo"
  • New achievement "Blue Green Red"
  • New achievement "Destroy the Balls"
  • Some achievements removed 
  • Better achievement visuals
  • Nuclear explosion from Bomb fixed (it was also killing the own explosions)
  • Hover get excited with lava or electricity 
  • Items.pas split into different files
  • Hero refresh the equipment at the beginning of every level
  • Hero steps back when pushed with an arrow and is having a shield
  • Added in some levels a new layer in front of hero (just eye candy)
  • Game over state is not set immediately after dying but after fading is finished
  • Now all entities can do a monologue 
  • New Rope element 
  • New lamp style
  • Cables can excite hovers
  • Fixed small issues when contacting platforms
  • When Hero crushes is got a new sound 
  • When Hero is not facing then it cannot attack 
  • Inventory screen easier to understand
  • Sound system now uses a dictionary rather that an array, also direct access to sounds are avoided since the sound system might desired to free a non used sound, therefore creating an AV
  • Spotlight now can be killed
  • Scores were not inserted properly
  • Now property TGameSprite.IsSlow
  • Remove TileSetFromSolid stuff in sprite factory, it was redundant
  • Rays collision element adjusted
  • Menu font now does some transparency
  • Rope are no longer simulated with bezier curves but with newton's physics 
  • New Volcano element  (experimental)
  • Menu preparation logic moved from game to menu screen
  • Sky stars are now random per game 
  • Snowball now also freezes ceiling (when gravity is up)
  • Sprites can be glowed
  • New labyrinth aspect
  • Exit menu, shop and inventory screens got a sound when moving cursors

  • Buffer hash is also constructed with Alpha
  • Fixed an error with particles alpha when using primitives
  • Particles alpha handling improved as rgba
  • Negativing TVectorEx was totally wrong!
  • Camera zoom is now taken into account
  • New style Inverse in particles 
  • New TSurface.ExtractAlpha() and Glow()
  • Bezier curves do not longer creates a result class per calculation but rathern reuse a global list

Sunday, November 6, 2016


Is quite funny to mentally visualize an item and then trying to find an use and a fit in the game

Found binaries at OneDrive

  • Big enemies now have achievements
  • Joy reading improved a bit
  • Boomerang will not get stuck in a wall
  • Many new extras like: potion, bell, magnet, ancient
  • Many new achievements like: "do magic on a key"
  • Now menu shows % of achievements
  • Some graphics changed
  • Lava eruption do not longer splash in the bottom of lava
  • Highscores fixed
  • Now there is only one key with Key property to select the type of key
  • Screen code cleaned
  • GameSprite new properties, DieText, SpawnItem and SpawnClass
  • TSpawner new property WaitingTime
  • New class TItemResolver, it helps creating items and entities when breaking walls
  • New THero.WeaponInUse()
  • All checkpoints are now in layer 2
  • Now FadeIn()/FadeOut() can be used properly in triggers
  • New enemy Triangle
  • Beetle now jumps when close to an edge
  • Now game has scoring
  • Fixed memory leak with ingame screens
  • Weapons also kill chandeliers
  • New TBouncingEnemy
  • Fixed an issue were a player could take infinite flying coins exiting/entering the levels continuously
  • Fixed an issue were a player could avoid having one less live when dying if level was exited immediately
  • New candle
  • Terminal show different scripts
  • Kurkani fixed
  • Fixed an issue replaying previous music

  • New Sprite.Locked property
  • TPolygon.GetHash() performance boost
  • Now screen buffers and sorted buffers are mixed into one unique queue
  • New TSprite.ClearTimers()
  • Fixed an issue when rotating the screen quad
  • Buffer rendering improved for some fix situations (like sprites...)

Sunday, October 16, 2016


 Every time I implement a new thing lots of ideas come to my mind, like with inventory, many new things were changed thanks to this new feature.

Found binaries at OneDrive

  • New inventory screen that can be accessed via return key or Y gamepad
  • Equipment is set via RTTI
  • Equipment code improved
  • New unit Items
  • Now Hero can have extras, like torch, horn, map, etc...
  • Screen exiting code improved
  • Coins now have a quantity property (default is 1)
  • Hero can wear an armor
  • New options for Continuous jumping entities like force and decay
  • New TJumpingCoin entity
  • New extras: Map, Bomb, Clock, Parasol, Horn, etc
  • Now Minimap works in any level
  • New item Double Shoes...
  • Coin classes renamed
  • Crepuscule lights move a bit...
  • New NPC property Thanks, be kind...
  • New chest element
  • Hidden levels are shown in main menu (if reached)
  • New property Gamesprite.AutoCenter
  • Finally all classes are created based on names (via RTTI)
  • HUD shows Runes in a frame
  • New Tucan bird
  • New action button, so that hero can use weapons
  • Some new graphics ...
  • Extra life shows a different graphics
  • Inventory is rendered in the HUD
  • Now inventory can have more than one unit of an item
  • Some changes in the expirable items
  • Post can have codified messages
  • New element Sparks
  • Bird chances reduced
  • New music achievement
  • NPC now properly says "a" or "an"
  • Princess now will be in a cage
  • New weapons...
  • Slope collision fixed
  • Magic?!
  • Fixed some bugs with collisions and no gravity elements (since it was not used...)
  • New method IInventory.FindByClass()
  • New achievements
  • Highscores now shows reached level
  • More versatile inventory
  • Fixed memory leak in shop screen
  • GameSprite IsMoving() improved
  • Many code lines "A mod B" changed to "A and B" when possible
  • Cadency now always works in milliseconds
  • Weapons volume is adapted to the distance to hero
  • Since new Windows 10 anniversary update game didn't restore once the focus was lost, weird but fixed
  • Huge performance boost in the creation of the object by name, by simply creating the context once and not on every call
  • Now Shop open/closes door
  • Jumping coins when created in the air do not initially jump
  • Updated to latest BASS library
  • NPC can have monologues...
  • Timer was started on a wrong event
  • New Terminal element
  • New achievements...
  • Game shows a menu when pressing escape or joy start
  • Extras can also yield coins

  • New T2DParticles properties AutoAngle and Elasticity
  • When a surface is destroyed and then the buffer, the search is faster
  • New helpers in TInputKeys.IsButton()
  • FFont.Render() now returns a boolean indicating whether it was painted or not
  • Laser ending was drawing even when no segments were set
  • Added thickness in drawer.Box()

The inventory

Weapons and Shields...

Thursday, September 15, 2016

Hero goes shopping

I always love games that allow you to buy items, games like wonder boy in monster land or black tiger, so this is my little tribute...

  IShopItem = interface
    function GetCost: integer;
    function GetDescription: string;
    function GetId: string;
    function GetType: string;
    function GetLevel: integer;
    function GetProperties: IMemVar;

  IShop = interface
    function Count: integer;
    function Exists(const aItem: string): boolean;
    function Enter(aInventory: IInventory): boolean;
    function Find(const aItem: string): IShopItem;
    function GetCategories: TList<string>;
    function GetItems(const aCategory: string): TList<string>;
    function Purchase(const aItem: string; aInventory: IInventory): boolean;
    procedure Remove(const aItem: string);

Found binaries at OneDrive

  • New Enemy Octopus
  • NPC talk is more accurate
  • Doors now can be hidden
  • All entities can have a Hint
  • Adding a shop
  • New inventory class
  • Now taken coins are shown and not left coins
  • When in finish screen, last level is not shown
  • New music when shopping
  • New element cauldron
  • When hero got a shield it can stop arrows
  • Render screens code refactored
  • NPC can yield coins
  • Hero can attack if proper item is owned (sword, axe and knive)
  • Enemy energy is now used
  • Now shop offers boots! (faster walk, jumping, slippery...)
  • Screen Prepare() method more handy
  • Blocks can contain hidden coins
  • New element Idol
  • GameServices.GetHero returns now IHero
  • Hero's shield is affected by arrows depending on its level  (pushed backwards)
  • Enemies killed with a weapon spawns a coin
  • Shopping menu slowly improved
  • During the same game, already taken coins do not appear again when revisiting a level

  • New TMasterDetail<M, D> class
  • Some functions changed parameters of type TDummySprite to ISprite
  • TLevels simplified
  • New TObjectHelper.CreateByName(), it creates any kind of class by name, very handy for the inventory

Hero with his sword and shield after purchasing them in the futuristic shop :-)

Monday, August 8, 2016

Say hello to Non Player Characters

In summer is not easy to find the necessary inspiration to tackle this project, but at the end I found interesting to introduce the so called NPC in the game. They are implemented in an easy way:

  INPC = interface
    function GetItems: string;
    function GetNeeded: string;
    function GetAchievement: string;
    function GetDelay: cardinal;
    function IsDeal(aInventory: IMemVar): boolean;
    function Interact(aInventory: IMemVar): TNPCResult;
    procedure StopWalking;
    function Talk(out aText: string): boolean;

 Just chatting, expecting some items and give new items..., nothing fancy

Found binaries at OneDrive

  • Minimap also prints teleport, enemies and doors
  • New class TDead for handling disintegrate effects
  • Blood has more colors in the same range
  • Door can take you to specific levels
  • Water can flow to already existing reservoir
  • New level Asphyxia!
  • Game now can have more than one door, so keys are related to door groups
  • Now doors can be upside-down
  • Better handling of door keys
  • Some pools are now based in lava
  • Liquid now have texture, Thrownrate, Sound and SplashCadency properties
  • class TSpawner improved
  • Lava can do ice heating
  • Quake is now done with camera
  • Birds spawning code improved
  • TDust now has orientation  (horizontal/vertical)
  • New TLiquid.IsResetable()
  • New bee (replacing bird...)
  • All Direction stuff removed, it was useless
  • Deadly liquid does not sound like water anymore
  • New class TFloater, barrel inherits from it
  • New element Boat, inherits from TFloater
  • Waterfalls streams work 100% now
  • New Achievement regarding waterfalls
  • Adding NPC
  • Now game shows inventory
  • New achievement related with NPC (talk to them...)
  • Menu option continue on removed, now when entering a level one can freely choose another level (if reached of course)
  • Optimizer now can load from multiple folders

  • Main engine render loop finally done in a proper way
  • Particles now have friction
  • New default buffer timeout is infinite
  • Triggers can be linked to other triggers, so until related trigger is not executed current one cannot be executed
  • Liquid might have textures (used for lava)
  • Fonts rendering improved
  • Fixed an error with buffer size increments
  • Liquid now has thickness
  • Liquid now is got some optimization when big areas
  • Particles now have emission type (continuous, once)
  • TLaser now inherits from TDummySprite
  • Trying to add some noise to the laser
  • Fixed some offset issues with some primitives
  • New TSpriteEngine.Find(name)
  • Now Triggers can target any entity that implement IExecutor
  • Liquid edges are shown properly
  • All sprites now can have texture offsets
  • Sprites can now also load from big File
  • Laser can now have a texture assigned
  • New utils.fmod (float modulo)

New secret and hidden level!

Old man giving me something...

Saturday, May 7, 2016

Fluids flowing

Time to post!, now that particles are used and abused, then I was playing a bit with liquids

Found binaries at OneDrive

What's new since the last update?

  • Dust and starfield are no longer split into render/tick, so looping twice is avoided
  • When hero dies in lava, particles are shown in a different color
  • Fireworks done with particles
  • Many Trunc() and Round() removed
  • Scepter does not appear in the same position as in the previous iteration
  • Replaced all possible TGraphicsDriver.Instance by new interfaces from IGameServices
  • Waterfalls are always fully developed since the very first frame
  • Ending changed a bit...
  • Runes class improved
  • Shunenbukaidesu improved
  • Since blood was everywhere now it got its own class
  • In final enemies energy is shown centered and with alpha
  • Kurkani also disintegrates and bleeds
  • Fireworks are now nicer (I guess...)
  • Platforms handling code moved from game to sprites
  • New elements AirBubble, Hit, LavaSplash  and Spark
  • New animation for scepter
  • New pickup Minimap
  • New explosion sprites sheet
  • When water finds a hole it flows
  • Barrel movement improved
  • Some name changes in levels
  • Sprites have now X & Y also as int
  • Particles now can have many emitters
  • Particles now have autozoom
  • New particle visible property
  • Now when screen buffer is overflow then it is skipped (avoiding AV)
  • Improved sleeping code
  • Surfaces can have gamma
  • TGraphicsDriver.Triangle() was not drawing properly...
  • Improved how sprites internally do Render() & Tick()
  • Internal list in SpriteEngine changed from TList<T> to TLinkedList<T>
  • Handled platforms in some cases were removed from list incorrectly
  • New animation property wait, used to change the cadency of the first frame (used in sceptor)
  • Camera2d adding zoom functionality... (WIP)

Friday, March 25, 2016

Particles everywhere...

Since 2d particles engine is now fast enough then I was happy playing around, the outcome is that  some parts now are based on particles.

Found binaries at OneDrive

  • New element Dust that can be propagated in Sphere and Cube
  • Dust is not rendered when parent is not painted
  • Starfield is not rendered when parent is not painted
  • Smoke in Ventilator looks better
  • Crepuscule, Candle, Lamp and Focus gets dust
  • Some more animations in background tiles (ice levels)
  • Teleports got some particles
  • When hero was entering a teleport and gravity was changed hero was not behaving properly
  • Now platforms might attach a FireWheel
  • if bird was locked by a web it was still using the bezier path
  • EffectDispatcher is less memory hunter
  • Waterfall is done now with particles
  • Snow is done with particles
  • New ice explosion with particles
  • Now rain is also done with particles
  • New magma particles effect (used in Lava Love)
  • Some map changes
  • Mirror was static..., cannot be otherwise laser would not bounce
  • Eye code improved a bit
  • Hero does no longer set the game state to gameover, that might caused AV!
  • New element Cortain
  • New bar for Gatashi live
  • New bar for oxygen
  • Gatashi disintegrates when dying
  • Horus makes sparks
  • Rain now uses wind
  • Fixed a weird glitch were hero could jump when graviting
  • HUD shows coins left in different way
  • The static class SpriteAttribute was not freed
  • The cloud sprite from menu was not freed

  • Fixed memory leak when surfaces were not cached
  • TParticle2D improved
  • TSurface.Noise() improved
  • Screen buffers aging code improved
  • Configuration .ini files can have any published property from sprites
  • New TObjectHelper.SetProperty(name, value)
  • Particles now use a linked list + dictionary, for insert + delete + iterate fits better than a simple list
  • Dictionary from Pool<T> removed, it was not really needed (consumer has to return used objects before clearing the pool)
  • New TLinkedList.DeleteCurrent()
  • Particle2d has more properties
  • Particles internally use now a Pool<T>
  • TPool<T> now internally uses a Linkedlist rather than two simple lists
  • Particle engine improved
  • New Events.AddTimer()
  • New sprite.GetAngleFromDir()
  • Minor cleaning in sprites
  • 2d particles improved
  • TSurface minor improvements
  • Shadow surface was not freed when parent surface was not Cached
  • The polygon created when rendering water was not freed
  • The polygons in TScene3d were not freed properly
  • New TSimpleLinkedList<T>
  • Collisions are now based on CRC and not artificial key

Sunday, February 28, 2016

First entry of 2016, it was about time...

Two months without updating the blog does not mean not doing anything..., here we go!

Found binaries at OneDrive


  • New TSpriteEngine.SpritesAt<T: class>(const aRect: TRect; aCallback: TSpriteCallback<T>): boolean; very helpful
  • Removed speed stuff from Camera2D
  • New TDummySprite.IsEmpty() true when surface is not created yet
  • New collision method with callback for detailed info
  • Added some optimizations to the collision system
  • New camera.Lerp() and CameraHelper ideas
  • New property TDummySprite.TickCadency (tick and render calls can now be different)
  • New CameraLerp helper
  • New TCamera2D SetWindow() and InsideWindow(), useful for camera lerp 
  • Maps now can indicate a custom colorkey 
  • Tiles outside the camera view are also update (not rendered)
  • Laser now can have zoom
  • New property TSprite.AlphaSpeed 
  • When a sprite is attached to another one, horizontal and vertical speeds are set to zero
  • TBigFile file search functions improved
  • Now .ani files can setup the bounding boxes (rectangle for collisions)
  • New TSurface.SetBB() to manually define it
  • New TRGB.Blend()
  • TAnimationSprite refactored, it was quite a mess...
  • Fixed a bug when saving a layer with assigned colorkey 
  • Debug property removed from SpriteEngine  and Sprite 
  • TLayer, when map has no width or no height it does not do anything
  • 2d particle engine finished
  • New TSurface.Desintegrate()
  • New TSurface.CreateChannels()
  • Nasty bug where textures already freed were used in screen buffers
  • Now Rectangles can have an angle 
  • Now Shadow property is assigned only when Engine is assigned
  • Static sprites do not reach collision matrix
  • Collision grid can now be shared among different engines
  • If a leyer, if an animation has only one frame and cell tile has changed then animation is updated with the new info
  • Z selection bar from TMenu is now taken from Z Font 


  • Heavy use of new function SpritesAt<T>()
  • Main menu is now easier to use
  • When beetle touches a mechanic enemy it changes its direction
  • Long silly bug, I was not counting rotating coins...
  • Music after pause could not be not recovered
  • Ticks also count when game is locked (not paused)
  • All screens can be skipped with jump Key
  • When game is paused messages cannot be skipped
  • Finally shadows are cast properly when no tiles behind
  • Coins and key info now is back to main game structure
  • Time achievement changed from 15 to 20 minutes
  • New concave collisions (experimental)
  • Fixed an issue with the collision of the balls
  • Improved triggering code
  • UFO has now a different texture
  • Side tiles do not cast shadows (avoids ugly shadows...)
  • When hero lands there is a quake 
  • New tiles arriving! :-) (big thanks goes to
  • Quake new parameter Intensity
  • Gatashi laser now uses the zoom
  • Weird enemy now properly works at any speed 
  • New element fly 
  • Now arrows when hitting mechanic or indestructible entities it will fall like it does when hitting arrows
  • Now arrows get nailed to entities when they are hit (and normal)
  • Steps in catchers can now be configured
  • New TGameSprite.Ready() to make easy "one time" calls (executed after all published properties are parsed)
  • Post do not way for input
  • Web and wheel textures changed
  • Bubbles rotate a bit while moving up
  • Bomb texture changed
  • New enemy Fire Skeleton (testing it...)
  • Fixed an issue when on platform and gravity changes
  • New hero texture (experiment...)
  • Game does not longer needs file
  • Now Horus looks different
  • The first level is no longer shown in the continue option menu
  • Foot steps on platforms and tiles is now calculated on the fly analyzing the bitmap
  • Weird texture looks different
  • New enemy rat
  • New enemy serpent
  • Now after a fight is win then hero gets immunity
  • Triggers can now make visible/invisible the layers and background
  • Door is got a starfield
  • Bubbles can catch mechanical enemies 
  • A level can have now many waterfalls
  • The music volume in the settings was ignored
  • When Gatashi throws its laser it creates a quake 
  • Gatashi stays one second without moving at the beginning of the level
  • Debug property added to TGameSprite 
  • Hero dies in a totally new way (I believe much cooler)
  • Hero dying code improved
  • New enemy Penguin 
  • Finally the game creates all entities via rtti and attributes (hooray!)
  • New element troya horse
  • Bat does not longer gets stick in walls
  • When hero lands on a platform the quake intensity depends on impulse
  • Now Gatashi also bleeds
  • Gravity can also affect pushable objects
  • Minor map changes
  • Doors can now be fake, beware!
  • Now ending is done in a proper way
  • Fixed an issue when in TSea splash was too heavy 
  • Scepter replaces book 
  • New blood textures
  • New enemy robot 
  • New element Rainbow 
  • Hud objects do not cast shadows
  • Some Z priorities changed
  • Fixed a bug with achievement "all runes"
  • New element Bell and achievement
  • When Gatashi heats an ice cube it changes to another tile
  • When HBF dies drowned particles are blue
  • Entities that emit light in darkness are properly tagged
  • Flash effect now takes a color as parameter
  • More background tiles
  • Focus can now point up and down 
  • Droid laser now also shakes
  • Lava kill spider web