Author Topic: PLUGIN: Direct3D v1.0 (Sprite and Theora video rendering) [2012-02-08]  (Read 13858 times)

Hello, fellow AGSers! It's been a while since I've done anything even remotely useful for the community, so here goes...

Since scotch hasn't been active for years now, I decided to remake the Theora plugin in order to fix some things that have been bothering me. (I hope he doesn't mind.) Well, as it turns out I went a bit further and also added the possibility to create Direct3D textures and render them. And since this plugin only supports the Direct3D driver (and 32bit colours), I've decided to megalomaniacally call this the Direct3D plugin.

Restrictions:
  • Games must be played with the Direct3D driver
  • Only 32 bit colours supported

Main features:
  • Play external Theora video files (with extremely simple obfuscation)
  • Create textures from AGS sprites
  • Create textures from external image files

Todo:
  • Transparency, tinting
  • Some kind of "free memory on room change" automation. (Because room_Leave is called before fade out, argh!)
  • ???

Manual/website

Download!

I made this plugin for my own needs so I really have no idea if anybody else finds it useful. If you do, feel free to post any comments, feature suggestions or bug reports.

It's not fully tested 'cause I'm a lazy sod. That's why it currently prints debug information into a debug.txt file. Send it to me if the plugin crashes your game or something weird happens. Also, no demo game available for now, sorry. There's a couple of examples in the manual, though.


--EDIT--

Source code now available!
« Last Edit: 03 Jan 2020, 20:02 by AJA »

Calin Leafshade

  • Long live King Cat!
    • I can help with making music
    • I can help with voice acting
    • Calin Leafshade worked on one or more games that won an AGS Award!
    •  
    • Calin Leafshade worked on one or more games that was nominated for an AGS Award!
+1 internet for the RenderStage param.

Knox

  • Storm Behind The Badge
Cool! Gonna test that out now :)


Pardon my ignorance, but what are some of the things one can do with "textures" within AGS?
--All that is necessary for evil to triumph is for good men to do nothing.

Well, the main thing is being able to rotate and scale them freely and smoothly.

For example, if you want something like a rotating wheel on your background, you can just make a D3D_Sprite out of an AGS sprite and render it onto the background, increasing rotation each frame. No need for an animating bg which takes up lots of memory, or a prerendered wheel animation, or a bunch of prerotated dynamic sprites which tend to look blocky and crappy.

Calin Leafshade

  • Long live King Cat!
    • I can help with making music
    • I can help with voice acting
    • Calin Leafshade worked on one or more games that won an AGS Award!
    •  
    • Calin Leafshade worked on one or more games that was nominated for an AGS Award!
It would be nice if you could specify the quad that the texture is rendered to, specifically so you could make it non-square, allowing for perspective deformation.



Good idea, I'll put it on my list!

It's gonna take a while before I can continue working on the next version, since I'm trying to get a game project into the development phase. But since that request is pretty easy to implement, I can make a minor update sooner if you need it. Just let me know.

None

    • None worked on one or more games that won an AGS Award!
    •  
    • None worked on one or more games that was nominated for an AGS Award!
 :-D Thanks for the nifty little plugin!

I've been playing with it since this morning, made a little 320 x 240 video in after-effects to make sure it was working.
The file is slightly large, but that's to keep the .ogg from being lossy. The test demonstrates the plugins ability to seamlessly loop a video.
And more importantly to me, I had to be sure I could get the gosh-darn thing to work before I started rendering out tons of video backgrounds! (laugh)

Here's the link, and again; Thanks.
http://www.charlescreations.com/d3dptest.zip


Please forgive me ignorance but how do I get the background video to constantly loop over? Which piece of code do I use and where?

Excellent plugin! :D

After you've opened the video just set video.isLooping to true.

Ah, I did use that code but put it BEFORE the video was actually loaded...DUH! Cheers AJA ;)

EDIT: I've actually just noticed that using this plugin seems to messup the Z-Order of my GUIs (particulartly the SSH's Description Module). If I've been playing a background video and progress to another room, the Z-Order of the Description Hotspot over the Inventory items falls BEHIND them.

However, if I go to that room WITHOUT first visiting the room with the background video, I have no issues with the Z-Order on the inventory.

Any ideas at all?
« Last Edit: 15 May 2012, 17:17 by DazJ »

First of all, that's weird. Second of all, that's really really weird.

Do the actual z-order values change? (Can you even access them in runtime?) I don't see how the plugin could screw that up without messing with AGS's internal stuff. But then again, I'm no DirectX expert, so who knows how badly I've messed things up. :-\

Yeah, it has me baffled too.

The Z-Orders aren't physically changed in the properties windows, no. I've even tried setting the Z-Orders in the script after the room changes but alas, it has no effect. Using the plugin seems to just render all Z-Order settings as void, no matter what they're set at.

I'm under the impression that the video itself could perhaps have it's own Z-Order? This isn't my thing so I'm probably wrong.

If I remove the plugin then hey-presto, everything works again so it seems to be down to the plugin, unfortunately :/

Does anyone else have any suggestions?

Has anybody any idea on why this is happening? I really want this plugin but might have to go without it :(

I'll try to replicate this over the weekend and see if I can find a way to fix it. Unfortunately there are also some other things to fix since a while back I managed to break the new version I'd been working on. 8-)

Oh dear lol. There's no rush - I can still keep plowing on in terms of coding and it still ultimately works, I just want it to be polished. It certainly is a baffler :/

Absolutely amazing plugin though! :D

I've fixed the Z-Order issue. For some stupid STUPID reason I'd copied two different variants of the Description Plugin code into both the GlobalScript AND a Room. One set to use Overlay and the other to use GUI. Of course, with Overlay, you can't set the Z-Order. Anyhow, the problem has been resolved. I just feel like a bloody fool now. I am so sincerely sorry for wasting any of your time.

Of course, this means that your plugin works flawlessly for me :)
« Last Edit: 19 May 2012, 18:14 by DazJ »

No problem, that's great news! :D Less work for me. :)

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on one or more games that won an AGS Award!
    •  
    • Cassiebsg worked on one or more games that was nominated for an AGS Award!
Hey

Soryy to dig up this old thread, but I was trying scotch theora plugin, which worked fine, until I run into the flipped frames bug... so thought I would try this one. Only AGS is giving me an error when trying to load it:

Quote
---------------------------
Adventure Game Studio
---------------------------
There was an error loading plugin 'ags_d3d.dll'.



Unable to load plugin 'ags_d3d.dll'. It may depend on another DLL that is missing.
---------------------------
OK   
---------------------------

Any ideas what that eventual DLL might be?
I'm using the latest AGS 3.4.0.13-Patch1.
There are those who believe that life here began out there...

According to Dependency Walker, this plugin requires D3DX9_43.DLL (part of some certain Direct3D 9 version).

Quickly searching for the name of this file I found this discussion: https://answers.microsoft.com/en-us/windows/forum/windows_7-gaming/system-error-the-program-cant-start-because/261e2bb5-2e75-e011-8dfc-68b599b31bf5


As a side note, that may be obvious but I think I'd note that using this plugin in your game will make it impossible to play your game on other platforms.