Crude attempt at fly-by camera

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
mahric
Posts: 192
Joined: Sun Nov 04, 2012 3:05 pm

Crude attempt at fly-by camera

Post by mahric »

Hi everyone,

Here's my crude attempt at a fly-by camera. (video, source example)
(if possible, watch with chrome @60fps to see how it really looks in game)

With it, you can do stuff like:
- Introduce a new area or a boss with a fly-by
- Show the player where to go

To create a "fly by", simply add points to your trajectory with the function below:

Code: Select all

mdCam.script:addPoint(x, y, facing)

	x = the x position in the editor where you want the camera to go
	y = the y position in the editor where you want the camera to go
	facing = the way the camera needs to look when arriving at the point (0 = north, 1 = east, 2 = south, 3 = west)
After you have added all points, start the fly-by with the function below:

Code: Select all

mdCam.script:startCam(duration)

	duration = the number of second the total flight should take
There are lots of known issues:
- There is some smoothing, but it's very crude and/or or not done at all. The faster the camera goes the easier it's to notice.
- There is only support for elevation (because I didn't need it myself yet)
- You fly through the area but don't hear the sounds. That's because you hear the sounds where the party is instead of where the camera is.

Please feel free to use this, change it and/or completely rework it.
This is just a basic attempt from my side with all the stuff I needed.

Hope you can use it in your project. For full instructions read the readme file in the example, in the mod_assets/mdCam folder.
Did you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Crude attempt at fly-by camera

Post by Drakkan »

impressive work !
edit: is the camera abel to fly between different maps / levels ?
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
mahric
Posts: 192
Joined: Sun Nov 04, 2012 3:05 pm

Re: Crude attempt at fly-by camera

Post by mahric »

No, the camera can't fly between levels. I don't think the game engine loads the graphics for the adjacent levels.
Every visible transition in the game to another level is through a fade-out and fade-in.

The current demo only works for the level where the character is in anyway.

To fly trough seperate level you'd have to define seperate sets of points, use fade-out and fade-ins to transition between them and move the player from one map to the next.
That requires quite a bit of scripting. Not hard, but very tailored to a specific dungeon.
Did you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Crude attempt at fly-by camera

Post by Isaac »

This is really cool! 8-)

I haven't looked at the source yet... but I wonder, could your next version look for/detect invisible marker objects that have an x/y/e location, and track to them along the path from a to b?
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Crude attempt at fly-by camera

Post by Komag »

Wow, I'm pretty impressed!
Finished Dungeons - complete mods to play
Post Reply