3D camera motion, Action Editor, Transform and Image Viewer

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
User avatar
Mooneon
Regular
Posts: 78
Joined: Sat Jul 04, 2015 4:05 pm
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#31 Post by Mooneon » Wed Jul 27, 2016 1:17 pm

Also how do you register images into layers?

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#32 Post by trooper6 » Wed Jul 27, 2016 1:31 pm

Mooneon wrote:Also how do you register images into layers?
I don't understand the question.

If you want to show an image on a certain layer then you just type in the code:

Code: Select all

show cutieface onlayer middle
Is that what you are asking?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Mooneon
Regular
Posts: 78
Joined: Sat Jul 04, 2015 4:05 pm
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#33 Post by Mooneon » Wed Jul 27, 2016 1:38 pm

No no. How do you regist 3D layers?
Screen shot 2016-07-27 at 10.31.48 AM.png
I'm sorry, I am completely lost right now. Anyways it says there to Regist 3D layers. I don't know how to do that...

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#34 Post by trooper6 » Wed Jul 27, 2016 2:00 pm

Have you read the README.md document that comes with the camera? All the information is in there, for example this section shows you how to register 3D layers:
Camera
================

With some limitations, Ren'Py can simulate 3D camera motion. This will easily
let you achieve a parallax effect by placing sprites and assets on a 3D field.
This script applies transforms to each layers which are registered as 3D layer by
positions of a camera and 3D layers on a 3D field to simulate 3D camera motion.

If you use this feature, in the first, set additional layers to be registered
as 3D layer. If anything isn't registered as 3D layers, this script register
"master" layer as 3D layers.

For example, Write a code like below in options.rpy and add 'background', 'middle', 'forward' layers.::

config.layers = ['master', 'background', 'middle', 'forward', 'transient', 'screens', 'overlay']

Second, register layers which participate to a 3D motion as 3d layers by
:func:`register_3d_layer`. The z coordinates of these layers can be moved and
applied transforms to by positions of the camera and 3D layers. If anything
isn't registered as 3D layers, this script registers 'master' layer as 3D
layer.::

init python:
register_3d_layer('background', 'middle', 'forward')

Then, a camera and layers can move. ::

label start:
# reset the camera and layers positions and allow layers position to be saved.
$ camera_reset()
# It takes 0 second to move layers
$ layer_move("background", 2000)
$ layer_move("middle", 1500)
$ layer_move("forward", 1000)
scene bg onlayer background
show A onlayer middle
show B onlayer forward
with dissolve
'It takes 1 second to move a camera to (1800, 0, 0)'
$ camera_move(1800, 0, 0, 0, 1)
'It takes 5 seconds to move a camera to (0, 0, 1600)'
$ camera_move(0, 0, 1600, 0, 5)
'A camera moves to (0, 0, 0) at the moment'
$ camera_move(0, 0, 0)
'It takes 1 second to rotate a camera to 180 degrees'
$ camera_move(0, 0, 0, 180, 1)
'It takes 1 second to rotate a camera to -180 degrees and 0.5 second to move a camera to (-1800, 0, 500)'
$ camera_moves( ( (0, 0, 0, 0, 1, 'linear'), (-1800, 0, 500, 0, 1.5, 'linear') ) )
'a camera shuttles between (-1800, 0, 500) and (0, 0, 0)'
$ camera_moves( ( (0, 0, 0, 0, .5, 'linear'), (-1800, 0, 500, 0, 1, 'linear') ), loop=True)
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Mooneon
Regular
Posts: 78
Joined: Sat Jul 04, 2015 4:05 pm
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#35 Post by Mooneon » Wed Jul 27, 2016 2:09 pm

I have read it yet I seriously cannot understand it. It's not simple.

Varrok
Newbie
Posts: 6
Joined: Sun Jun 26, 2016 4:11 pm
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#36 Post by Varrok » Wed Jul 27, 2016 2:17 pm

Code: Select all

init -1 python:
    config.layers = [ 'master', 'l1', 'l2', 'l3', 'transient', 'screens', 'overlay']

init python:
    register_td_layer( ('master', 1000), ('l1', 300), ('l2', 800), ('l3', 900))
^ Example

First you declare them, then you assign them the Z axis value

