Nothing seems to be drawing on the screen, on my AGS script side i just run ParticleUpdate(int ForceX, int ForceY, int Transparency,int RoomWidth,int RoomHeight).This is 'replacement' code moved from AGS to the plugin, so the code itself works fine. Any thoughts on why it doesn't? I'm not sure I'm using the 'virtual screen' part correctly, but there's little to no examples, I could find for it. Apologies for the sequence of new posts every day.

What version of AGS are you using? Drawing to VirtualScreen did not work for Direct3D and OpenGL before AGS 3.4.1. It was also proven to work somewhat slower for non-software driver in 3.4.1 and later (depending on game resolution), because it's not an optimal way for these renderers.

Secondly, AFAIK you should not call plugin drawing to screen directly from AGS script, but instead connect to AGS drawing hook.

Since your ParticleUpdate function has both update and draw, and if you really must explicitly call update from the script, it should be split into Update/Draw parts. Update may be called from script, but Draw must be connected to the drawing event.

SetVirtualScreen only really works in Software mode. It replaces the drawing surface for all the following drawing in the engine. Direct3D and OpenGL drivers will never be able to use it since they don't draw to screen bitmap.

Normally plugins that want to draw something on screen call GetVirtualScreen instead to ask engine for a current stage surface (there are several stages, one for room, another for GUI and so on) and draw your own image to that. Then it will be inserted on AGS screen in between the stages (e.g. between room and GUI).

But if you want to read from what's already drawn on screen, this will generally work only in software mode. I cannot think of an easy way to make it work for hardware-accelerated renderers. Normally they should use shaders.

What it does is it draws sprites on the screen, altering their size, their position and their transparency.In the equivalent of the AGS script, every x loops a sprite is created, then parsing through all the existing particles (flagged with ACTIVE) it moves them based on a force (X and Y) and adjusts their size and transparency.Then clears the screen and on the next loop it repeats the same processt.

What it does is it draws sprites on the screen, altering their size, their position and their transparency.In the equivalent of the AGS script, every x loops a sprite is created, then parsing through all the existing particles (flagged with ACTIVE) it moves them based on a force (X and Y) and adjusts their size and transparency.Then clears the screen on the next loop, and redoes that.

Oh, so, you need to call GetVirtualScreen at the beginning of your drawing function. On software mode it will already contain everything drawn before that (like, the room and objects), but in D3D/OGL it will be a clean bitmap filled with transparent pixels (iirc).Also for compatibility, call GetBitmapDimensions to know the actual size of the virtual screen's bitmap, because it may not be equal to game screen size.

You may then call BlitSpriteTranslucent which does suitable drawing depending on the render mode (software/hardware) internally.

You did not answer about version of AGS, so I have to restate that this refers to AGS 3.4.1 (in earlier versions only software mode will work correctly).

Oh sorry, I made a mistake. You do not have to call GetVirtualScreen at all if you are using BlitSpriteTranslucent and similar functions, because these draw on virtual screen themselves.You only need to get virtual screen pointer if you do drawing with your custom functions which edit bitmap data directly.

Well, I keep telling that SetVirtualScreen does not work in D3D.Also, you first GetVirtualScreen and then set it back, that does not make any sense.

Anyway, this code won't work as you think it does, because in every stage the virtual screen may be a different bitmap. So you are not clearing same bitmap you were drawing to.On D3D the Virtual Screen is cleared automatically each time (at least supposed to).