HOW-TO: Make a new world come alive

So you created your first world? Now let’s make it work by adding the Game Definition and Main Quest files.

In the previous tutorial https://cdprojektred.atlassian.net/wiki/spaces/W3REDkit/pages/6325171 we created an empty level - but that’s just the start. If you want your new level to be more alive, then you'll need to add both a .redgame definition file and .quest file. This tutorial explains doing both.

Please note: the scope of this tutorial is to setup the required minimum for a working .quest file. A more detailed explanation of quest creation will be available in a separate quest-creation tutorial.

 

1. Game definition file

Game definition files allow you to start playing the game. They bring together different aspects of the gameplay experience and tell the game where to draw from different elements like camera, quests or simply the player’s starting point.

1.1. Create .redgame file

Open your new World’s main folder in the Asset Browser (CTRL+A) and right click on the background to open the context menu. Choose Create > R4 game definition.

 

Enter a name for the file and create the file.


1.1 Edit the .redgame file

Double click on the new game definition file to see the Game Resource Editor. This is where you will start attaching other files which the game definition will then draw from. As you can see, in our new .redgame file all the fields are empty.

Game Definition properties:

  • worlds - links to world/s which are needed for the quest

  • defaultPlayerTemplate - templates of Geralt and gameplay camera used in game. Geralt’s default player model can be found here: \gameplay\templates\characters\player\player.w2ent.

  • defaultCameraTemplate - the camera we want to use that will follow the player.

  • startingPoint - place in world, where Geralt will be spawned after we start game from this definition

  • mainQuest - link to a quest file, which will be started by this definition

  • mapPinConfig - it’s best to copy the same one which is used in game\witcher3.redgame

  • journalRootDirectory - link to journal, helps refer to the journal structure so that our quest journal can be used in the level.

  • newGameLoadingVideo - what video should be played when the level loads in.

First, to add a slot for the first element in the worlds property, click on the symbol. A new slot is added below where we will attach details about the world file we want to use. Now click the red plus symbol.

Select the World file in the Asset Browser and then click on the green arrow icon ( ) in the world section of Game Resource Editor - this will connect your world to the Game Definition file.

Use this method (select a file in Asset Browser and then add it to the Game Resource Editor) for parameters shown on the screen. For the purposes of this tutorial we can use already available files which you can find by typing their names in the search bar or browse different folders in the Asset Browser.

  • defaultPlayerTemplate → gameplay\templates\characters\player\player.w2ent

  • defaultCameraTemplate → gameplay\camera\new_camera.w2ent

  • mainQuest → the new quest file which we will create for our world.


 

2. Main quest file

Main quest files for a world can define the game structure. They are used not only for quests, but also for placing in spawns, encounters, conditions and more. It's basically a complete graph of all the content of the world.


2.1. Create a .quest file

As with most other new files types, right click on the Asset Browser’s background and from the context menu choose Create > Quest. Enter a name for the file and confirm.


2.2. Build a basic quest graph

After you open (double click) the newly-created quest file, it will start the Quest Editor.

This is where we will build a simple quest graph. To start adding quest nodes right click on the graph’s background and choose a type of node and then the node itself.

The graph and all actions in the game need to begin somewhere. So your first node should simply be Start from the Complexity management nodes.

Now add a Pause node which is useful for adding various conditions.

Select the Pause node on the graph to edit its properties in the top right corner. Start by entering a name which will be displayed above the node in the graph. Let’s name the Pause node: isPlayerPresent.

Add a slot in conditions (), then open the Class selector () and choose CQuestTagsPresenceCondition.

Enter PLAYER in the tags condition. We will get back to this tag a bit later.

Connect the hooks between the two nodes we already have in the graph. Now let’s add a Hide/Show layers node.

Connect the Hide Layers node to the previous node.

Now we need another Pause node which will add a short delay and allow the world to load in everything. Add the Pause node (Flow control > Pause) and edit it’s properties in the top-right corner.

The name and comment are visible on the graph and serve an informative function. In the condition, choose the CQuestHiResRealtimeDealyCondition and below specify the delay’s length.

Okay! Let’s tell the quest graph when it should Spawn Player’s Vehicle… so, Roach!

Let’s connect all the nodes together and this is how our graph should look at this point.

It’s time to jump back to the main editor window.


2.3. Adding new layers

Back in Editor your new world should be loaded. In the Scene Explorer right click on the main world folder and choose Add group and name it - this will a folder in which we can add more layers.

Now right click on the new folder (here: living_world) and choose Add layer.

Name the layer and select an Outdoor build tag and Auto-static type.

The new layer can be found in the group / folder in the Scene Explorer.


2.4. Spawning area for NPCs

We need to create a Spawn Area where NPCs like Roach can appear in.

Select the roach_area layer (which you created in the previous step) in the Scene Explorer. In the Editor main screen, right click and choose Gameplay > Area > Add Spawn Area.

A small red object should appear in your world.

Make sure you have the debug filters for Areas enabled in View > Settings > Editor options >. Check Areas and VisualDebug boxes - otherwise you will not see the areas.

You can adjust its size, length and height. Use the Move, Rotate and Scale tools from the left sidebar and left-click and drag the protruding elements from the object you are editing.

As we want to be able to reference objects in the quest graph, we first need to add tags in the Properties tab.

Move to the Properties for our spawn_area and in the CNode enter a name like roach_sp.

When this is done, we can go back to the Quest Editor.

Select the Spawn Player’s Vehicle (Horse) node and in it’s properties edit the spawnPointTag adding our roach_sp tag.


2.5. Time to test your quest!

Okay, we are ready for a test run.

First, check if your .gamedef file has all properties set (don’t forget the Quest file we just finished editing) and save it again just to be sure.

Now select the Game Definition file in the Asset Browser and add it in the Editor by clicking the green arrow symbol. Your file Game Definition’s name should now be visible in the dropdown menu. Select it and click the Play_game_from_definition button ().

After the game loads you should see Geralt in the middle of our world and Roach spawned some distance away. You can now call Roach and ride around your level.

Congratulations, this means your basic quest graph and Game Definition file work!


You can now continue working on this project in this tutorial:

 

______________________________________
The Witcher 3: Wild Hunt Complete Edition © 2024 CD PROJEKT S.A. Published by CD PROJEKT S.A. Developed by CD PROJEKT RED. CD PROJEKT®, The Witcher®, REDengine® are registered trademarks of CD PROJEKT Capital Group. All rights reserved. The Witcher game is set in the universe created by Andrzej Sapkowski in his series of books. All rights reserved.