Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, VoroneTZ), 1,258 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Video Cut Scene #452054
06/01/15 12:37
06/01/15 12:37
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
Hi all!
I want my game to start with a video cut scene. Does anyone have some example code I could look at to do this? I would also like the player to be able to interrupt the video and continue to the game; what would I use for that?

Is there a better video format/compression to use with GameStudio?

Thanks!

Re: Video Cut Scene [Re: mschoenhals] #452056
06/01/15 13:48
06/01/15 13:48

M
Malice
Unregistered
Malice
Unregistered
M



here you go

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////
function main()
{
	
  vec_set(screen_size,vector(800,400,0));
  vec_set(screen_color,vector(50,1,1)); // dark blue
  vec_set(sky_color,vector(50,1,1)); // dark blue
  video_window(NULL,NULL,0,"My New Game");
  d3d_antialias = 1;
  shadow_stencil = 3;
/////////////////////////////
// Video section 
var vid_handle=0;  // create a local var to hold the media handle
vid_handle=media_play("this_vid.wmv",NULL, 75); //play media and set var
// loop only while var is valid 
while(vid_handle)
{
	if(key_any) // check if any key was pressed
	media_stop(vid_handle); // stop vid
	wait(1); // required wait avoids endless looping
}
///////////////////////////////////
//  level_load("my_level.wmb");
//  vec_set(camera.x,vector(-250,0,50));
//  vec_set(camera.pan,vector(0,-15,0));

}



Note about videos, http://www.conitec.net/beta/amedia_play.htm
If I recall you may need to use a VFW format. OR maybe that was just a Virtual Dub requirement

Last edited by Malice; 06/01/15 13:55.
Re: Video Cut Scene [Re: ] #452068
06/01/15 17:15
06/01/15 17:15
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
And always stop the media handle before level_load. Good tip btw.


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Video Cut Scene [Re: rayp] #452195
06/05/15 23:09
06/05/15 23:09
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
Ok, the video does run; awesome! But now my level won't load when I hit a key. The window just turns blue and hangs.

Here's the code I have after the wait (excuse the fact that I don't know how to properly format for this forum, I'm such a nube):

camera.ambient = 100;
camera.arc = 90; // set camera.arc to a proper value for shooter games
fps_max = 75; // limit the frame rate to 75 fps (not really needed)
video_screen = 1; // start the game in full screen mode
video_mode = 8; // run at a 1024x768 pixels resolution on monitors with a 4/3 aspect ratio
level_load ("shooter.wmb");
wait (3);
media_loop("action.mp3", NULL, 70); // start the soundtrack

Re: Video Cut Scene [Re: mschoenhals] #452196
06/05/15 23:19
06/05/15 23:19

M
Malice
Unregistered
Malice
Unregistered
M



does the camera see only sky?
with this script it will be at level0,0,0 looking at level_pan 0,0,0

Btw level_load should be after the media instruction stops.. SEE Rayp above

Last edited by Malice; 06/05/15 23:21.
Re: Video Cut Scene [Re: ] #452197
06/05/15 23:32
06/05/15 23:32
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
I just see a blue screen. I think that's the done in the video code. Yup, the level load is at the end of the script.

Re: Video Cut Scene [Re: mschoenhals] #452198
06/06/15 01:04
06/06/15 01:04

M
Malice
Unregistered
Malice
Unregistered
M



post you code using the code tag please(found under full reply button)

also the engine isn't throwing a error so the level is loaded, check the camera focus target

vec_set(camera.x,vector(0,0,50));
vec_set(camera.pan, vector(0,-25,0));

Last edited by Malice; 06/06/15 01:07.
Re: Video Cut Scene [Re: ] #452207
06/06/15 15:29
06/06/15 15:29
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
I do believe the level is loading and it does indeed have something to do with my camera. I thought I was defining the proper camera at the bottom of the function. Is that incorrect?

