PLUGIN: SpriteVideo v0.9.7 (sprite and video render), based on Direct3D plugin

Started by Crimson Wizard, Fri 08/07/2022 19:34:30

Previous topic - Next topic

Vincent

Quote from: Crimson Wizard on Mon 23/01/2023 11:49:30Of course, because you need to have this plugin compiled for Android too. Each plugin you are using has to be compiled separately for each platform you're building your game for.

I don't remember how do you add plugins for Android though, this has to be clarified.

Hi CW thanks for answering, I didn't know that I am sorry. So this might work on Android but the plugin need to be compiled separately, how to do that?

Crimson Wizard

Quote from: Vincent on Mon 23/01/2023 11:58:35So this might work on Android but the plugin need to be compiled separately, how to do that?

I wish I knew myself... Theoretically this may be done under Linux, at least we were building some of the "standard" plugins for Android under Linux previously.

I will have to consult someone about this, like eri0o maybe.

Vincent

Quote from: Crimson Wizard on Mon 23/01/2023 12:05:08I wish I knew myself... Theoretically this may be done under Linux, at least we were building some of the "standard" plugins under Linux previously.

I will have to consult someone about this, like eri0o maybe.

There's no problem really, maybe @eri0o knows how to do that, sorry for mentioning.

eri0o

To just run it's simply add the pre-builts of the plugin in the same place where pre-builts of the engine are placed, note there's a directory for each different architecture, so you want to build the plugin for all those individually.

The way I find easier to build is to add the plugin in the AGS cmake project and make sure the project is a shared library. Then it should create the additional plugin as a library in each architecture directory.

You can theoretically make your own Makefile, make sure it uses the same sdk and ndk AGS uses and all that but my experience was that keeping that updated with all the changes in Android was a much bigger burden if you want binaries that can actually be approved in Google Play.

Edit: ah, that would be all easier if there was a cmake project already in the plugin directory.

Vincent

Quote from: eri0o on Mon 23/01/2023 12:38:21To just run it's simply add the pre-builts of the plugin in the same place where pre-builts of the engine are placed, note there's a directory for each different architecture, so you want to build the plugin for all those individually.

The way I find easier to build is to add the plugin in the AGS cmake project and make sure the project is a shared library. Then it should create the additional plugin as a library in each architecture directory.

You can theoretically make your own Makefile, make sure it uses the same sdk and ndk AGS uses and all that but my experience was that keeping that updated with all the changes in Android was a much bigger burden if you want binaries that can actually be approved in Google Play.

Edit: ah, that would be all easier if there was a cmake project already in the plugin directory.

@eri0o do you mind to do a step-by-step walkthough on how to do this? If you dont mind and when you have some free time ofc!

eri0o

Just for reporting, I looked into but there's a dependency (TheoraPlayer) that I have no idea how to build. My suggestion would be to make a minimal version of TheoraPlayer and have the source files of it in the project itself, but this looks like a ton of work. There it seems to be some sort of Android Studio project of that library there in TheoraPlayer sources, but I don't understand it, and there's a CMake file, but it's not written with anything beyond Linux in mind, so I didn't push it further. 

Crimson Wizard

Quote from: eri0o on Fri 03/02/2023 02:17:10My suggestion would be to make a minimal version of TheoraPlayer and have the source files of it in the project itself

I may look into this if I have spare time.

There's already some issues with building TheoraPlayer on linux, as it does not have a proper lib installation.

Vincent

This is kind offtopic but there wont be a chance to change how the default 'playvideo' work? So to allow the video to play also in Noblock mode? Because the main focus of this plugin to me is that you can play a video in Noblock mode. Theoretically if that were the case there would be no need to use a plugin and in my mind an Android game would play the videos just fine with the standard Ags command, is that right?

eri0o

