User Tools

Site Tools


adding_a_new_level

Adding a New Level pt.1

To add new level in Hard Times you have to first create a Scenes folder in your new Mod folder. After that you have to create another folder inside it, named as the scene id we wish to give to our new level. So in the folder

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Scenes

(please note that MyMod_MODPKG is the name of the mod -MyMod actually- we created in the previous guides)
we will create a new folder named Mod_Scene (just an arbitrary id we chose for our new level):

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Scenes\Mod_Scene

The first thing we need to create is a proper Descriptor.json file, containing all the data of our new level:

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Scenes\Mod_Scene\Descriptor.json

Inside our file we will, for the sake of this tutorial, put the following content:

{
  "sceneId": "Mod_Scene",
  "sceneDirectory": {},
  "startingSpawnPointX": 0,
  "startingSpawnPointY": -5,
  "doOverwriteBaseproperties": true,
  "civilianPopulation": 20,
  "civilianGenerosity": 10,
  "copPopulation": 5,
  "fascistsPopulation": 0,
  "forbidPlacingFurnitures": false,
  "minimumTemperature": -100,
  "maximumTemperature": 100,
  "mapRadious": 40,
  "sceneMusic": "TD1",
  "sceneBgSounds": "",
  "playerEffectOnEnter": "",
  "isIndoor": false,
  "isLoosingBags": true,
  "isLoosingMoney": true,
  "loosingCheckInterval": 10,
  "loosingItemProbability": 100,
  "pavementSpriteName": "Pavement/pavement1.png",
  "objects": [
	{
	  "sceneObjectId": "building_b"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/building_1.png",
	  "positionX": -30,
	  "positionY": 5,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 6.96,
	  "boxColliderSizeY": 6,
	  "boxColliderOffsetX": -0.26,
	  "boxColliderOffsetY": 0.23,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": false,
	  "tileSizeWidth": 0,
	  "tileSizeHeight": 0
	},
	{
	  "sceneObjectId": "building_1"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/building_1.png",
	  "positionX": -10,
	  "positionY": 5,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 6.96,
	  "boxColliderSizeY": 6,
	  "boxColliderOffsetX": -0.26,
	  "boxColliderOffsetY": 0.23,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": false,
	  "tileSizeWidth": 0,
	  "tileSizeHeight": 0
	},
	{
	  "sceneObjectId": "building_2"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/building_2.png",
	  "positionX": 0,
	  "positionY": 5,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 6.96,
	  "boxColliderSizeY": 6,
	  "boxColliderOffsetX": -0.26,
	  "boxColliderOffsetY": 0.23,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": false,
	  "tileSizeWidth": 0,
	  "tileSizeHeight": 0
	},
	{
	  "sceneObjectId": "building_3"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/building_1.png",
	  "positionX": 10,
	  "positionY": 5,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 6.96,
	  "boxColliderSizeY": 6,
	  "boxColliderOffsetX": -0.26,
	  "boxColliderOffsetY": 0.23,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": false,
	  "tileSizeWidth": 0,
	  "tileSizeHeight": 0
	},
	{
	  "sceneObjectId": "building_5"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/building_1.png",
	  "positionX": 30,
	  "positionY": 5,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 6.96,
	  "boxColliderSizeY": 6,
	  "boxColliderOffsetX": -0.26,
	  "boxColliderOffsetY": 0.23,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": false,
	  "tileSizeWidth": 0,
	  "tileSizeHeight": 0
	},
	{
	  "sceneObjectId": "building_6"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/building_1.png",
	  "positionX": 40,
	  "positionY": 5,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 6.96,
	  "boxColliderSizeY": 6,
	  "boxColliderOffsetX": -0.26,
	  "boxColliderOffsetY": 0.23,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": false,
	  "tileSizeWidth": 0,
	  "tileSizeHeight": 0
	},
	{
	  "sceneObjectId": "wall_north"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/wall_north.png",
	  "positionX": 0,
	  "positionY": 30.5,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 100,
	  "boxColliderSizeY": 40,
	  "boxColliderOffsetX": 0,
	  "boxColliderOffsetY": 0,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": true,
	  "tileSizeWidth": 100,
	  "tileSizeHeight": 40
	},
	{
	  "sceneObjectId": "wall_west"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/wall_west.png",
	  "positionX": -48.5,
	  "positionY": 0,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 3,
	  "boxColliderSizeY": 58,
	  "boxColliderOffsetX": 0,
	  "boxColliderOffsetY": 0,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": true,
	  "tileSizeWidth": 3,
	  "tileSizeHeight": 58
	},
	{
	  "sceneObjectId": "wall_east"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/wall_east.png",
	  "positionX": 48.5,
	  "positionY": 0,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 3,
	  "boxColliderSizeY": 58,
	  "boxColliderOffsetX": 0,
	  "boxColliderOffsetY": 0,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": true,
	  "tileSizeWidth": 3,
	  "tileSizeHeight": 58
	},
	{
	  "sceneObjectId": "wall_south"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Buildings/wall_south.png",
	  "positionX": 0,
	  "positionY": -30.5,
	  "spriteRotation": 0,
	  "isCollider": true,
	  "colliderType": "box",
	  "boxColliderSizeX": 100,
	  "boxColliderSizeY": 40,
	  "boxColliderOffsetX": 0,
	  "boxColliderOffsetY": 0,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": true,
	  "tileSizeWidth": 100,
	  "tileSizeHeight": 40
	},
	{
	  "sceneObjectId": "street_1"
	  "sceneObjectType": "Static",
	  "sceneObjectSprite": "Streets/StreetStraight.png",
	  "positionX": 0,
	  "positionY": -5,
	  "spriteRotation": 0,
	  "isCollider": false,
	  "colliderType": "box",
	  "boxColliderSizeX": 6.96,
	  "boxColliderSizeY": 6,
	  "boxColliderOffsetX": -0.26,
	  "boxColliderOffsetY": 0.23,
	  "boxColliderEdgeRadius": 0,
	  "isTiled": true,
	  "tileSizeWidth": 94,
	  "tileSizeHeight": 5
	}
  ],
  "doors": [
	
  ],
  "shops": [
	
  ],
  "spawners": [
	{
		"modSpawnerId": "trashbin",
		"modSpawnerPositionX": -40,
		"modSpawnerPositionY": -8,
		"modSpawnerRotation": 0,
		"spawnerColliderRadius": 0.5
	},
	{
		"modSpawnerId": "trashbin",
		"modSpawnerPositionX": -38,
		"modSpawnerPositionY": -8,
		"modSpawnerRotation": 0,
		"spawnerColliderRadius": 0.5
	},
	{
		"modSpawnerId": "trashbin",
		"modSpawnerPositionX": -20,
		"modSpawnerPositionY": -8,
		"modSpawnerRotation": 0,
		"spawnerColliderRadius": 0.5
	},
	{
		"modSpawnerId": "trashbin",
		"modSpawnerPositionX": -18,
		"modSpawnerPositionY": -8,
		"modSpawnerRotation": 0,
		"spawnerColliderRadius": 0.5
	},
	{
		"modSpawnerId": "trashbin",
		"modSpawnerPositionX": 20,
		"modSpawnerPositionY": -8,
		"modSpawnerRotation": 0,
		"spawnerColliderRadius": 0.5
	},
	{
		"modSpawnerId": "trashbin",
		"modSpawnerPositionX": 10,
		"modSpawnerPositionY": -8,
		"modSpawnerRotation": 0,
		"spawnerColliderRadius": 0.5
	},
	{
		"modSpawnerId": "trashbin",
		"modSpawnerPositionX": 40,
		"modSpawnerPositionY": -8,
		"modSpawnerRotation": 0,
		"spawnerColliderRadius": 0.5
	},
	{
		"modSpawnerId": "trashbin",
		"modSpawnerPositionX": 38,
		"modSpawnerPositionY": -8,
		"modSpawnerRotation": 0,
		"spawnerColliderRadius": 0.5
	},
  ],
  "fixedFurnitures": [
	{
		"modFixedFurnitureId": "nasone_furniture",
		"modFixedFurnitureUniqueId": "Mod_Scene_nasone_1",
		"modFixedFurniturePositionX": 45,
		"modFixedFurniturePositionY": 0,
		"modFixedFurnitureRotation": 0,
		"isLocked": false,
		"isPackable": false
	},
	{
		"modFixedFurnitureId": "telephone_furniture",
		"modFixedFurnitureUniqueId": "Mod_Scene_telephone_furniture_1",
		"modFixedFurniturePositionX": -45,
		"modFixedFurniturePositionY": 0,
		"modFixedFurnitureRotation": 0,
		"isLocked": false,
		"isPackable": false
	}
  ],
  "fishingSpots": [
	
  ]
}

