(CF) Spawn Huge Maps with Voting

(CF) Spawn Huge Maps with Voting
By Mad-Eye#2971 on Discord

This package allows a game to spawn a new map each round while the players are in the lobby. Players can vote on the map by stepping on a voting pad showing the name and picture of the map. Because maps are spawned for each round and despawned at the end, each individual map can be near the entity limit for a Crayta game. Games can have different world settings for each map.

Picture of Map Voting Pads

The first version of this package was built for CTF-Roast so players could play several maps instead of just one. This version is slightly changed so creators can use it without modifying any of the templates or scripts from official Crayta blueprints or packages. The most obvious visual difference is I have added a template for an in-world UI to display how long players have to vote for maps instead of adding it to the lobby UI.

Each map can be built from several templates that are loaded in sequence to prevent glitches and performance problems. For example, the Callisto map in CTF-Roast is made from three templates that all spawn at the same origin. The controller waits 4 seconds before spawning each one.

The maps NyaAlchemi and The_Suswitch designed for CTF-Roast are the best showcase of what this package can do so far.

I’ve tried to describe the parts of this package and how to set it up below. Don’t hesitate to ask me if you have questions, find a bug, need help, or want me to add something. :slight_smile:

DEPENDENCY: This package requires the Auto-Respawn package. If you use the voting pads it also requires Local Handler.

In This Package


  • Map Controller: a locator with a script and a script folder.
  • Map Voting Pad: a scripted trigger with a world-space widget, a mesh pad, and a light.
  • Map Voting Timer: a locator with a world-space widget and script for showing how long players have to vote and then the next map.

The scripts and UI

mapControllerScript - controls loading maps and updating UIs
  • Chooses maps to load, controls voting, and updates UIs.
  • If you don’t want voting you can turn it off in the properties to cycle or play random maps instead.

mapController settings

mapPropertiesScript - Add one of these to the script folder on the controller for each map.
  • Each map needs a unique map number.
  • There are options to change the world settings for the map. They will persist until another map changes them.

mapVotePadScript + mapVotePadWidget - These are for the voting pads themselves and are optional.
  • The script submits votes to the controller and controls the UI, the sound, and light for the pad.
  • The mapControllerScript will find all the voting pads automatically by finding this script.
  • The widget has options for fonts and colours.


mapVotingTimerScript + mapVotingTimerWidget - Used to display in-world how long players have left to vote.
  • The script simply updates the widget with either the time left to vote or the next map.
  • The text can be customized in the properties.


mapVotingREADME - a detailed description of this package
  • The readme includes instructions and descriptions similar to this post.


The Maps

In order to have multiple maps in your game you need to make some maps this package can spawn. Each map must be broken into one or more templates. We found it useful to build maps for our game in separate worlds so could always have each of them laid out for working. We then just had to update the templates and test them in the main world.

Each map should have its own spawn points and resultsCamera unless you have designed your game so the same results camera will look good with any map loaded.

Expand Steps
  1. Start with one of the game blueprints that uses game roudns (the shooters, collection, etc). I don’t suggest races right now because I haven’t added race modification to this package yet.

  2. Add a new world to your game from the library. The name doesn’t matter to the scripts.

  3. Build fun map on the new world. The map will need at least one spawn point. These are just locators with spawnScript from the Aut-Respawn package added to them.

  4. You should be able to test it in preview in the new world. For this you can just set up everything in the second world as though your game only had one map.

  5. If the map is large (more than 1000 entities in the performance tab it’s a good idea to split it into pieces. For example, if you build a city street, one template would be ground with props, one would be the buildings on the right, and the other would be the buildings on the left.

The easiest way to do this add a locator for each part, unparent them and make sure they are all at position 0,0,0, then drag the map parts you want into each one in the hierarchy. When you’re done, you can make a template from each locator.

Example hierarchy of a small street map. The three locators are templates.

Caution: If you have a script that references an object in your map (like a switch that raises a lift) it has to be in the same template or script errors will happen when the map spawns and the script won’t work.

  1. Repeat these steps with a new world for each map. When you want to change something in a map you can make the changes, select the locator for the correct template and choose Template → copy to template in the properties pane.

The Lobby

This package goes in the main world where the lobby is.

Expand Steps
  1. Find the Local Handler package in Community Content and install it. Add the LocalHandler template to your User template. This is for the voting packs to work nicely. They show each user what they voted for by playing a sound and lighting up only for that user.

  2. If see a Spawn folder in your User template you can skip this step. Otherwise, install the Auto-Respawn package from from the community content and add the UserSPawn template to your User template. The only property you need to set is the player template. Select Player in the dropdown.

  3. Add the mapController from this package to your game. We need to connect some events sent from the gameController to functions on the mapController.

  • On your gameController (should already be in the hierarchy) find onResultsEnd and connect the event to DespawnMap() on the mapController. Find onLobbyStart on the gameController and connect it to OnLobbyStart() on the mapController.
Example of Event Connections

  • Finally, if you have a separate resultsCamera in each map, make sure the resultsCamera property of the gameController is empty. Then connect its onLebbyEnd event to the SetResultsCamera() function on the mapController. See the picture below for how the events on the gameController look after this step.
  1. The maps will load during the lobby. The lobby time on your gameController should be at least a few seconds longer than the total time you want players to vote plus the time it takes the maps to load. But how long is that? It depends on your maps. Say the vote time is 30 seconds and you have a map made of three large templates. If it takes about 4 seconds for each map to load, it’s probably a good idea to have a lobby of 45 seconds to a minute. The time between loading each piece is adjustable on the map controller if you have any performance issues.

  2. The mapController has a script folder called “maps.” I packaged it with two instances of mapPropertiesScript, but you can add more if you need them. Set these properties as you want. Things to watch for:

  • The map number should be unique for each map. This is how maps are assigned to the voting pads and how the votes are tallied.

  • Add each template for your map to the list in any order.

  • The position is important. Every part of the map spawns at the position and rotation set on this script. You can test this by adding your templates to the world, finding a good position, and then deleting them.

  • The thumbnail will appear on the voting pads only if you upload them as UI images.

  • Not every world setting can be changed. This is a Crayta limitation for now. Not every sky setting is in the API.

  1. Add some mapVotingPad templates to your lobby area if you have voting allowed on the mapController. You should have at least two (or why bother?) and no more than the number of maps the players can choose from. You can have fewer pads than maps (eg 5 maps and 3 pads). The controller will randomly select the correct number of maps to offer the players. The pads have some options for UI text colours. By default they will start white, indicate the leading map in green, trailing maps in red, and switch to gray when voting is complete.

  2. Add one or more mapVotingTimers to your lobby. These are completely optional. They will count down the time players have left to vote and then announce the next map when voting is complete.

  3. Test the game. If you having voting enabled and no players vote the game will pick one of the maps randomlyh.


One of the best features! Fun for players and creators can expand their game worlds without hitting entity limits. Love it! :tada: