Modding Guide: Part One

Place for sharing your game modifications for Life is Feudal: Your Own

Maegfaer
Mod Developer
 
Posts: 246
Joined: 26 Sep 2014, 08:01

Modding Guide: Part One

Post by Maegfaer » 27 Oct 2014, 15:20

Introduction

This is the first part of my series of guides on modding LiF:YO dedicated servers. In these guides it is assumed the reader has basic computer skills and knows for example how to modify data in a SQL database.



On server<->client communication

Almost all PM's I receive with modding questions begin with "I changed X in the server database/XML files but it makes no difference in the game!", so let my address this mystery first.

The core problem here is a wrong perspective on the communication between the clients and the server. Most people seem to assume that the server determines for example the capacity of a Warehouse, and that the server sends this information to the client, which displays it to the player. This is not the case, because it would increase the server load needlessly. Every client connecting to the server would need to receive all this game data, every time the client reconnects.

Instead, game data like the capacity of warehouse is configured both on the client and the server. The client simply uses it's local data to display a value like the Warehouse capacity to the player, and will also refuse a deposit if it would exceed it's (client-side) capacity. The server doesn't even come into play (yet). This is the reason why your server-side changes didn't seem to work.

The server does come into play when the client accepts the deposit. The deposit is send to the server, which also checks if the deposit does not exceed the Warehouse capacity on the server side. If it passes, the deposit takes effect, if not, the server replies to the client that it was denied after all.

So in the end, the server has the final say on pretty much everything, but very often the client has the first say. It works like this to minimize the data transfer between the server and the clients, since that is the bottleneck on scalability of networked multiplayer games.

This means that a lot of modifications need to be done both server and client side in order to work properly. A notable exception is damage values for weapons/armour and damage calculations. If you think about it with the above in mind, it should become pretty obvious why client-side damage values and calculations would be useless. Another exception is Claim time values.



On the patch.sql file

In the server files there is the file sql/patch.sql. This file contains SQL queries for the official patches. The patch.sql file is executed every time your server is restarted, and may revert your mod's changes, for example Claim times.

In my experience this patch.sql file only needs to be run once after every patch, and can then be deleted. It is remade after every official patch. You could also edit patch.sql file to edit out the conflicting patch changes if you don't feel comfortable with deleting the entire file.



How to's

In this part we'll discuss the easiest of modifications, namely the ones that only require adjustments in database tables and in XML files. All relevant XML files can be found in the Data directory, on both the server and the client.

How to adjust container capacity and what types of objects can be stored in a container
Spoiler
How to adjust an object's Claim time
Spoiler
How to make an unclaimable object claimable
Spoiler
How to adjust an object's weight
Spoiler
How to allow a building to be set as a Home
Spoiler
How to adjust Skill experience gain when using abilities
Spoiler
How to change the welcome message on login
Spoiler
How to change armour protection values
Spoiler
How to change recipes and their requirements
Spoiler
How to reconfigure Skill lines
Spoiler



Final words

Feel free to make requests, although in this part I'll only handle XML-files and database changes. If you can think of your own how-to's, you can post them here and I'll add them to the OP with credits.
Pioneer LiF:YO modder
Author of Life is Balanced
My Modding Guide

Image

Return to Game mods