Wow, this what you call a long file! Don't worry now for the contents, that we will cover in the second part of this guide. The values should be quite straightforward to grasp in their meaning. You can try to tweak them to see what happens! Experiment!

Add the sprites and data referenced in the scene

We referenced a number of sprites and other data in our scene descriptor. So we have now to put it in the appropriate folders.

The Pavement

  "pavementSpriteName": "Pavement/pavement1.png",

Is referencing a pavement sprite file which is to be found in the “Pavement” folder (all fodler names are relative to the scene folder). So let's put this pavement sprite in there: Please note that the pavement file is a tile which should be a multiple of 64 in size and square in shape. Go on and download it in the Pavement folder (create it if needed!):

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Scenes\Mod_Scene\Pavementpavement1.png

Remember that this sprite will be tiled as a texture on all the floor level of the scene.

The Buildings

All the buildings referenced in the scene descriptor make use of one of two sprites we have to put in a folder named Buildings

"sceneObjectSprite": "Buildings/building_1.png",

The two sprites needed are here:

The outer walls

Outer walls are meant as a delimiter for our scene. Scenes in hard times have a fixed size of 100×64 units (as the big neightboroods). You can achieve smaller scenes by placing big walls and thus giving them the shape you desire. You can take a look at the example created with this tutorial to understand better what I mean. So lets put the outer walls sprites in the Buildings folder (since we stated this in the descriptor file)

