@Resourceful : Thank you for your reply, and for "back in the day", the support you gave by buying it.
Here is a new screenshot and video
Light effects for 2D layers are not up and running. I must do minor changes concerning the color of the light but you can see in that capture
This video show you the run of the latest version of PluginKIT for AppGameKit.
Due to the fact that with ShareX recording (+ compressing) video, the frame rate drop down, I used my smartphone for this video.
You can see light effects runnings.
They are pre-calculated at light creation (using attachment layer/tiles informations with normal map & 8 bits color masking) to create effects.
When running light is then only an image with alpha.
I must add the lights styles (flash, static, flame, etc.) to give a more impressing results and, update a bit the light coloration effect on the objects (seein on statues and walls there).
You have the combination of various light effects like:
- Global brightness effect (the 1st and 4th ones)
- Normal mapping use ( 3rd and 4th ones)
- Shadow casting use (2nd, 3rd and 4th ones).
Just to show you what makes this demo, you have the demo source code here :
`
` PluginKIT Ver 2.1 for AppGameKIT [2020.03.23]
`===================================================================
` XFONT Demonstration © Frédéric Cordier 2019-2020
`===================================================================
` 2D XFont Scrolling Demonstration
`
` This small sample will show you how to use an XFont to create a nice sinus scroller technical demonstration
`-------------------------------------------------------------------------------------------
#option_explicit
// #renderer "Advanced" // -> AppGameStudio only [Enable Vulkan Engine]
// 1. Insert SETUPS files
#insert "dbEmulation_v1/dbSetup.agc"
#insert "eXtends_v2/XTv2_Setup.agc"
#insert "2DPluginKIT_v2/2DPKv2_Setup.agc"
// 2. Insert special JAVA emulated methods
#include "javaEmulation_v1/java_String.agc"
// 3. Add some DarkBASIC Professional emulated methods
#include "dbEmulation_v1/dbBasic3D.agc"
#include "dbEmulation_v1/dbImage.agc"
#include "dbEmulation_v1/dbText.agc"
// 4. Now add'in all the eXtends Methods
#include "eXtends_v2/XTv2_Billboards3D.agc"
#include "eXtends_v2/XTv2_HighScores.agc"
#include "eXtends_v2/XTv2_ImageFX.agc"
#include "eXtends_v2/XTv2_Maths3D.agc"
#include "eXtends_v2/XTv2_Memblocks.agc"
#include "eXtends_v2/XTv2_Particles3D.agc"
#include "eXtends_v2/XTv2_RealTimeSkySystem.agc"
#include "eXtends_v2/XTv2_RestoreData.agc"
#include "eXtends_v2/XTv2_VirtualsLights.agc"
#include "eXtends_v2/XTv2_XBitmaps.agc"
#include "eXtends_v2/XTv2_XFonts.agc"
#include "eXtends_v2/XTv2_XGadgets.agc"
#include "eXtends_v2/XTv2_XWindows.agc"
// 5. And finally add'in all the 2DPluginKIT Methods.
#include "2DPluginKIT_v2/2DPKv2_System.agc"
#include "2DPluginKIT_v2/2DPKv2_Core.agc"
#include "2DPluginKIT_v2/2DPKv2_BlitterObjects.agc"
#include "2DPluginKIT_v2/2DPKv2_ImageCollection.agc"
#include "2DPluginKIT_v2/2DPKv2_Layers.agc"
#include "2DPluginKIT_v2/2DPKv2_Maths.agc"
#include "2DPluginKIT_v2/2DPKv2_SpritesCollisions.agc"
#include "2DPluginKIT_v2/2DPKv2_TilesVer4.agc"
#include "2DPluginKIT_v2/2DPKv2_VirtualLights.agc"
#include "2DPluginKIT_v2/2DPKv2_Animations.agc"
#include "2DPluginKIT_v2/2DPKv2_Particles.agc"
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "PluginKIT [ 2DPluginKIT + eXtends ] for AppGameKIT Alpha 0.9 - 2020.03.30" )
SetWindowSize( 640, 480, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 640, 480 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // 60fps on computer
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
// Load the tiles images each as separate image.
PKSetDefaultTileSizes( 32, 32 )
PKSetDefaultTileTransparency( 1 )
// Create the map
` Prepare Graphics
Global FirstTileImageID As Integer = -1
Global LastTileImageID As Integer = -1
PrepareGRAPHICS( "demo01gfx_v2.png" )
Global FirstTileID As Integer = -1
Global AnimFlames1 As Integer = -1
Global AnimFlames2 As Integer = -1
Global AnimFlames3 As Integer = -1
PrepareTILES()
Global BackgroundLayer As Integer
BackgroundLayer = PrepareLayer( 1, "Background" )
PKSetLayerUVMode( BackgroundLayer, 1, 0 )
PKSetLayerArea( BackgroundLayer, 0, 0, 640 + 32, 382 )
PKSetLayerScrollMode( BackgroundLayer, 0 )
Global CloudyLayer As Integer
CloudyLayer = PrepareLayer( 2, "Clouds" )
PKSetLayerUVMode( CloudyLayer, 1, 0 )
PKSetLayerScrollSpeedXY( CloudyLayer, 0.025, 0.0 )
PKSetLayerArea( CloudyLayer, 0, 0, 640 + 32, 192 )
PKSetLayerScrollMode( CloudyLayer, 0 )
Global MountainsLayer As Integer
MountainsLayer = PrepareLayer( 3, "Mountains" )
PKSetLayerUVMode( MountainsLayer, 1, 0 )
PKSetLayerArea( MountainsLayer, 0, 288, 640+32, 416 )
PKSetLayerScrollMode( MountainsLayer, 1 )
PKSetLayerScrollSpeedXY( MountainsLayer, 0.25, 0.0 )
Global TreesLayer As Integer
TreesLayer = PrepareLayer( 4, "Trees" )
PKSetLayerUVMode( TreesLayer, 1, 0 )
PKSetLayerArea( TreesLayer, 0, 336, 640+32, 448 )
PKSetLayerScrollMode( TreesLayer, 1 )
PKSetLayerScrollSpeedXY( TreesLayer, 0.5, 0.0 )
Global FrontLayer As Integer
FrontLayer = PrepareLayer( 5, "Front" )
PKSetLayerUVMode( FrontLayer, 1, 0 )
PKSetLayerCameraMODE( FrontLayer, 1 )
PKSetLayerArea( FrontLayer, 0, 0, 640 + 32, 480 )
PKSetGameLayer( FrontLayer )
Global Particle1 As Integer
Global Particle2 As Integer
Global Particle3 As Integer
Global Particle4 As Integer
Global Particle5 As Integer
Global Particle6 As Integer
Global Particle7 As Integer
PreparePARTICLES()
` Create layer lights
Global LightID1 As Integer
Global LightID2 As Integer
Global LightID3 As Integer
Global LightID4 As Integer
PrepareV2DLights()
/*
` Sync Mask 1
fptTemp As Integer = 0
dTimer As Integer = 0
ActualSPEED As Float = 1.0
XMove As Float : XPos As Float
dbInk( dbRgb( 255, 255, 255 ), dbRgb( 255, 255, 255 ) )
// NewImage As Integer : NewImage = CreateImageFromMemblock( GroupedTiles.MaskMBC )
// SaveImage( NewImage, "MackImage.png" )
*/
XPos As Float = 0.0
ImageID As Integer
ImageID = CreateImageFromMemblock( PKSetup.NMapBlock )
SaveImage( ImageID, "normalMappingBlock.png" )
DeleteImage( ImageID )
ImageID = XTCreateImageFromMemblock( PKSetup.MaskBlock )
SaveImage( ImageID, "MaskBlock.png" )
DeleteImage( ImageID )
do
ClearScreen()
dbSetCursor( 0, 0 )
dbPrint( "FPS=" + Str( ScreenFPS() ) )
UpKey As Integer : UpKey = GetRawKeyState( 38 )
DownKey As Integer : DownKey = GetRawKeyState( 40 )
LeftKey As Integer : LeftKey = GetRawKeyState( 39 )
RightKey As Integer : RightKey = getrawkeystate( 37 )
` Scroll the clouds
XPos = XPos - ( RightKey = TRUE ) + ( LeftKey = TRUE )
PKSetGameLayerScroll( XPos, 0 )
PKUpdateAnimations() // Update the player animation
PKTraceAllLayers() // Draw all layers
dbRefresh() // Call other refresh (dbPrint)
Sync() // Refresh screen
loop
End
// Prepare all layers depending on their data stored at the end of the source code.
Function PrepareLAYER( LayerCode As Integer, LayerName As String )
LayerXSize As Integer : LayerYSize As Integer
XLoop As Integer : YLoop As Integer
LayerDATA As Integer
finalLayerID As Integer
Select LayerCode
Case 1 : Restore( "demo01_backgroundpart" ): EndCase
Case 2 : Restore( "demo01_cloudypart" ): EndCase
Case 3 : Restore( "demo01_mountainpart" ): EndCase
Case 4 : Restore( "demo01_treespart" ): EndCase
Case 5 : Restore( "demo01_decorationpart" ): EndCase
EndSelect
LayerXSize = ReadI() : LayerYSize = ReadI()
finalLayerID = PKCreateNewLayer( LayerName, LayerXSize, LayerYSize )
For YLoop = 0 To LayerYSize - 1
For XLoop = 0 To LayerXSize - 1
LayerDATA = ReadI()
PKSetLayerTile( finalLayerID, XLoop, YLoop, LayerDATA + FirstTileID )
Next XLoop
Next YLoop
EndFunction finalLayerID
// It's here that F2L system is created and images are pre-calculated
Function PrepareV2DLights()
LightID1 = PKAddVirtual2DLight( "Flame1", 80, 376, dbRgbA( 255, 255, 0 ), 80, 80, FrontLayer, FALSE, FALSE, TRUE )
PKSetVirtual2DLightAsStaticLight( LightID1 )
LightID2 = PKAddVirtual2DLight( "Flame2", 208+32, 376, dbRgbA( 96, 96, 192 ), 80, 75, FrontLayer, FALSE, TRUE, FALSE )
PKSetVirtual2DLightAsPulseLight( LightID2 )
LightID3 = PKAddVirtual2DLight( "Flame3", 368+32, 376, dbRgbA( 96, 192, 96 ), 80, 75, FrontLayer, TRUE, TRUE, FALSE )
PKSetVirtual2DLightAsFlashLight( LightID3 )
LightID4 = PKAddVirtual2DLight( "Flame4", 528+32, 382, dbRGBA( 255, 255, 255 ), 80, 75, FrontLayer, TRUE, TRUE, TRUE ) // Normal/Shadow/Bright
PKSetVirtual2DLightAsFlameLight( LightID4 )
EndFunction
Function PrepareGRAPHICS( FileIO As String )
XLoop As Integer : YLoop As Integer
NewImageID As Integer : NewTileID As Integer
If GetFileExists( FileIO ) = 1
imageID As Integer : imageID = LoadImage( FileIO )
// Message( "File " + FileIO + " Loaded as image #" + Str( imageID) )
For Yloop = 0 to GetImageHeight( imageID ) - 32 Step 32
For XLoop = 0 To GetImageWidth( imageID ) - 32 Step 32
// LoadSubImage( CurrentTile + 10, imageID, "IMG" + Str( CurrentTile ) )
newImageID = CopyImage( imageID, XLoop, YLoop, 32, 32 )
if FirstTileImageID = -1 then FirstTileImageID = newImageID // Push pointer for first TileID
if newImageID > LastTileImageID then LastTileImageID = newImageID // Push pointer for last TileID
Next XLoop
Next YLoop
Endif
EndFunction
// Create all tiles from the large picture.
Function PrepareTILES()
TileID As Integer
tLoop As Integer = -1
newTileID As Integer = -1
For tLoop = 0 to 135
newTileID = PKCreateTile( FirstTileImageID + tLoop, TRUE )
if FirstTileID = -1 then FirstTileID = newTileID
Next tLoop
// Ajout du normal mapping pour les tiles du château
PKSetTileNMap( FirstTileID + 82, FirstTileImageID + 114 )
PKSetTileNMap( FirstTileID + 83, FirstTileImageID + 115 )
PKSetTileNMap( FirstTileID + 90, FirstTileImageID + 122 )
PKSetTileNMap( FirstTileID + 91, FirstTileImageID + 123 )
PKSetTileNMap( FirstTileID + 98, FirstTileImageID + 116 )
PKSetTileNMap( FirstTileID + 99, FirstTileImageID + 117 )
PKSetTileNMap( FirstTileID + 106, FirstTileImageID + 124 )
PKSetTileNMap( FirstTileID + 107, FirstTileImageID + 125 )
// Ajout du normal mapping et du masque d'ombrage pour les tiles du flambeau
PKSetTileNMap( FirstTileID + 108, FirstTileImageID + 120 )
PKSetTileNMap( FirstTileID + 109, FirstTileImageID + 128 )
PKSetTileMask( FirstTileID + 108, FirstTileImageID + 121 )
PKSetTileMask( FirstTileID + 109, FirstTileImageID + 129 )
// Ajout du normal mapping pour les tiles de la statue
PKSetTileNMap( FirstTileID + 87, FirstTileImageID + 119 )
PKSetTileMask( FirstTileID + 87, FirstTileImageID + 112 )
PKSetTileNMap( FirstTileID + 95, FirstTileImageID + 127 )
PKSetTileMask( FirstTileID + 95, FirstTileImageID + 130 )
PKSetTileNMap( FirstTileID + 103, FirstTileImageID + 135 )
PKSetTileMask( FirstTileID + 103, FirstTileImageID + 131 )
// Ajout du normal mapping pour les tiles des arbustes.
PKSetTileNMap( FirstTileID + 94, FirstTileImageID + 126 )
PKSetTileNMap( FirstTileID + 100, FirstTileImageID + 132 )
PKSetTileNMap( FirstTileID + 101, FirstTileImageID + 133 )
PKSetTileNMap( FirstTileID + 102, FirstTileImageID + 134 )
// Mise en place des animations de flammes pour les 3 tiles composant les flames
AnimFlames1 = PKNewAnimation( "ANIM;0;1;2;3;4;5;6;7;24;25;26;27;28;29;30;31;" ) // Top of the flames tiles
PKSetAnimationToTile( AnimFlames1, FirstTileID )
PKSetAnimationSpeed( AnimFlames1, 48 )
PKSetAnimationFrameShift( AnimFlames1, FirstTileImageID )
PKPlayAnimation( AnimFlames1 )
PKLoopAnimation( AnimFlames1, TRUE )
AnimFlames2 = PKNewAnimation( "ANIM;8;9;10;11;12;13;14;15;32;33;34;35;36;37;38;39;" ) // Middle of the flames tiles
PKSetAnimationToTile( AnimFlames2, FirstTileID + 8 )
PKSetAnimationSpeed( AnimFlames2, 48 )
PKSetAnimationFrameShift( AnimFlames2, FirstTileImageID )
PKPlayAnimation( AnimFlames2 )
PKLoopAnimation( AnimFlames2, TRUE )
AnimFlames3 = PKNewAnimation( "ANIM;16;17;18;19;20;21;22;23;40;41;42;43;44;45;46;47;" ) // Bottom of the flames tiles
PKSetAnimationToTile( AnimFlames3, FirstTileID + 16 )
PKSetAnimationSpeed( AnimFlames3, 48 )
PKSetAnimationFrameShift( AnimFlames3, FirstTileImageID )
PKPlayAnimation( AnimFlames3 )
PKLoopAnimation( AnimFlames3, TRUE )
EndFunction
Function PreparePARTICLES()
// Flame particle 1
Particle1 = PKAddParticleEx2( 24, -1, 32, PKParticleType.Flames, 64, 16+256, 40, 200 )
PKAttachParticleToLayer( Particle1, FrontLayer )
// Flame particle 2
Particle2 = PKAddParticleEx2( 24, -1, 32, PKParticleType.Flames, 7*32, 16+256, 40, 200 )
PKAttachParticleToLayer( Particle2, FrontLayer )
// Flame particle 3
Particle3 = PKAddParticleEx2( 24, -1, 32, PKParticleType.Flames, 12*32, 16+256, 40, 200 )
PKAttachParticleToLayer( Particle3, FrontLayer )
// Flame particle 4
Particle4 = PKAddParticleEx2( 24, -1, 32, PKParticleType.Flames, 17*32, 16+256, 40, 200 )
PKAttachParticleToLayer( Particle4, FrontLayer )
// Rain particles
Particle5 = PKAddParticleEx2( 128, -1, 4, PKParticleType.Rain, 320, 222, 640, 444 )
PKAttachParticleToLayer( Particle5, FrontLayer )
// Rain drop particles on the frontlayer ground
Particle6 = PKAddParticleEx2( 48, -1, 12, PKParticleType.RainDrop, 320, 418, 640, 12 )
PKAttachParticleToLayer( Particle6, FrontLayer )
// Sparkles particles linked to the trees layer.
Particle7 = PKAddParticleEx2( 32, -1, 16, PKParticleType.Sparkles, 320, 32, 160, 64 )
PKAttachParticleToLayer( Particle7, TreesLayer )
EndFunction