Code:
function main()
{
	vec_set(screen_size,vector(800,400,0));
	vec_set(screen_color,vector(50,1,1)); // dark blue
	vec_set(sky_color,vector(50,1,1)); // dark blue
	video_window(NULL,NULL,0,"My New Game");
	d3d_antialias = 1;
	shadow_stencil = 3;
	/////////////////////////////
	// Video section 
	var vid_handle=0;  // create a local var to hold the media handle
	vid_handle=media_play("testvid.wmv",NULL, 75); //play media and set var
	// loop only while var is valid 
	while(vid_handle)
	{
		if(key_any) // check if any key was pressed
		media_stop(vid_handle); // stop vid
		wait(1); // required wait avoids endless looping
	}
	///////////////////////////////////
	
	camera.ambient = 100;
	camera.arc = 90; // set camera.arc to a proper value for shooter games
	fps_max = 75; // limit the frame rate to 75 fps (not really needed)
	video_screen = 1; // start the game in full screen mode
	video_mode = 8; // run at a 1024x768 pixels resolution on monitors with a 4/3 aspect ratio
	level_load ("shooter.wmb");
	wait (3); 
	media_loop("action.mp3", NULL, 70); // start the soundtrack
}


Re: Video Cut Scene [Re: mschoenhals] #452232
06/07/15 11:16
06/07/15 11:16

M
Malice
Unregistered
Malice
Unregistered
M



Code:
unction main()
{
	vec_set(screen_size,vector(800,400,0));
	vec_set(screen_color,vector(50,1,1)); // dark blue
	vec_set(sky_color,vector(50,1,1)); // dark blue
	video_window(NULL,NULL,0,"My New Game");
	d3d_antialias = 1;
	shadow_stencil = 3;
	/////////////////////////////
	// Video section 
	var vid_handle=0;  // create a local var to hold the media handle
	vid_handle=media_play("testvid.wmv",NULL, 75); //play media and set var
	// loop only while var is valid 
	while(vid_handle)
	{
		if(key_any) // check if any key was pressed
		media_stop(vid_handle); // stop vid
		wait(1); // required wait avoids endless looping
	}
	///////////////////////////////////
	
	//camera.ambient = 100;
	camera.arc = 90; // set camera.arc to a proper value for shooter games
	fps_max = 75; // limit the frame rate to 75 fps (not really needed)
	video_screen = 1; // start the game in full screen mode
	video_mode = 8; // run at a 1024x768 pixels resolution on monitors with a 4/3 aspect ratio
	level_load ("shooter.wmb");
        vec_set(camera.x,vector(-250,0,50)); //back X250 up z50
        vec_set(camera.pan,vector(0,-15,0)); // TILTed down 15*
	wait (3); 
	media_loop("action.mp3", NULL, 70); // start the soundtrack
}



try that and see if you can see the level.

Normally if you have a game the camera is attached to the player. So if you like you can move to creating a simple walking player then attaching a camera becomes a integrated part of player code and player creation.

Quote:

function cam_era()
{
// for fps game
while(1)
{
vec_set(camera.x,my.x);// MY is the player ent
vec_set(camera.pan,my.pan) // Look where the player looks
wait(1);
}
}

action ent_player()
{
cam_era();
while(1)
{
my.skill1 = ((key_w-key_s)*10)*time_step; // give a movement value
my.pan-=((key_a-key_d)*10)*time_step; // give turning
c_move(my,my.skill1,nullvector,GLIDE); // move using skill1-skill3 as a vector of speed.
wait(1);
}
}

Last edited by Malice; 06/07/15 11:34.
Re: Video Cut Scene [Re: ] #452262
06/07/15 19:55
06/07/15 19:55
Joined: Aug 2013
Posts: 101
M
mschoenhals Offline OP
Member
mschoenhals  Offline OP
Member
M

Joined: Aug 2013
Posts: 101
Unfortunately I still get the same results. The video plays fine but when I hit a key, it goes to a dark blue screen (still in a window) and stops there. I can hear the no ammo click on my mouse, but the music doesn't start. No game screen either.

I'm pretty sure it has to do with the camera but I'm uncertain how to fix it. It works fine without the intro video.

Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1