Jibble

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

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!
Okay, guess I'll have to confine to having to compile and upload two versions of the game, one with video and one without.  :-\

Ps - I've now added some #define code, that Gurok suggested for this effect (creating 2 versions of the game)...
« Last Edit: 13 May 2017, 17:08 by Cassiebsg »
There are those who believe that life here began out there...

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
Here are the instructions I sent Cassie:

--

Make a new script file and put it at the top of your script list.
Put this in the header:

Code: [Select]
#define VIDEO_VERSION     
Change your code to
     
Code: [Select]
#ifdef VIDEO_VERSION
D3D_Video* video; // defined at the top of the script
#endif

function room_Load()
{
#ifdef VIDEO_VERSION
    // load the video code
#endif
#ifndef VIDEO_VERSION
    Display("Couldn't load the plugin");
#endif

Use #ifdef VIDEO_VERSION anywhere D3D_Video stuff is referenced.
When you want to make the non-video version, comment out the #define line.

--

I'm posting this for future people who stumble across this thread, in the hope it helps others with the problem CW outlined above.

In the past I wrote a feature which let you to configure stubs for plugin functions. I gave it out for testing, but no one seemed to be interested, and I later forgot about it myself thus it never ended up into the official version.

« Last Edit: 13 May 2017, 17:23 by Crimson Wizard »

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
Ah, I was just suggesting something like this to Cassie on IRC.
This would be great. Is the branch still around? The link to the branch didn't seem to work for me.
« Last Edit: 13 May 2017, 17:22 by Gurok »

It should be working, still in my repository. But the branch is very outdated and has to be rebased.
Branch name is "improve-scapimap", you could try fetching it in git.


Although, today I'd rather try some different approach which would do similar thing automatically, if compiler could add a note on imports that belong to plugins to let engine distinct these.

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!
So, is that something I could use/implement or does it require more than what I can? 
Cause that sounds just like what I need.  (nod)

I can either offer my project for testing, or just make a snippet of it, for the purpose, if you like.
There are those who believe that life here began out there...

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!
Okay, quick question/problem.

I decided to use the Credits Module by SSH to scroll the end credits, and all was going pretty good, until I finally was done rendering the movie and added it to the project...  :-\ Apparently it suffers from the same problem that CWs TypedText suffered. But no matter what I try, I just can't get the video running on the BG.  :~(
Now this isn't that big a deal, since the video is mostly the ships just moving from the right to the left, so AGS can do that easy with a few sprites, but thought I would mentioned just in case you want/can fix this.

If you figure out what is causing this, or how to solve it, I'll be all ears.  (nod)

There are those who believe that life here began out there...

Are you using the correct render stage?

Code: [Select]
video.renderStage = eD3D_StageBackground;
That should render it immediately after the game background finishes rendering and before anything else.

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!
Erm... yes I had that... but now I'm unsure what happened, cause now it's working.  :-[

Last time I had tried it was running the video, and then the credits after the video was finished.  (roll)
There are those who believe that life here began out there...

eri0o

AJA, are you still around? I would reaaaally like to take a look at your code to see what you needed to initialize of Directx in it and what you didn't because AGS had already done it for you.


eri0o

Oh, this is amazing, thank you  :-*

Hi Guys anyone solved scaling and aspect ratio issues with 3.5 and also the crash on Fullscreen/windowed switch?
« Last Edit: 17 Jan 2020, 02:13 by rmonic79 »

Thank you very much for this useful plugin

 :smiley: :smiley: :smiley: :smiley: :smiley:

Hello everybody.

My videos does't load if I don't set the property video.isLooping to true.
But it is strange that if I enter a Display("") to pop-up a message pausing the game after calling the function, the video is Displayed while the action is paused.


   
Code: Adventure Game Studio
  1.     videofile="Rosefall.ogv";    //here I set the videofile that must be load
  2.     videoloop=false;       //this is a global bool to set as value in video.islooping
  3.     playbackground (videofile); //this is the call to the global function
  4.     Display("Playing"); //If I enter this I see the video running, but if not the video is not shown
  5.     stopplay();  //this is how I call the function to set video as null, because it didn't work in the original function in the else statement
  6.     videofile="Nebula2.ogv"; //setting another video
  7.     videoloop=true; //this is the way to set that the loop works agaoin
  8.     playbackground (videofile); //and this oe works fine

This is how I modified this functions.

Code: Adventure Game Studio
  1. function playbackground (String videofile) {
  2.  if (Game.IsPluginLoaded("ags_d3d")) {
  3.   // Required for autoplay
  4.   D3D.SetLoopsPerSecond( GetGameSpeed() );
  5.   // Open video file
  6.   video = D3D.OpenVideo( videofile );
  7.   if ( video ){
  8.    // Use room coordinates
  9.    video.relativeTo = eD3D_RelativeToRoom;
  10.        
  11.    // Anchor point to top left corner
  12.    video.SetAnchor( -0.5, -0.5 );
  13.        
  14.    // Play!
  15.    video.Autoplay();
  16.    video.isLooping=videoloop;
  17.   }
  18.   else {
  19.    Display( "Couldn't open video." );
  20.    return;
  21.   }
  22.  }
  23.  else{
  24.   Display("Couldn't load ags_d3d plugin");
  25.  }
  26. }
  27.  
  28. function stopplay() {
  29. video=null;
  30. }

Do I need to do anything to let the video finish?
How can I load a video to be played just once without doing weird things?

Regards.
« Last Edit: 16 May 2020, 20:52 by nightmarer »