Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Play Avi Files into RMVX.

Movie Player
v1.5

Features
- Windowed or Fullscreen.
- It plays seamlessly. Without flickering.
- Stretch Video to fit the window or the screen. Keeping the original video Aspect Ratio
- it's a module, not a class thing. ( :lol: )

Video Spec
Yes there are some minor things to respect when adding a video so it can be played correctly:
- Xvid Codec
- Mp3 in CBR ( constant bit rate )
- No restricted video size, though there is not much interest of having a video wider than 640px as it will be stretched DOWN.
- Stay in control, on the maps, as it just overlays the graphics, and the Map's BGM isn't stopped.  ( DOESn't mean the game is actually running or the events updated )

Demo: LINK  OUTDATED, it's version 1.0

#===============================================================================
# By trebor777
# Date: 26/10/2008
# Version 1.5 - Updated 27/10/2008
#-------------------------------------------------------------------------------
# RMVX Avi Player
#
# Instructions:
#   Video Specification ( to ensure good playability )
#     Recommended encoding:  Xvid + MP3 CBR  (very important to keep a constant
#     bit rate for the audio, else it won't play it)
#     Video Resolution : Up to 640*480
#     Save the videos into a new folder called Movies in your project root folder.
#   
#   Call in an event(using the call script command) or in your script:
#     
#     Movie.play("myvideo",width,height)
#     Movie.play("myvideo")
#
#    By providing the dimensions of your video, if smaller than 640*480, the script
#    will stretch it in the window(or in the screen if in fullscreen), to fit a
#    width of 640px, but keeping the original aspect ratio.
#
#    Don't need to provide the dimensions if the video is 640*480.
#===============================================================================
module Movie
  attr_accessor :fps
  def self.play(movie, width=Graphics.width, height=Graphics.height)
    movie= "./Movies/#{movie}.avi"
    fps = 24
    readini= Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
    wnd= Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
    @mplayer= Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
    @detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
    timer= 1.0/fps
    info= " " * 255
    game_name= "\0" * 256
    readini.call('Game','Title','',game_name,255,".\\Game.ini")
    game_name.delete!("\0")
    hwnd= wnd.call(0,0,nil,game_name).to_s
    @mplayer.call("open #{movie} alias FILM style child parent #{hwnd}",0,0,0)
    @mplayer.call("status FILM length",info,255,0)
    movie_lenght = info.unpack("a*")[0].gsub!("\000","").to_i
    info= " " * 255
    @ratio = height.to_f/width
    @width = 0
    self.update_stretch
    @mplayer.call("play FILM window",0,0,0)
    loop do
      sleep(timer)
      Input.update
      update_stretch
      @mplayer.call("status FILM mode",info,255,0)
      s= info.unpack("a*")[0].gsub!("\000","")
      break if Input.repeat?(Input::B) or s.to_s == "stopped"
    end
    @mplayer.call("close FILM",0,0,0)
    Input.update
  end
  def self.update_stretch
    n_w = @detector.call(0)
    if @width != n_w
      @width = n_w
      w = (n_w == 640)? 640 : Graphics.width
      h = (n_w == 640)? 480 : Graphics.height
      new_height = (w*@ratio).round
      @mplayer.call("put FILM window at 0 #{(h-new_height)/2} #{w} #{new_height}",0,0,0)
    end
  end
end
 
I believe a script similar to this is already out there. And did you copyright the script? Do you have sole collective rights to it? Are you making people who buy this sign some form of confidentiality agreement? Kinda stupid if you ask me to charge for this.
 
( Damn why i didn't get any notification email???? It's like my PM , don't get emails either )

yes there are similar script, but none of them work properly, and from what i know, none of them are on VX...
So i did my research, and did my own...
And instead of having a bunch of people hiring me to do the script for each of them, which I used to do, I directly sell it.

It's my script, I'm selling it, I don't really see the problem... ?
I didn't copyright the script yet, as well, I just finished this, kind of a rush, and actually didn't thought that would be such of a big deal.
 
That's cool :p
except that it's only for intro movies that use an external.exe to actually read the avi files...
pretty heavy in my opinion...
Mine is just a script... that plays videos anywhere in your game

And if you're not happy with that, well, stop messing around, I can understand that the idea of paying for a script is revolting when it has always been free...
But I'm tired of giving so much of my freetime for just nothing.

If you think that's a bad idea, i understand, but i guess we can discuss that in PM.. instead of flooding my topic.. ( or what could be a flood if we continue )
 
Sorry dude, but I think i'll stick to the (flash) SWF's script (The one that lets you use SWF's in your games) , in my opinion I think its better, I mean with (flash) SWF's you can make a intro to a video, make a short game, and you can have the swf pop up when ever you want. anyway, GJ/GL with this!
 
Well^^ good for you!
Just sad that you have to use an external .exe to play them...( but still cool to play Flash File.) Also read it doesn't work in fullscreen...
 
Dude, I highly doubt you will get anyone to pay for this at all. Most people aren't making commercial games, therefore why pay for a script when your going to distribute your game freeware. And if you don't want to waste your free time on scripting, then don't. No one has a gun pointed to your head and is forcing you to waste your time on a script such as this. I think its ludacris that you have the audacity to charge for this script. It should be an honor to have members of the RPG community using your script. Heck, if this is the case, maybe I should take down my SEL/MOG menus and charge for them. $20/menu and $40/customization. So I made 4 menus, so that is $80 a pop.
But see, I am better than that. a) I am using the script myself and therefore scripted the menus with that in mind, b) I enjoy helping other people, c) I have scripts from other members of the community in my game which do not charge for use, or licensing, so why should I charge for my scripts?
I bet that you are using a number of scripts from other people, and to turn around and charge for your own script? What makes you so high and mighty over everyone else? So its a movie playing script, big deal. What type of functionality and gameplay will that add? Very little if you ask me, so it will make the game a bit flashier, but when it comes down to solid gameplay and plot, it doesn't change much. Ohh sure, you can have avi cinematics, but that takes away from the nature of using a program to make a game. I find what is fun about event cutscenes, is seeing how players have utilized the coding and options given to us to make a cutscene that flows and is in the nature of the game.
 
