What's new in the RPG Creation Kit 2
In this page you'll find an explanation of the new systems and changes that arrived with the release of the RPG Creation Kit 2.0.
Show/Hide Demo Files
The first change to the Editor Tools is the addition of a toggle named "Show Demo Files?". When toggled on, the respective Editor (such as "Rck Object Viewer", "Cell View", "Quests", "Rck AI Editor", etc.) will show files related to the Rck Demo. As you can imagine, toggling it off will hide from the lists content related to the demo.
This will be pretty useful when you'll be deep into creating your own content and the Rck items will get in your way as you're trying to find or search for things.
Each asset that can be hidden has now a flag "IS_DEMO_FILE", that will act as the flag that hides/show results:
So as you'll make new content it will be enough to disable this flag for your own items.
You can also set the default value for the "Show Demo Files?" toggle to be on/off whenever you open your project by going in "Edit->Project Settings-RPG Creation Kit" and setting the value of the toggle there. Setting it off will make sure that whenever you open a window like the "Rck AI Editor" the demo files will be set to be hidden by default.
Toolbar Functions
The main toolbar, located in the upper part of the Editor, will now have three more buttons related to the RPG Creation Kit:
- Load Last Save: allows you to Start playing in the Editor and automatically loads the latest savegame (or autosave) you have. It's an incredibly helpful tool that allows you to quickly jump in game to view your edits.
- Load Last Cell: does the opposite. It loads the last cell that you've loaded via the Cell View or Cell Map View. It's best used along with the Load Last Save button t.
- Adjust Time Of Day (ToD) Preview: is a slider that sets the Time of Day for your selected "Time of Day Sky Material" (set in the Project Settings). It sets the "currentTime" value in the Sky's material and it updates the scene lighting in base of this value. It's useful to preview a Cell (or many cells) in the Editor at any given time of the day.
Time of Day
The Time of Day feature adds the concept of time inside of the RCK.
Days consist of 24hrs and there's currently no convention for Days/Months/Years, which is something that can be extended from this system.
A GameObject named "TimeOfDayManager" has been added to the _WorldLoader_ scene, and it has a component with the same name as the Object that is, in fact, the manager of the time system.
- Current Time [0-24]: explicit the current time of the day. This can be set when the game starts, when a save game loads, and it can be arbitrarily set from other scripts. For example, the script "JustAnotherDeliveryStage10".
- Hours and Minutes: are derived from the Current Time, and they're useful for you to read in order to create dynamic scenarios based on the current time (see next section "Dynamic Responses to Current Time") or to display the current time on the UI.
- Current Time Scale: dictates how quickly time passes. The formula that runs on Update is is:A Time Scale of 1 means that one hour passes every second, so for the default value of 0.05, a full day (24hrs) 480 seconds or 8 minutes. You can also set this at runtime whenever you want, although runtime changes are not saved on the save-file (the value you set in the inspector will be loaded when a savegame is loaded).
SetTime(currentTime + (currentTimeScale * Time.deltaTime));
- Skybox Material: is a reference to the material that you're using in your world. If you want a different Skybox material you'll have to change this reference (to update it in game) and the reference in Project Settings (to allow the ToD slider to correctly preview the skybox in the editor). In the RCK default configuration there is only one Skybox Material that contains 3 Cubemaps that represent Day, Dusk, Night, that are blended in base of the Current Time Value. You can swap the Skybox Material reference if you want, even during runtime, but you'll also have to do so in the RenderSettings.
The next values "Sun & Moon" allows you to fine-control the lighting of your scenes as time passes.
- Sun Light: is a reference to your main Directional Light (sun) that is also in the _WorldLoader_ scene.
- Sun Color: is the sun's color.
- Sun Intensity: allows you to set a curve that controls the intensity of the Sun's light as time goes by. So the value at the beginning of the curve would be the sun's intensity at hour 0:00, while the last value is at the very last minute of the day 23:59.
- Ambient Color/Intensity: allows you to define gradients that controls the ambience of your scene at runtime. The gradient is also distributed over the currentTime, so you can have dark ambient settings at night and more light ones during the day.
- Fog Color/Density: allows you to do the same but to the fog setting of your scene.
The values set in here are to be thought as the "default" values.
However, you probably want control over ambience/fog for each worldspace and even for each cell.
The Worldspace data has also been given these properties, to allow you to customize your worldspaces as you wish.
- Global_TOD_ENABLE_SKYBOX_AND_LIGHTING_EDITS: if set to true it will mean that the default 'Time of Day Manager' values we've set previously for Ambient/Fog will be overridden by the Worldspace when the player will be in that worldspace.
- The rest of the values are the same as explained previously, with some additional tweaks such as fog start/end and modes.
The same concept applies for individual Cells:
- Local_Override_ToD_Setting: determines whether to inherit the
TOD_ENABLE_SKYBOX_AND_LIGHTING_EDITSsetting from the parent Worldspace or use the local booleanLocal_TOD_ENABLE_SKYBOX_AND_LIGHTING_EDITSdefined on this Cell. If Local_Override is false,Local_TOD_ENABLE_SKYBOX_AND_LIGHTING_EDITS has obviously no effect. - The rest of the values are the same as explained previously.
So the idea is that you would have ambient/fog responsive to the Time of Day (set at a worldspace level) for exterior worlds, and you can decide to override it for interiors (such as always-dark dungeons). But, you can also make interiors (such as houses with windows) whose Ambient lighting responds to time of day.
Dynamic Responses to Current Time
This whole Time System goes well together with the Scripting System of the RPG Creation Kit and in general with the component-based architecture of Unity.
We can query at anytime the Current Time of day, also as (Hour::Minute) and dynamically make things happen, or prevent things from happening. This allows you to create content that depends on time of day, such as dungeons that are only accessible at night, events that can only happen at a certain time of the day, and this also allows for Dynamic NPCs routines.
In the RCK demo we have 5 examples:
- NPCs equip torches at night. [RckAI_EquipTorchAtNight.cs]
- Shops in the city close at night. [CityInterior_LockShopsAtNight.cs]
- The "Killing Monsters" quest can be only completed during the night (22:00 - 05:00), because the door entrance will be locked during the day [Virrihael_LockUnlockVampiresDungeon.cs].
- Merchants in the City simulate stop working at night and simulate going in their houses [CityInterior_StallOwnersGoToSleep.cs].
- The windows of the houses in the city will be lit at night [CityInterior_TurnHouseLightsOn.cs].
Let's see the NPCs equip torches at night example.
You can attach the RckAI_EquipTorchAtNight component to any NPC prefab you have. Such as "CityGuard004" shown below.
This component acts as a "manager" or "controller" for the NPC actions that have to depend on time.
The logic for this example is very simple, if the CurrentTime is greater or equal of what we consider the start of the day (dayStartHour), and the CurrentTime is lesser than what we consider the start of the night (nightStartHour), we should not have a torch equipped.
Otherwise, we should equip a torch. This simple logic is present in the script "RckAI_EquipTorchAtNight", that subscribes to listen to OnHourChanges event.
So everytime there's an hour change we can run the check to equip/unequip the torch.
public void HandleOnHourChange(int curHour)
{
if (ai == null || ai.equipment == null || ai.isInOfflineMode || !ai.isAlive)
return;
bool isTorchEquipped = ai.equipment.currentTorchInHand != null;
// Equip torch logic
if (curHour >= dayStartHour && curHour < nightStartHour)
{
if (isTorchEquipped)
ai.equipment.Unequip(EquipmentSlots.LHand);
}
else if (!isTorchEquipped)
{
var torch = ai.inventory.GetItem("ITorch001");
if (torch != null)
ai.equipment.Equip(torch);
}
}You can also subscribe functions to the onMinuteChanges or onTimeChanges to have more granular control.
The Scripts are placed on the most suitable GameObject you can think of:
- For RckAI Equip Torch, we place it on the NPC itself.
- For the Door that has to be locked at night, we could place it on the door itself. In my case I prefer to have a "TIME_DEPENDENT_SCRIPTS" GameObject in each Cell, so it will be attached to that game object.
- Same thing for both the houses window's light logic and merchants.
This idea is the whole foundation to build proper NPCs Schedules, that I wish to create and formalize formalized in dedicated assets in a future update.
XP, Leveling & New Attributes System
Sprint Attacks / Skills
Class Selection
Other
AI Aggro Lines
AI Perception Improvements
Sneak attacks
Every UI state can pause the game or not