User avatar
Mooneon
Regular
Posts: 78
Joined: Sat Jul 04, 2015 4:05 pm
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#37 Post by Mooneon » Wed Jul 27, 2016 3:26 pm

What does this mean?

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 82, in script
    centered "When I was a child. I didn't have anyone. No family. I was just an lonely orphan."
  File "game/camera/camera.rpy", line 1480, in action_editor
  File "game/camera/camera.rpy", line 398, in execute
  File "game/camera/camera.rpy", line 398, in execute
  File "game/camera/camera.rpy", line 433, in execute
  File "game/camera/camera.rpy", line 437, in execute
  File "game/camera/camera.rpy", line 473, in execute
  File "game/camera/camera.rpy", line 526, in execute
  File "game/camera/camera.rpy", line 529, in execute
  File "game/camera/camera.rpy", line 530, in execute
  File "game/camera/camera.rpy", line 532, in execute
  File "game/camera/camera.rpy", line 532, in keywords
TypeError: cannot concatenate 'str' and 'tuple' objects

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 82, in script
    centered "When I was a child. I didn't have anyone. No family. I was just an lonely orphan."
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/ast.py", line 604, in execute
    renpy.exports.say(who, what, interact=self.interact)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/exports.py", line 1122, in say
    who(what, interact=interact)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/character.py", line 841, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/character.py", line 690, in do_display
    **display_args)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/character.py", line 493, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/ui.py", line 277, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/core.py", line 2425, in interact
    repeat, rv = self.interact_core(preloads=preloads, **kwargs)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/core.py", line 3101, in interact_core
    rv = root_widget.event(ev, x, y, 0)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/layout.py", line 905, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/behavior.py", line 410, in event
    rv = run(action)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/behavior.py", line 302, in run
    return action(*args, **kwargs)
  File "game/camera/camera.rpy", line 1480, in action_editor
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/game.py", line 265, in invoke_in_new_context
    return callable(*args, **kwargs)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/exports.py", line 2475, in call_screen
    rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/ui.py", line 277, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/core.py", line 2437, in interact
    scene_lists.replace_transient()
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/core.py", line 727, in replace_transient
    self.remove(layer, tag)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/core.py", line 1014, in remove
    self.hide_or_replace(layer, remove_index, "hide")
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/core.py", line 938, in hide_or_replace
    d = oldsle.displayable._hide(now - st, now - at, prefix)
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/screen.py", line 430, in _hide
    self.update()
  File "/Users/Maddie/Desktop/renpy-6.99.10-sdk/renpy/display/screen.py", line 565, in update
    self.screen.function(**self.scope)
  File "game/camera/camera.rpy", line 398, in execute
  File "game/camera/camera.rpy", line 398, in execute
  File "game/camera/camera.rpy", line 433, in execute
  File "game/camera/camera.rpy", line 437, in execute
  File "game/camera/camera.rpy", line 473, in execute
  File "game/camera/camera.rpy", line 526, in execute
  File "game/camera/camera.rpy", line 529, in execute
  File "game/camera/camera.rpy", line 530, in execute
  File "game/camera/camera.rpy", line 532, in execute
  File "game/camera/camera.rpy", line 532, in keywords
  File "<screen language>", line 532, in <module>
TypeError: cannot concatenate 'str' and 'tuple' objects

Darwin-10.8.0-i386-64bit
Ren'Py 6.99.10.1227
Death's Sweet Embrace 0.1

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#38 Post by trooper6 » Wed Jul 27, 2016 4:13 pm

Varrok wrote:

Code: Select all

init -1 python:
    config.layers = [ 'master', 'l1', 'l2', 'l3', 'transient', 'screens', 'overlay']

init python:
    register_td_layer( ('master', 1000), ('l1', 300), ('l2', 800), ('l3', 900))
^ Example

First you declare them, then you assign them the Z axis value
Varrok, the documentation doesn't say you can supply tuples for the register_td_layer function. That might be causing the errors.

Mooneon, let me requote the documentation and then try to state it in different words:
For example, Write a code like below in options.rpy and add 'background', 'middle', 'forward' layers.::

config.layers = ['master', 'background', 'middle', 'forward', 'transient', 'screens', 'overlay']

Second, register layers which participate to a 3D motion as 3d layers by
:func:`register_3d_layer`.

