-
Notifications
You must be signed in to change notification settings - Fork 7
Postcards_Stickers
This page is dedicated to a specific feature requested by a user of LUTE who wised to create a game which centered on collecting 'Stickers' which eventually players would place onto 'Postcards' in creative ways. The idea being that one could create various postcards of their visits that reflect that site which could be shared with others and be used as a keepsake of their visits.
Below is a small outline and guide on how to use this specific mechanic within LUTE.
The example scene which is found in LUTESampleExamples>Scenes>LUTEGames>Stickers>StickerBasics contains the main elements of the Postcard/Sticker mechanic. The Flow Engine uses the basic example scene but includes two additional Nodes that create a button to show the Postcard Loading Menu and adds two Sticker Items to player inventory. The Inventory Items can be 'persistent' which allows designers to add items such as Stickers and ensures that players will always have these items unlocked througout multiple plays.
When entering play mode, the items are added to our inventory:

When we use an item without having any postcards open, a new postcard will be created with the Sticker that was chosen placed in the middle of the card. This sticker can be moved, scaled or rotated within the bounds on the postcard. If you carry out the same process when a postcard is open then that sticker will be placed on the open sticker:

You can 'Flip' the postcard and edit the relevant information on the back of the postcard. You can change the title, description and the author of the postcard.

When you are happy with your design, you can submit this which will save the postcard that can be then be loaded using the postcard selector menu. Alternatively, you can 'Discard' the postcard which will simply clear the postcard of any information to be used as a new postcard in the future.
Creating a new Sticker Item is easy. Simply navigate to: LUTESampleExamples>Scenes>LUTEGames>Stickers>Resources>Items. There are two included examples. We suggest duplicating the 'SampleSticker' object and then modifying that object. The items inherit from the base items but only makes use of a few properties:
- Item ID (which should be the same as the name of the sticker object)
- Item Name: the name you wish the sticker to be
- Short and Long Description: these are used to be displayed in the inventory
- The Image Icon: the actual image to be displayed in the inventory and on any postcards
- The Used Sound: what sound will be played when placing this sticker (or use the feedback included on the sticker object is preferred)
- The Sticker Type: what category will this sticker be contained in (used alongside the achievement system). You can add additional Sticker Types in the StickerManager class:
public class StickerManager : MonoBehaviour
{
public enum StickerType
{
None,
Animal,
Nature
}
There are some key classes of the Postcard example scene which can be found in LUTESampleExamples>Scenes>LUTEGames>Stickers>StickerBasics. This includes the main Postcard and Sticker class as well as two manager classes that handle the Postcard UI and systems.
The postcard class is the base for all Postcards. A postcard will have a name, description, a total sticker limit (i.e., how many stickers are allowed to be placed on the sticker where 0 is unlimited), and a creator (or author). There are also several Feedbacks properties which allow you to play sounds or visuals when the player carries out certain actions (such as opening the postcard or submitting a new postcard).

Essentially, a Postcard is a container of the above information which also includes a list of Stickers. When loading into an exisiting Postcard, this information is set automatically into the relevant fields and the stickers are placed based on where their locations were last saved. Stickers can only be placed onto a Postcard canvas and we ensure their positions are clamped using logic contained on the Sticker itself.
A Sticker is a simple class which comprises of a name, description, image and type. Stickers also have other properties you can play around with including the speed of rotation and scale (i.e., how fast you wish the player to modify the sticker) as well as the minimum and maximum scale that the sticker can have. There is also a property for feedback when placing the sticker (we have created a simple feedback but you may wish to create animations or something more complex in code).

When a postcard is submitted, it is automatically saved using the built in saving functionality. This will also save relevant information about each sticker on the postcard as well. This includes its transformation (position, scale, rotation) and all other prior mentioned properties. It is worth noting that when switching screen resolutions or aspect ratios, the stickers positions may seem out of place - this is because they may have originally been placed based on one screen size which will look odd when placed on a screen which is smaller or larger. This should not have much effect when sharing postcards on phone screens but will change a bit more drastically if you switch from a phone to a tablet screen.
The postcard manager is responsible for saving and loading postcards and works with the main Flow Engine of LUTE. Upon saving a postcard, the postcard gets saved as a component on the Engine with all relevant information (again, acting as a container for information not an actual object). We create a list of sticker variables which are used to store information about all the stickers that are on that specific postcard. These objects are then parsed to a json file which is used to store and load information when using the saving system.
Working in tandem with the Sticker Menu class, the buttons that are created at runtime to load saved postcards will call a specific method which is contained on the sticker manager that loads a postcard based on an index.
When Postcard achievements have been implemented the logic for determining whether or not a postcard will complete a specific achievement will be implemented into the Sticker Manager.
The Sticker menu class handles logic related to creating the menu which contains buttons that will load postcards (if any have been saved). The main method of this class will gather any saved postcards from the main Flow Engine, create a series of buttons and then set all relevant information (including the postcard to load) to that specific button. We have created a Carousel style menu but you could change this in any way by customising the prefab itself and/or code is required. Additionally, if you wish to modify the card and button style used in the Carousel menu then you can simply modify the PostcardSelectButton prefab (which uses a title, description and image based on the postcard it will load).

Adding achievements for creating specific Postcards is implementable by creating a PostcardAchievementList scriptable object. This list can be found in the root of the Stickers example or can be created by navigating to 'Assets>Create>LUTE>PostcardAchievementList'.

The list inherits from the base of the original AchievementList so you can use this list to define normal achievements and Postcard Achievements too. A Postcard Achievement inherits from the base Achievement class and therefore you can define it in the same fashion. The key difference is the added 'Postcard Achievement Rules'.

Each Postcard Achievement is defined by a set of rules and can have any number of these rules in any combination. Rules are defined by:
- Total Stickers Required
- The type that these stickers need to be
For example, a simple achievement may require 3 stickers to be placed onto a postcard of any type. A more complex achievement could be comprised of 2 rulesets:
- Place 1 sticker of 'Animal' type
- Place 2 stickers of 'Nature' type
- etc.
Postcard Achievements also have additional unlocking capacities when such an achievement has been completed. This includes:
- Unlocking more sticker items
- Custom events which are driven by exisiting game objects in the scene
Feedback is also played when the achievement is unlocked. This can be defined on the Postcard object itself rather than the achievement rules. We have provided some simple examples in the demo scene but you can expand and get creative!
Note: if you have two achievements that share the same rules (for example, place 3 stickers of any type and place 3 nature stickers), if the player decides to place 3 nature stickers then this will technically count as the same achievement; in this scenario, we unlock the achievement that comes first and players can unlock the next achievement by resubmitting the same postcard.
If you use the achievement menu in your game to show achievements then you do not need to do much when migrating to new Postcard Achievement System. Simply navigate to the 'AchievementCanvas' object and replace the 'Achievement List' property with the Postcard Achievement List:

The same can be applied to Achievement Rules, just navigate to the object where the Achievement Rules are contained and update the property field for the Achievement List to the new Postcard Achievement list you have created:
