Forum rules - please read before posting.

Thimbleweed Park shake effects

edited April 2017 in Engine development
Hi Chris & community,

I have started playing the *latest* masterpiece of Ron Gilbert, Thimbleweed Park, and I noticed something I would like to have in my AC game as well.

I am talking about the "shake" effect on things, such as:
- dialog options on mouse-over, for a nice feedback
- inventory items, when non-examined, so that the user has a reminder to examine them

How could I reproduce these two effects? Do you think this will be coming with a future AC version?

Thanks & enjoy playing & making games! :)

Comments

  • Let's hope it's "latest masterpiece" and not "last masterpiece"! :-)

    I have an effect like that somewhere on my hard drive - picked it up from one of the Unity forums last year. It's more of a general Unity thing than AC related, and I personally find it completely annoying.

    Will share here when I'm done playing Thimbleweed Park!
  • edited April 2017
    hehe Snebjorn, I corrected the post! Obviously I meant latest :D (I'm not a native speaker!) Let's hope Ron Gilbert will now get the rights to work on the real Monkey Island 3...!!

    And regarding the effect, I was thinking it should be integrated under the hood in AC because of it being in dialog choices and inventory items -- that I believe requires some experienced hands: even if I had the effect, I would not be able to do that without going thru AC's code.

    Ah, I also remember that he said he would open-source the engine he developed for TWP. That will be interesting!


  • Definitely interesting!

    Adventure Creator was actually suggested by someone in the comments on the Thimbleweed Park blog many moons ago. Now that I'm finally playing the game, I find myself thinking it might have been the correct choice.
  • edited April 2017
    The game looks interesting. I would like to see those effects too :), but, man, Snebjorn's the "latest masterpiece" comment was awesome, lol.
  • I did actually talk to the main man about AC back before the KickStarter, but his interest was more about learning what tools were currently available.  He has a preference for writing his own tools from scratch - even if similar ones are out there - and that's something I can definitely relate to!

    Even somewhat simple animations in the menus are something that the OnGUI-based Adventure Creator menu system isn't really up to, but that's really what the intention is behind AC's Unity UI integration - to empower the user to add on such effects through custom scripts and events.

    The ability to shake a UI Button could be done either through regular animation, or a fancy script-based solution, so the real issue is how to connect it to AC.  For that, look to AC's Event system - see this tutorial if you're unfamiliar.

    The event you'll want to hook up to is OnMouseOverMenu, which has parameters for the Menu, Menu Element, and slot number being hovered over by the mouse.  You can use these parameters to work out if the user is currently hovering over, e.g. the 1st slot in your Conversation Menu's DialogList element, and animate it accordingly.
  • edited April 2017
    Thank you Chris for your nice reply.

    I managed to make it work, even though there are some limitations.

    I used this (link) script, with some modifications for making it use a Vector2 instead of a Vector3 and a MenuElement rather than a GameObject. Also, I had to extend AC's MenuElement.cs with a "GetPosition" method to expose the x & y coords of the MenuElement. (if anyone is interested in the code, just ping me!)

    Here's the result:
    image
    But here is my problem: I would like this effect on each separate dialog entry, but (as you can see in the manager) there is only one "DialogList" item for all dialog entries, hence all entries shake.
    image
    Do you have any idea on how I could achieve the effect of having only one single conversation entry shaking? I am not even sure that plugging in UnityUI would solve this problem.

    Thanks!

  • Here the pics. 
    image
    image
  • You can opt to make a DialogueList display only a single option, so you could feasibly separate each option into separate elements.

    However as I said: the OnMouseOverMenu event provides a slot number index parameter - which will be 0 for the first option, 1 for the second, etc.

    AC's built-in menu system is written with the assumption that all slots are drawn together, so it's not possible to do with that mode without some serious hacking.  Using Unity UI for this should be trivial, though - just read the slot number and animate the appropriate UI Button.
  • Ok, I was trying to expose x & y of the slot, but I'd better use my time for implementing Unity UI. So far so good, only problem is that I'd like to use a TextMeshPro Text rather than a normal text object, but this is not supported yet -- will there be an official integration soon?

    If not, which scripts & what kind of effort do you think it'll be to replace the Text objects with Textmeshpro objects in AC's code? I gave a brief look and I saw that there is all the text-styling part to be adjusted, together with the #includes and the declarations..

    Thanks !
  • Unity have stated that TMPro will come built into Unity directly.  When that happens, I'll provide an official integration - but until we know the exact form it takes within Unity itself it makes sense to hold off for now.

    I have, however, written a guide for an "unofficial" integration between the two on the AC wiki here: http://adventure-creator.wikia.com/wiki/Text_Mesh_Pro_integration
  • edited April 2017
    Super clear, thank you so much!!

    You are the best!!

    Just one last question under an architectural point of view: where would you suggest to add the script for menushaking? I made it a Monobehavior (not a ScriptableObject) so I can use coroutines, but now I have to attach it to some GameObject. I am adding it to the GameEngine which contains all other scripts, do you thing this is the right place to have these listeners?

    Thanks !
  • Better to add it to the UI prefab itself, IMO.
  • Perfect, thanks!
  • edited April 2017
    Sorry, I have one more question. Hope to not take up too much of your time.

    Is there a generic way to reference a UIObject using its linkedUiID? (which I assume is the ConstantID)

    I am looking for a method where the function "GetUiObject(int linkedUiID)" would return an object of type UnityEngine.UI[.Button].

    My whole shake method would then look like this:

    read MenuSlotInteger from mouseover and its linkedUiID/ConstantID;
    declare a new UnityUIButton called ButtonToShake using the method GetUiObject(linkedUiID);
    run coroutine for shaking my ButtonToShake.

    Otherwise I need to follow a non-generic approach (declare an array of UnityUI Objects, assign them in the inspector(or reference from code), and do some mapping between slots integers and those).

    Thankssssss!
  • Yes, there's one in Serializer - AC uses it when loading save games to convert recorded ID numbers into Remember components.  Usage:

    UnityEngine.UI.Button uiButton = AC.Serializer.returnComponent <UnityEngine.UI.Button> (uiButtonID);

    where uiButtonID is the Constant ID number associated with the Button.
  • edited April 2017
    Works like a charm.

    In the next days I'll clean up the code and make an entry in the Wiki, about this Skake effect, to give back!!

    Thanks again.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.