The Streets

Streets too need a sprite since we lay them on the floor as a static object with no collider. In the descriptor file they are stated as placed inside the Streets folder, so create it and put this file in that folder:

Set this scene as the starting game scene

Now we will set this scene as the starting scene of the game, so that we will have the possibility to try it without having to place doors to navigate to and from this scene to the other scenes in the game.
To do this you will need to create a new PlayerModifier.json file in the root folder of our new mod (at the same level of the Descriptor.json file):

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\PlayerModifier.json

And put those lines in it:

{
  "startingScene": "Mod_Scene"
}

This will tell the game to load Mod_Scene at startup of a new game. Refer to the Modding the Player Guide to get a full grasp of all the things you can edit with this file.

Edit the mod's descriptor file

As usual, we have to notify our mod package that we have scenes to be loaded, if we want them to be loaded at startup. So go on and edit the mod's descriptor file in:

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Descriptor.json

And add the scenesFolder value, setting it to “Scenes” as the name of the folder we created:

{
  "modName": "MyMod_MODPKG",
  "author": "RadicalFiction",
  "gameVersion": "",
  "langFolder": "Lang",
  "itemsFolder": "Items",
  "shopsFolder": "Shops",
  "spawnersFolder": "Spawners",
  "figuresFolder": "Figure",
  "furnituresFolder": "Furnitures",
  "recipesFolder": "Recipes",
  "fishingSpotsFolder": "FishingSpots",
  "questGiversNpcsFolder": "QuestGiversNpc",
  "questsFolder": "Quests",
  "scenesFolder": "Scenes"
}

Test it out!

If everything went well you should now be able to start again the game with no errors(!). Be sure you have your new mod active and start a new game.
If you start brand new game now you will find yourself in our newly added scene. There are no doors to navigate to and from the scene, and no shops too. We will add more stuff in the next guides!!

If you have problems or find errors in this guide please get in touch at info@tempi-duri.net.

You could leave a comment if you were logged in.
adding_a_new_level.txt · Last modified: 2019/02/13 12:09 by thorfinio