Repository navigation
Creating and Customizing the World
This will teach you how to make the server create and load a new world in database to you edit it
- Create a new js file named with your world name in
database/worlds/mynewworld.js

- Add this entire code for creating a new table in flublade_worlds on your database
//Dependencies
const Sequelize = require('sequelize');
const { worldDatabase } = require('../../start-server');
//Database tables
const world = worldDatabase.define('newworld', {
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
allowNull: false,
primaryKey: true
},
identification: {
type: "varchar(500)",
defaultValue: "I am Visual Only"
},
attribute: {
type: "longtext",
allowNull: false,
defaultValue: "{}"
}
}, {
//Disable defaults from sequelize
timestamps: false,
createdAt: false,
updatedAt: false,
});
//Create table if not exists
worldDatabase.sync();
//Exports globally
module.exports = worldDatabase;
- Configure your world in the world.js file located in
database/worlds/world.js
//Load my new world
const mynewworld = require('./mynewworld');
worlds.push(mynewworld);
- Start the server
- After fully started the server close and edit your world in database
The world can be changed through the database in attributes section, by the recomendation is good to you to make a new column for each attribute you add in the world, add a good identification to easily know what column will do, also if you are crazy you can do everthing in a single column.
You can edit the navigators but is not recomended, editing navigators will not update the player that already have loaded the chunk, the navigators tables is auto generated by the server after loading all maps and worlds, this means the navigators is temporary and can be reseted in server start and shutdown
The attributes column is a JSON and can be reapeated, this means you need to put a number after the attribute example: setTiles0
Allows you to specific the tiles in the world
chunkCoordinate: will tell the server what the coordinates to tiles to be appear
Required
title: Shows a title when the players enter in the chunk, empty strings means no text or not overwrite previous chunk text
tiles: specifies what the tile will be show, must contain a map 15x15, the number 0 means to not overwrite, that allows the user to overwrite a specific tiles in chunks, the chunk order to be load is in the world.js file in
database/worlds/world.jsRequired
Full Example
{
"setTiles0": {
"chunkCoordinate": "0,0",
"title": "My World",
"tiles": [
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
]
},
"setTiles1": {
"chunkCoordinate": "0,1",
"title": "My World",
"tiles": [
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
]
}
}
Add new entity to the world spawn, such as enemy or friendly, can also have quests and static talks
name: defines the name of entity
Required
coordinate: defines the position in X and Y, example: "201,22"
Required
spawnTimer: in seconds, tell the server the timer to respawn the entity after dead.
Default: 1000
type: will tell if hes is a "agressive","neutral","passive","friendly", the agressive will always want to attack the play, the neutral will need for the player action first for attack, the passive is a special entity that can be interact and drops the loot, the friendly is a talkable and interactive entity.
Default: "friendly"
drop: drop specific itens for the entity.
Default: "{}"
Drop Example
TO DO
trainerType: if the entity is a trainer player can interact with him to train and learn new skills, "archer","assasin","bard","beastmaster","berserk","druid","mage","paladin","priest","trickmagician","weaponsmith","witch".
Default: "none"
talk: defines the talks for the entity.
Default: "{}"
Talk Example
TO DO
Full Example
{
"setEntity": {
"name": "Custom Entity",
"coordinate": "10,15",
"spawnTimer": 1000,
"type": "friendly",
"drop": {
"wooden_sword0": {
"chance": 0.8,
"quantityMin": 1,
"quantityMax": 2
}
},
"trainerType": "berserk",
"talk": {
"greetings0": "language_example_greetings0"
}
}
}