Please stop ranting about a script being commercial. A script is the scripters property and therefore they are free to do whatever they like with it, including charging for it. There is nothing in the rules that says scripts, graphics, or music cannot be sold for profit; and many people do this sort of thing with graphics anyway (there are quite a few people who commission graphics) so why shouldn't it be the same with scripts?

@Trebor: I don't have any need for this at the moment, but if I ever make/commission cutscenes for my game then I'll prob. buy it :)
 
I assure you there is people willing to pay for scripts... even if they don't sell their games...
It's not that I force myself, but sometimes you wish more than just "thx dude!"

I don't use any others script to make my scripts, I'm good enough to make my own, thx... been scripting since RMXP came out...
I don't have the arrogance of begin better than others, what makes you think that (by only wanting some money for my work?) ?
here you the one who's arrogant and thinks he's better than others
But see, I am better than that.

Why do you came up with the gameplay argument?? of course it doesn't add any gameplay value...

I'm programming a physics engine for rmvx...I think that will have way more gameplay value than this script, and there are high probability I share it here for free, as my Tales of CBS (ok, it's in pause, but I'll finish it!).

If we judge scripts by their gameplay value... it's totally irrelevant. Some people are making script that don't have any gameplay value, and those are still very good scripts... Like i don't know, the table class by vgvgf, or play FMOD Audio files, Reflection/Shadow/lighting script, etc...


Anyway!

Espèr, I did it under XP as well, but the video isn't played very smoothly, and it has the flickering problem. But i can have a look trying to solve this.
Commander Wyatt^^, Thx for support!

EDIT @espèr
It works properly in Windowed mode, but it flickers only in fullscreen...to be exact, except that the video is played normally.
( the flickering is due to the call to "graphics.update", but if i don't call it, the thing ends up with a "script hanging" error )
 
my problem with the video scripts out now is, that they don´t run correct on my Windows Vista Ultimate...
And what´s the idea of using a script that i can´t test ingame...
 
I honestly don't like the idea of selling scripts, but, if you think its good enough to sell, then power to you. I also think that, although a nice addon, this script is only really helpful to one of three groups:

People who want a video to play when the game is started. These people will probably not buy the game, because it would just be for one or two videos in the entire game.

People who want to put in video cutscenes, and have the ability to actually make them. Although few and far between, this group is the most likely to buy your script, simply because they are the ones who are actually working on a game, have the abilities to use it, and the intention of working on their games to the end.

Finally, people who want to do things like add their favorite episode of Bleach (or something else like that) to the game. The people are also not very likely to buy the script, because they have (probably) already become used to pirating things (points at what they're adding to the game), and they are probably of the belief that everything they want should be free.

Now, I know this reasoning is somewhat faulty and way too general, but I hope you see my point. Although you can sell the script, you probably won't get too many people buying it. Not to mention the fact that there are alternatives out there. Anyway, I hope you do at least get some people to buy it, because then you could have something to show for your work. (Although, like most of the rest of us, I would much prefer a free script)
 

Zeriab

Sponsor

You could try setting Graphics.frame_rate = 120 before calling Graphics.update.
Maybe that will make the flicker so short-lived that can't notice

Well done making a seamlessly working movie player script. ^_^
As for the VX-version. Does it support a scene progressing on top of the video? What about the video only being played on part of the script. (Like how it happens in many final fantasy games.)

@Glitchfinder: Why bother with all the useless negativity and why even post it here rather than sending a pm or starting a discussion a proper place?

*hugs*
- Zeriab
 
That's actually a nice idea there Zeriab!^^ Didn't thought of this one!

What do you mean by your 2 questions xD ?? I didn't really catch the thing...
 
Ok people here is a Video Capture :p of how it looks/works!

The fullscreen, doesn't look fullscreen because of the way works camtasia captures...
Anyway, for some weird reasons the audio doesn't work on the produced avi, though you can see the audio meter moving in the end while the video is playing...
Here is a screenshot, to show you the sound is actually here and recorded...
http://rmxp.trebor777.net/rmvx/SoundExist.PNG[/img]

The video ( Xvid + Mp3; 720*576 ) 22Mb.  LINK
 
trebor777":1o373kpk said:
Well^^ good for you!
Just sad that you have to use an external .exe to play them...( but still cool to play Flash File.) Also read it doesn't work in fullscreen...

You can change/add some extra scripting to allow full screen, and besides, I still don't really care about this script(not to be rude.), even if it does not use the external.exe. I would rather have a laggy, game then having to pay for something that I probably could make myself(or someone else.)

Anyway, I really like the fact of you puting effort into this script. I am sorry, and I hope you forgive me, but that was just the way I felt. Again sorry if I was rude.

Good Job!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top