init python:
register_3d_layer('background', 'middle', 'forward')
Okay, so, in your options.rpy file, add the line:
config.layers = ['master', 'background', 'middle', 'forward', 'transient', 'screens', 'overlay']


For example, in my game the beginning of my options.rpy file looks like this:

Code: Select all

init -1 python hide:

    ## These control the width and height of the screen.
    config.screen_width = 1366
    config.screen_height = 768

    ## This controls the title of the window, when Ren'Py is
    ## running in a window.
    config.window_title = u"CloseShaveLayerTest"

    # These control the name and version of the game, that are reported
    # with tracebacks and other debugging logs.
    config.name = "CloseShaveLayerTest"
    config.version = "0.0"
    
    #This is my added code for the layers 
    config.layers = ['master', 'bottom', 'middle', 'front', 'clipper', 'transient', 'screens', 'overlay']
Next, you have to register the layers you want to participate in 3D motion, by adding:
init python:
register_3d_layer('background', 'middle', 'forward')
For example, in my script.rpy file, I have:

Code: Select all

init -1 python:
    register_3d_layer('bottom', 'middle', 'front')

label start:
   "Blah blah blah"
Try typing in exactly that code, the code in the README doc.

If you get an error, you should look to see about what line the error comes from and then post the code around that line, within the code tags, so we can see what is going on.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Varrok
Newbie
Posts: 6
Joined: Sun Jun 26, 2016 4:11 pm
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#39 Post by Varrok » Wed Jul 27, 2016 4:44 pm

I don't really know about the tuples, but the way I posted works on my PC.

User avatar
akakyouryuu
Regular
Posts: 131
Joined: Fri Nov 30, 2012 10:29 am
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#40 Post by akakyouryuu » Mon Aug 01, 2016 6:48 am

Improved Document. Thanks, kevinturner
Attachments
camera.zip
(25.61 KiB) Downloaded 164 times

User avatar
Morhighan
Miko-Class Veteran
Posts: 955
Joined: Sun Jun 27, 2010 12:54 pm
Completed: AIdol, When Our Journey Ends, Forgotten Not Lost
Organization: MysteryCorgi
Tumblr: MysteryCorgi
Deviantart: MysteryCorgi
Soundcloud: MysteryCorgi
itch: MysteryCorgi
Location: USA
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#41 Post by Morhighan » Mon Aug 01, 2016 8:31 am

akakyouryuu, I just want to express my gratitude to you. Without the 3D camera my project would be much harder for me to program!

Here's an example of me using the camera:
https://www.youtube.com/watch?v=A4YloMCvdA8
I use the 3D camera here to make the light jostling of the train with the "wiggle" code you made before.

Thank you so much!

User avatar
GreyWolfXx
Regular
Posts: 68
Joined: Fri Jun 05, 2015 1:00 am
IRC Nick: Grey
Skype: GreyWolfXxII
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#42 Post by GreyWolfXx » Thu Aug 18, 2016 10:46 pm

I am also having the tuple error. I did everything you said, trooper6, and nothing seems to be working.

"We have been to the moon, we have charted the depths of the ocean and the heart of the atom,
but we have a fear of looking inward to ourselves because we sense that is where
all the contradictions flow together." -- Terrence Mckenna

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#43 Post by trooper6 » Thu Aug 18, 2016 11:22 pm

What does your code look like?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
GreyWolfXx
Regular
Posts: 68
Joined: Fri Jun 05, 2015 1:00 am
IRC Nick: Grey
Skype: GreyWolfXxII
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#44 Post by GreyWolfXx » Fri Aug 19, 2016 11:32 am

Deleted
Last edited by GreyWolfXx on Thu Apr 05, 2018 2:26 pm, edited 1 time in total.

"We have been to the moon, we have charted the depths of the ocean and the heart of the atom,
but we have a fear of looking inward to ourselves because we sense that is where
all the contradictions flow together." -- Terrence Mckenna

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: 3D camera motion, Action Editor, Transform and Image Vie

#45 Post by trooper6 » Fri Aug 19, 2016 1:36 pm

That isn't your code, that is your traceback error. What does your code look like? The code where your configure your layers and register your 3D layers. The code where you actually use the camera.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: No registered users