Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Albathroz · Feb 27, 2017 at 03:36 PM · 2drpgtiledwarp

How to make a smart warp system?

Hello everybody. A few months ago I developed a 2D RPG with tiled maps, in that classic Pokémon-style, and I had to create a warp system so the player could go from one map to the other, like in Pokémon, when the screen fades out and the player appears on the other area. And for that, I used Box Collider 2D as triggers, both to warp the player to the next map, and to instantiate the new map. But I had like 10 maps per scene, so each scene had like 30 or more triggers, and I had to assign where the player would appear and where the map would appear in each script manually, and it took a lot of effort, and dozens of hours of work. I'd like to know if anyone has some suggestions of a non "go horse" way of doing, like the one I did. Thank you.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by AlwaysSunny · Feb 27, 2017 at 03:36 PM

Yowza, that sounds like a lot of work!

Depending on how you've got your scenes and logic set up, there may be superior ways. As with all things programming, different situations call for different solutions. YMMV.

It sounds like a job for a map editor. Imo, this is a scary term that drives newcomers away. A map editor is just a suite of tools that help you work smarter, and you can build them one at a time for specific tasks like this.

Your tool could've offered you a button that somehow marks the warp tiles - departure and arrival - with metadata that makes them "know" each other. This could've been automated to the degree that you could've set up each warp with a few clicks.

How to best add that markup - e.g. automatically creating BoxCollider helper objects and automatically cataloging them for easy inspection - will vary from case to case.

Creating tools for yourself is often a good way to think about problems: Not just how to solve XYZ problem, but how to solve it a hundred times down the road very efficiently.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Albathroz · Feb 27, 2017 at 06:10 PM 0
Share

Thanks for you answer! The map editor I use is Tiled, and I don't think it has something like a s$$anonymous$$dy warp system, so maybe I need to find another tile editor, one that fits my needs better. Thank you again.

avatar image Bunny83 · Feb 28, 2017 at 01:22 AM 0
Share

I don't know the "classic Pokémon-style" as i never played such games ^^. However teleporting to a new map / area has been implemented in many games. For example even Halflife needed some way to match the newly loaded map to the old one and it does that "seamless". Halflife usually uses a point entity called "info_landmark". Those have a unique name. The trigger that actually changes the level will use one of the landmarks for the transition. There has to be a landmark with the same name in both levels.

When the transition happens the game will calculate all positions of entities that should be taken over relative to the landmark of the old level. When the new scene is loaded it does the reverse. The easiest way would be to temporarily add all those objects as childs to the old landmark and mark the landmark with DontDestroyOnLoad. When the new scene is loaded you would simply move the old landmark at the same position (and maybe even orientation) of the landmark in the new level. Unparent all objects and destroy the old landmark.

One level can have several landmarks for different transitions, just ensure that the names / IDs / whatever are unique and always have a matching partner in the other scene. Setting up those landmarks should be fairly easy. Though a little editor tool never hurts ^^.

avatar image Albathroz Bunny83 · Feb 28, 2017 at 04:46 AM 0
Share

I think I understand what you're suggesting. It's a very advanced way (at least to a peasant like me). Thank you man :)

avatar image
1

Answer by Bluestone19 · Feb 28, 2017 at 04:07 AM

Just some basic suggestions: If you haven't already, make a warp zone prefab, to cut down on some time. If the maps are in the same scene, you could make a "link warp zone" prefab consisting of two warp zones that warp to each other, possibly changing the destination slightly if necessary to facilitate player direction. Make use of public variables to streamline fine-tuning if necessary.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Albathroz · Feb 28, 2017 at 04:43 AM 0
Share

I think the way you're suggesting is a smart version of what I did : I used a script with public float variables for the x and y coordinates, so I could assign where the player would warp to. Bu I had to do manually it for every single warp trigger in each scene, and in the end my hierarchy was polluted with more than 30 game objects just for the triggers, and in the end of the third month of development, my brain was melting down due to the confusion I created on the hierarchy. Thanks for the suggestion dude :).

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What is wrong about this script / why cant the player walk up and down? 1 Answer

2D Player too small but was normal before 2 Answers

search for a 2d rpg toolkit 0 Answers

How do 2D RPG Games customize avatar sprites with different items and armor. 2 Answers

Character Not Moving RPG Game 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges