How to make a game in which players can add maps / items / missions ?

Started by RemiD, January 29, 2018, 20:57:52

Previous topic - Next topic

RemiD

Hello,

What would be your approach to make a game in which players can add maps / items / missions ?

I want to know the basics, not to make the next elder scrolls  ;)

I see 2 ways :
->provide a map/item/mission editor, that the players can use to import their files and then it exports a map file, item file, mission file, with a format that the game can use.
->provide a "scripting language" (in text files) that the players can use to configure their files (with a compatible format)

Another idea ?

Derron

Similar to the scripting language:

- provide them with predefined stuff
- let them mix the stuff in "configuration files" (defining what to use where and when)


For TVTower I have eg. News. To define new news you are able to define texts, values (quality and so on). Each news(event) could have a flexible amount of effects. Effects are a "class/type" in my game which can get extended to do many things (extension allows to avoid dependencies - effectA accesses "classA", effectB accesses "classB" - but effectA does not need to know about "classB"). So each effect type is registering to the engine (game code) via an unique identifier - eg. "triggernews". Once the engine finds this identifier it passes all given parameters to the individual class (eg "effect_triggernews") which then handles everything.
The news so could define effects which eg trigger other news, modify exposed game data ...  ("modifyAudience", audienceType, value, timespan, ...).
To allow "choose between X and Y" I added other effects which need params for probability of the choices.


For "game changing" stuff I added a class "GameModifier" - similar to the effects different modifiers extend from this base class. Each modfier class again registers with an unique identifier. all of these modifiers are then adjustable via the above described "effects".

In the game there is a lot of these stuff done in a similar way. But at the end I got a XML-file which contains news. These news could trigger other news, make other news available at all, change the popularity of a person (actor, director, singer ...), change the money of a player and so on.


To define basic behaviour of the game I just have a kind of "this game variables"-class (like "game scenario settings"). When starting a game, I load a "DEV.xml" file and all the values there are stored in a data type compatible to the "this game variables"-class (in my case "TData"). So I just can call something like "gameVars.TakeOver(loadedDevXMLVars)".
If I called "DEV.xml" "scenario.xml" you might understand what it is capable of doing.

My XML-files are able to load other XML-files. If you do it properly, you could search the "included files" in multiple directories ("original/", "user/", "scenario/" ...) so that a user / modder might extend files only if needed.

In TVTower this allows to eg. have a XML file containing all the movies - for legal reasons I am using only fake names. Now there is one who wants to translate some movies or use real names. He creates a new file which gots loaded afterwards. Everything he defines there is _extending_ an existing entry. Seems he is like writing a "diff file" (only the changes). Adding a language without altering the original files becomes pretty easy then. But not just that - you can pretty much add your custom "news" to existing "news" (by adding an effect to the original one).


All in all I would think it is similar to a "scripting language". BTW I have a simple expression-language done to enable more fine grained adjustments by the users. They could define some things using "YEARSPLAYED > 0 || (MONEY > 10000 && IMAGE > 50)".

To make sure that everything becomes "scriptable" you will have to just make all the game scenario things in external files - in TVTower there is still a lot to do. Eg. scripting availability of federal states in Germany - to be able to simulate GDR/BRD - Eastern and Western Germany. This is needed as you are allowed to use custom maps (eg. Belgium or "Fantasy Island") which might not have that specific "thing" to handle.

Means I expose more and more stuff from "in game" to "external files".


If you expose your stuff to eg. Lua make sure that external access is limited if needed (so they cannot manipulate some core stuff). Else it is good to expose everything to LUA (or LuaJIT). And instead of calling your update/render in the game loop, you call the lua script's update/render.

For "items", "missions" and so on this would be overkill and I would try to do something in the likes of what I described above with "news" and "effects". So for units you would define them eg. in a XML/json/whatever. Have an area of "spells" and there you assign all the potential spells with their unique identifier. Spells itself could be defined elsewhere - they are defined using "spell visual effect", "spell effect". Spell effect is then healing, damage, dot, ... additional effects, ...
"spell visual effect" would either lead to a predefined effect, or a custom effect. a Custom effect is again a definition of graphics, rotation, alpha-decay, ... and so on.

It depends on how much you want the users to be able to do.


bye
Ron

RemiD

@Derron>>interesting approach.


What i have tried in the past was to build a map by reading the names of the files in the map directory, and each filename contained the properties of the entity, and then the program would use these files and these values to build the map.
example : item-material-moneyvalue-effectkind-effectvalue.b3d


About "scripting language", this is how i started to code : using the scripting language of the game "Morrowind" to make mods, but then since it was too limiting in what was possible to do, i just searched for a way to create my own game (without realizing the amount of work that it takes to create all these images, meshes, textures, riggs, skins, animations, sounds) ;D

degac

About scripting: if the idea is to 'program' in a deeper way the game logic I suspect you need to implement LUA into the game.

Editor: it depends on the game, but basically each 'item' of the game (again, not a clue of what type of game it would be) could have some 'proprieties' and the iteration between them (a cell on the map, an item, an object, enemy or player etc) could rise different reactions.

For example: a tile of the map could have a 'temperature', an object (or an entity) could have a range to 'survive' on it. Or if 'cooked' could be changed in something different or cause another action (explosion)
Or a tile could change (rotate) the path of an entity when walked, teleport, act as a switch to open/close a door, new section, etc
It really depends on what are the 'bricks' (=base items) of the games.
If there's a problem, there's at least one solution.
www.blitzmax.org


RemiD

@Yue>>Thanks, always interesting to see the approach of others coders...

GrindalfGames

You mention only 2 ways. A game editor or a script editor.
But what about Minecraft style, literally edit the level in game. This doesn't have to be voxels, it could be 3D tiles or heightmaps.

IanMartin

Here's how I did it:
http://store.steampowered.com/app/365440/Platfinity/

I wrote that all in BlitzMax.
I used a more everything built in kind of plan.  You can edit on the fly.  It's designed to be as simple as possible, so even kids can use it. 
It is fairly limited in some things though, and designed just for platform games, although one guy made a puzzle game with it(!)  There is no scripting, which is something a lot of people are interested in.
Be advised if you make something like this, there will always be something it doesn't do that people will want.  So it could easily become a case of building it forever.
Or maybe you'll be smarter than me and make it more user extendable?
Platfinity (made with BlitzMax) on Steam:
http://store.steampowered.com/app/365440/Platfinity/