Can you elaborate what is the use of playing videos in non-blocking? (Like, what's intended to happen simultaneously with the video)



The libogg, vorbis and theora are already dependencies in ags, and say in the future we want colored emoji fonts that are PNG based or adding reading PNG files to AGS itself, so libpng would be there too.

Somewhere in the future, it feels like a good idea to have this plugin sources around the other compatibility plugins in ags project itself. 

Vincent

Quote from: eri0o on Fri 03/02/2023 12:27:48Can you elaborate what is the use of playing videos in non-blocking? (Like, what's intended to happen simultaneously with the video)

Well all the stuff you can do when the game is not blocking you know? Eg. Like moving the mouse, interacting with buttons etc.

eri0o

I made a post on the engine board for a  feature request to try to get the engine specifics there on a possible in engine implementation - For a short term version of it, it's best to focus on this plugin, but perhaps it's worth to discuss a bit what's needed in engine.

Vincent



Vincent


Crimson Wizard

Quote from: Vincent on Sat 29/04/2023 19:24:54What it means if the objects had Parents if I might ask?

You can connect objects together as Parent - Child, and then children's position and transformation becomes relative to the parent's.
The full explanation may be found in the docs, see the "SetParent" description:
https://github.com/ivan-mogilko/ags-spritevideo/wiki/SpriteVideo-API

Vincent

Thanks a lot for the documentation, I was misunderstanding that it was something new in Ags instead is part of this plugin

Crimson Wizard

Quote from: eri0o on Fri 03/02/2023 02:17:10Just for reporting, I looked into but there's a dependency (TheoraPlayer) that I have no idea how to build. My suggestion would be to make a minimal version of TheoraPlayer and have the source files of it in the project itself, but this looks like a ton of work. There it seems to be some sort of Android Studio project of that library there in TheoraPlayer sources, but I don't understand it, and there's a CMake file, but it's not written with anything beyond Linux in mind, so I didn't push it further. 

@eri0o
I found some spare time and made a branch, placing minimal TheoraPlayer sources inside the plugin:
https://github.com/ivan-mogilko/ags-spritevideo/commits/theora-directlink2

It works on Windows and Linux.

Would it make it easier to build for Android? Note it still requires separate libpng, libogg, libtheora and libvorbis. TheoraPlayer comes with its own ogg/theora/vorbis sources, but I decided to skip these now, and only add later if there's really no other way.

Crimson Wizard

I made an attempt to build this for Android, it's quite rough and dirty though:
https://github.com/ivan-mogilko/ags-spritevideo/tree/android

preliminary build for a test:
https://www.dropbox.com/scl/fi/hh8fnokfl47918ixcavd9/libags_spritevideo.zip?rlkey=zgds6fc4hs5ztvri2ite5h78n&dl=0

UPDATE: the plugin is working, there are some issues, like sprite colors may be mismatched (RGB->BGR), but that is a minor problem compared to the rest.
I keep testing and fixing this in a spare time.

UPDATE 2: the biggest problem at the moment is that AGS plugins cannot read data that is not on disk, at all. Like, if a video file is packed inside the game's package, or inside Android's standard package, it cannot see and get it. Plugins only understand raw files on disk.
Idk if it's possible to force android to unpack some game files from APK. But ideal solution would be to add plugin API which requests "custom file stream" from the engine, which may load data from anywhere as needed. This is something that has to be done in AGS itself, plugin code cannot do that on its own.

This is an old problem with plugins, that has not be resolved still after all these years unfortunately.

I'm currently considering to add this ability to 3.6.1. This may be used even if you're making game in earlier versions (for example, make main game in 3.6.0, and build for Android in 3.6.1).

https://github.com/adventuregamestudio/ags/issues/2226

UPDATE 3: I got the experimental version working on Android, with video playback.
But to get to the actual release i'd need to do alot of tidying up.
* Add file stream to the 3.6.1 plugin API.
* Clean up plugin sources after lots of experimenting.
* Ensure plugin still runs with older engines, and correctly limits its functionality.

Crimson Wizard

Quote from: Crimson Wizard on Sun 12/11/2023 06:25:58But to get to the actual release i'd need to do alot of tidying up.
* Add file stream to the 3.6.1 plugin API.
* Clean up plugin sources after lots of experimenting.
* Ensure plugin still runs with older engines, and correctly limits its functionality.

This is practically done, what is currently pending is to merge the new API into the 3.6.1 engine, and then I'll be able to release a plugin's update that will fully functional on Android.

As a consequence of these changes this plugin will actually be able to load OGV videos packaged inside ags game too (previously it could only load from standalone files).

Crimson Wizard

Updated to v0.9.6

* Support Android version (renders with OpenGL ES 2.0).
* Videos and external PNG files are read using newer AGS engine File API if available, since 3.6.1 (will fallback to standard direct file reading if run with older engine). This lets to stream assets packed inside a game data pack too. This is the only method that will work on Android if game is packaged as APK.
* Plugin will print debug messages to stdout if failed to open file for logging.
* Fixed printing overly verbose "RENDER screen WxH" message.


For Windows: https://github.com/ivan-mogilko/ags-spritevideo/releases/download/v0.9.6/win_ags_spritevideo.zip
For Linux (debian-based): https://github.com/ivan-mogilko/ags-spritevideo/releases/download/v0.9.6/libags_spritevideo.tar.xz
For Android: https://github.com/ivan-mogilko/ags-spritevideo/releases/download/v0.9.6/android_libags_spritevideo.zip
Source code: https://github.com/ivan-mogilko/ags-spritevideo



@Vincent I'm terribly sorry that this took so long, I've been thinking about doing this update, but was getting distracted all the time, and frankly thought that it will require me to spend much time learning configuring builds for Android. In reality that task took less time than I expected.

But then it turned out that it's not enough, because you cannot read videos from files on disk when running APK on Android, so I had to implement a new feature in the engine that would let plugins stream resources from any package that engine itself can read. (Of course same will work on Windows, Linux etc.)

Current version does work on Android with (almost) any engine, but it can only load videos from within APKs if you run it along the latest 3.6.1 (starting with 3.6.1.12 and later).

SMF spam blocked by CleanTalk