Learning Renpy ATL Language... One Last Time

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.
Post Reply
Message
Author
User avatar
mugenjohncel
Hentai Poofter
Posts: 2121
Joined: Sat Feb 04, 2006 11:13 pm
Organization: Studio Mugenjohncel
Location: Philippines
Contact:

Learning Renpy ATL Language... One Last Time

#1 Post by mugenjohncel »

Please excuse my English... it is not my first language...

Also part rant so please excuse me for it too...


Now... I know people are sick and tired of me and my ramblings on trying to learn the Renpy ATL language. It's supposed to make moving things and images in renpy simple yet accomodates advance features to satisfy seasoned veterans and yet I ask myself... why can't I learn this ATL thing?... Is it true that I'm the only one left in this forums that doesn't know how to ATL?...

I am sick and tired of being called an eternal Renpy NOOB behind my back by some snotty artistically talented anti-social rude person in IRC which is half my age who had no idea who I was and what I have achieved and accomplished outside Renpy and NOT-AS-Mugenjohncel (which is really irrelevant here by the way... you know who you are... just because you can draw beautiful Katawa Shoujo art and know ATL doesn't mean you can talk trash behind my back... you're still a long way to match my accomplishments... KID! Someday, you'll realize that Rudeness can and will bring you bad Karma... you'll understand it when you're old enough)

Ehem!... Back to Subject... Nowadays, I ignore him but one thing he said remains true... I am a Renpy NOOB. True, I could just ignore it and keep going with my copy-pasta ask Renpytom for help when I am stuck method which has served me quite well but I know there will be a time when I will come to IRC for a life and death situation involving Renpy and... Renpytom will either not be in there or will ignore me due to the stupid and silly nature of my inquiries (I mean, Renpytom is not your personal coach, he's done more than enough for the whole community without asking much in return... he too has his own life and as much as possible I really don't want to bother / interrupt him for something as silly and simple as this... true, I could compensate, pay, bribe him or someone else to do the coding but the bottom line is I won't learn anything that way... I have to learn this ATL) The mere thought of being labeled as a noob is disturbing enough that I once in a while find myself reading the Renpy ATL docs with futile results (because I can't make out anything of it)... even on unusual situations like doing the usual mountainload of paperworks or doing my social obligations. Pride is such an evil thing to have and yet... my pride doesn't want to allow me to be labelled a Renpy Noob forever...

I'll be honest... My intentions are selfish, immature (relative to my age) and somewhat foolish... but hey... I'm just human too you know...

I Wanted to show this little prick from the Renpy IRC channel that Old Stupid Dogs like me can still learn NEW TRICKS! Don't count me out yet little boy! My eyes still have a few more years to go before it totally clouds up and render me legally blind! I MUGENJOHNCEL still has a story to tell the world! HAHA! Laugh now but once I learn that Renpy ATL thing... I'll conquer the world!!!

I mean, just a while back, I feel like I'm a king after leaning how classic imagemap works... I feel like I can do anything. Then ATL comes out. This revolutionary language that revolutionizes the way images are handled in renpy. It comes with nice features... it can do anything... and yet again I cannot understand it... The DEMO is there, the documentation is there but from a layman's point of view... it's like reading a blueprint for a nuclear reactor. So I sit back and think...
Why is it I find it really easy to learn Classic Imagemaps compared to this supposed to be easy to learn ATL language?

What were those factors that helped me to learn Classic Imagemaps?

Can I do the same with ATL?

What was it that I wanted to achieve?
And with those questions at hand. I search for my answers.

---
Why is it I find it really easy to learn Classic Imagemaps compared to this supposed to be easy to learn ATL language?

What were those factors that helped me to learn Classic Imagemaps?
Because in the case of the Classic Imagemaps, there is already an existing example where you could easily reverse engineer to suit your needs accompanied by what I believe is the most easily understandable Renpy Documentation EVER written which clearly state in plain english terms which thing does what.

---
Can I do the same with ATL?
As marketed, ATL can do everything and more... as long as you know how. ATL can do PAN, ATL can do ZOOM, ATL can do multiple pan while dictating duration... even combine two or more behaviours...

---
What was it that I wanted to achieve?
Well... as I have clearly stated, I wanted to learn how to ATL, take advantage of it's advance capabilities to tell a story. I mean, sure... normal Renpy functions will do but now that I know Renpy ATL can do those wonderful things... don't you think it would be nice if I could use some of those features to convey my story even better?

OK... so how do we start learning this ATL thing? By having examples to reverse engineer of course! I believe for someone like me, this would be the best way to learn how to do ATL (I already tried the normal way but no good)

So here's the part where I drop on my knees and beg like an all-star-loser...

Here are a couple of behaviours I wanted to achieve using ATL... and my plea?...

To anyone who has mastered the art of ATL or simply ANYONE that knows how to do the following behaviour in ATL... please teach this Old Fool how to do it... same with the metaphor you give a man a fish you feed him for a day you teach him how to fish... he starts a fishing empire or something like that... all I humbly ask are example codes where I can copy, tweak to suit my need... if you can, please do include finer details like which part does what... this will be greatly appreciated

To simplify things... Let's say I have these materials to work on...
Image

Behavior 1: First behavior is a vertical panning behavior...
Image

Behavior 2: Next is another panning behavior... but horizontally
Image

Behavior 3: Next is another panning behavior... but this time, to a specific position.
Image

Behavior 4: Next is another panning behavior to a specific position... but this time with Zoom
Image

Behavior 5: Next is multi panning...
Image

Now I know ATL can also do more than that like pan while slowing down or speeding up and such but I'm not going to chew more than I can and will focus on the really important stuff which is presented here.

For this attempt, I'm giving it my all... this is an all or nothing for one last time...

If I somehow managed to spectacularly fail to figure out how ATL works even after using those examples... then I guess I shall accept the fact that I'm too dumb for ATL and Renpy in general... I shall quit and that will be the end of it... no more Renpy for this stupid dumb noob... I'll just go back to selling printers and inks...

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Learning Renpy ATL Language... One Last Time

#2 Post by PyTom »

Okay, if all you want to do is pans and zoom, ATL is simple. (It's the many other things you can do that can make it more complicated.)

The best way to make an ATL pan is the size-crop method. Here's an example crop-size.

Code: Select all

scene bg washington:
    size (800, 600) crop (0, 150, 400, 300)
    linear 2.0 crop (0, 0, 800, 600)

pause 2.0
This works the following way:

* The bg washington is the image we're working with.
* The size (800, 600) is the size of the destination - this should be the size of your game's screen.
* crop (0, 150, 400, 300) gives a (x, y, w, h) rectangle that will be cropped and scaled. In this case, I picked a rectangle that is on the left side of the image, but centered vertically.
* linear 2.0 says the change given on the rest of this line should take 2.0 seconds.
* crop (0, 0, 800, 600) gives a crop rectangle to change to. In this case, it's the full source image - so the result is that we will zoom out.

* pause 2 isn't part of ATL - but if we didn't have it, Ren'Py would just continue on to show the next line of text.

Say we wanted to do some more things. We could write:

Code: Select all

scene bg washington:
    size (800, 600) crop (0, 150, 400, 300)
    linear 2.0 crop (0, 0, 800, 600)
    pause 2.0
    linear 1.5 crop (400, 150, 400, 300)

pause 5.5
The new pause 2.0 line puts in a 2 second pause - ATL does nothing. The new linear 1.5 crop (400, 150, 400, 300) line takes 1.5 seconds to zoom back in to a new crop box - this one on the right side of the image. Since the transform now takes longer, we use pause 5.5 to make the pause proportionally longer.

If all you're doing is Ken Burns-style pans, this concept - crop and resize - is all you need.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Learning Renpy ATL Language... One Last Time

#3 Post by KimiYoriBaka »

here's the simpler, less elegant way to do it, based on your actual examples

1.

Code: Select all

show fountain:
    pos (0.0, 0.0)
    linear 30.0 pos (0.0, -1.0)
this places the picure at the top of the screen, then moves it up one screen taking 30 seconds to do so.

(btw, 30 seconds is a really long time...)

2.

Code: Select all

show desert:
    pos (0.0, 0.0)
    linear 30.0 pos (-1.0, 0.0)
same as above, but using the x coordinate. notice that this way of doing it moves the picture, not the screen. probably less efficient, but whatever

3.

Code: Select all

show burger:
    pos (0.0, 0.0)
    linear 30.0 pos (-400, -400)
this time, moving to a position using the pixel coordinates instead of a fraction of the screen. these are negative because it's from the top-left corner of the picture, which needs to be that far off the screen

4.

Code: Select all

show burger:
    pos (0.0, 0.0)
    linear 30.0 zoom 1.5 pos (-400, -400)
at least, I think this is how zoom works...

5.

Code: Select all

show burger:
    pos (0.0, 0.0)
    linear 30.0 pos (-400, -400)
    pause 2.0
    linear 30.0 pos (-800, -400)
good luck!

User avatar
asatiir
Regular
Posts: 86
Joined: Tue Oct 01, 2013 6:04 pm
Completed: Within the Walls (Twine)
Projects: Roses Will Rise
Organization: Asatiir's Tales
Skype: asatiir
itch: asatiir
Location: Dubai, UAE
Contact:

Re: Learning Renpy ATL Language... One Last Time

#4 Post by asatiir »

I tried making use of ATL for panning and got this error.

Code: Select all

I'm sorry, but an uncaught exception occurred.

Compiling ATL code at game/thewall.rpy:37
  File "game/thewall.rpy", line 35, in script
TypeError: 'float' object is not callable

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

Full traceback:
  File "C:\renpy-6.16.1-sdk\renpy\execution.py", line 288, in run
    node.execute()
  File "C:\renpy-6.16.1-sdk\renpy\ast.py", line 1009, in execute
    show_imspec(self.imspec, atl=getattr(self, "atl", None))
  File "C:\renpy-6.16.1-sdk\renpy\ast.py", line 939, in show_imspec
    atl=atl)
  File "C:\renpy-6.16.1-sdk\renpy\exports.py", line 350, in show
    sls.add(layer, img, key, zorder, behind, at_list=at_list, name=name, atl=atl, default_transform=renpy.config.default_transform, transient=transient)
  File "C:\renpy-6.16.1-sdk\renpy\display\core.py", line 721, in add
    thing._show()
  File "C:\renpy-6.16.1-sdk\renpy\display\motion.py", line 849, in _show
    super(ATLTransform, self)._show()
  File "C:\renpy-6.16.1-sdk\renpy\display\motion.py", line 836, in _show
    self.update_state()
  File "C:\renpy-6.16.1-sdk\renpy\display\motion.py", line 697, in update_state
    fr = self.function(self, self.st, self.at)
  File "C:\renpy-6.16.1-sdk\renpy\atl.py", line 356, in execute
    self.compile()
  File "C:\renpy-6.16.1-sdk\renpy\atl.py", line 337, in compile
    self.block = self.atl.compile(self.context)
  File "C:\renpy-6.16.1-sdk\renpy\atl.py", line 481, in compile
    statements = [ i.compile(ctx) for i in self.statements ]
  File "C:\renpy-6.16.1-sdk\renpy\atl.py", line 738, in compile
    duration = ctx.eval(self.duration)
  File "C:\renpy-6.16.1-sdk\renpy\atl.py", line 186, in eval
    return eval(expr, renpy.store.__dict__, self.context) #@UndefinedVariable
  File "<string>", line 1, in <module>
TypeError: 'float' object is not callable

Windows-7-6.1.7601-SP1
Ren'Py 6.16.1.409
A Ren'Py Game 0.1alpha
Image
Image

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Learning Renpy ATL Language... One Last Time

#5 Post by Alex »

Haven't you name one of your variables as "float"?
http://www.renpy.org/doc/html/reserved.html

What's the code you are using?

User avatar
asatiir
Regular
Posts: 86
Joined: Tue Oct 01, 2013 6:04 pm
Completed: Within the Walls (Twine)
Projects: Roses Will Rise
Organization: Asatiir's Tales
Skype: asatiir
itch: asatiir
Location: Dubai, UAE
Contact:

Re: Learning Renpy ATL Language... One Last Time

#6 Post by asatiir »

Sorry, but what do you mean by naming a variable?

I forgot to include the code:

Code: Select all

scene bg landscape:
        pos (0.0, 0.0)
        linear 30.0 (-1.0, 0.0)
    with dissolve
Image
Image

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Learning Renpy ATL Language... One Last Time

#7 Post by Alex »

Try

Code: Select all

scene bg landscape:
        pos (0.0, 0.0)
        linear 30.0 pos (-1.0, 0.0)
    with dissolve

User avatar
asatiir
Regular
Posts: 86
Joined: Tue Oct 01, 2013 6:04 pm
Completed: Within the Walls (Twine)
Projects: Roses Will Rise
Organization: Asatiir's Tales
Skype: asatiir
itch: asatiir
Location: Dubai, UAE
Contact:

Re: Learning Renpy ATL Language... One Last Time

#8 Post by asatiir »

Worked, thanks!
Image
Image

User avatar
nyulyasha9696
Regular
Posts: 26
Joined: Tue Dec 09, 2014 2:16 pm
Contact:

Re: Learning Renpy ATL Language... One Last Time

#9 Post by nyulyasha9696 »

KimiYoriBaka

Wow, thank you for so simple and short examples! It really helped.

User avatar
shivanshs9
Regular
Posts: 54
Joined: Sun Jul 20, 2014 1:59 pm
Projects: The Destiny(http://thedestiny-cxz.blogspot.com)
Organization: Cyber-X-Zone
Location: India
Contact:

Re: Learning Renpy ATL Language... One Last Time

#10 Post by shivanshs9 »

You don't have to feel discouraged, Uncle Mugen, just after hearing words from an arrogant know-it-all! I haven't been in this community for a long time, but I know how you feel looking at those long codes and wondering how that works exactly; since it's the same for me...
Moreover, your BGs and helpful Ren'Py demos really helped me when I was a sole loser here. I bet that even those arrogant coders won't be able to get the better of you in arts, so feel proud for what you've done and can do! And, your funny jokes would always get me out of sadness! So, in my opinion, you are better than those insensitive programmers. Now, I posted some codes as examples:
WARNING: The codes are not yet tested! I am currently around 350 kms far from my computer, so I am posting this from my mobile without, obviously, Ren'Py for testing.TESTED!
I only felt that behavior 4 and 5 might be worth a serious challenge, since the previous 3 behaviors are already explained by PyTom and are also explained in these behaviors...
Behavior 4:

Code: Select all

scene image_03: # image_03.png
    size (800, 600) crop (0, 0, 800, 600) # Same as PyTom's explanation
    linear 30.0 crop (400, 400, 200, 150) # Crops at (400, 400), while zooming in by 25%, i.e. (25/100)*800=200 and (25/100)*600=150
# WARNING: Not sure if width and height should really be 200 and 150 for zooming in 25%...
Behavior 5:

Code: Select all

scene image_03:
    size (800, 600) crop (0, 0, 800, 600) # Sets the initial size for the image
    linear 30.0 crop (400, 400, 800, 600) # Pans to (400, 400) in 30 seconds
    pause 2.0 # Your specified pause...
    linear 30.0 crop (800, 400, 800, 600) # Pans to x=800 from x=400 in 30 seconds
You can ask if something's not clear because I have no confidence in my teaching abilities...
And, don't doubt yourself for not understanding... After all, not everyone is a born scientist. Professional coders themselves learn by experimentation and patience... and self-confidence too!
And this community is itself made for new and creative experiments to learn from...
So, don't hesitate to experiment and explore!

------EDIT------
I just noticed KimiYoriBaka's post and I am sure those work as well... You can consider these as alternatives to pos... I guess, due to my mobile's small screen, I skipped through that post...
"Destiny is a no matter of chance
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."

-William Jennings Bryan
If you can dream and not make dreams your master;
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: Learning Renpy ATL Language... One Last Time

#11 Post by bloodyhair »

thank you very much

Post Reply

Who is online

Users browsing this forum: AWizardWithWords, Google [Bot]