Modable bots. Better factory menu. - Smok - 08-12-2016
Lests speak about making game more modable, allowing moders to add new bots to game. This is my proposition.
For now factory menu have a lot of icons - icon for every possible combination of bot and tool. There is no space to add more tools/chasis.
Lets splite bots to combination of chasis and tool. There should be two scrollable lists of parts insted and may be preview of robot with some info displayed. ( concept art level: paint )
These should be soft coded, loaded form .txt files. Here are examples how it could look like:
Chasis code:
Code: //Code name and tags for modders. Name is used to crete Cbot category with combination of tool name. For example TrackedBuilder.
Name = Tracked
Tags = #off-road,#slow,#armored,#basic
//We set model for our chasis.
Model = "folder1/folder2/tracked.mod"
//Adding particle effects and sound to use later in code.
AddParticle("particle1","folder1/folder3/fumes.mod")
AddParticle("particle2","folder1/folder3/tire_tracks.mod")
AddSound("sound1","folder100/folder4/engine.wav")
//Enabling tools for this chasis. It will work two ways. Possible connetions can be set in chasis and tool files for elastic modding.
//It can accept names or tags as arguments. Tags prupose is so modders can make chasis working with tools from other mods wihout even knowing about this mods.
Tools = Grabber,#wepon
Batteries = #basic
//Stats
Armor = 0.3 //reduces damage by 30%
Speed = 10 //max speed in some kind of units
Fly = no //can fly?
Dive = no //can dive?
EnergyDrain = 0.1 //how much energy costs to move x meters
MaxSlope = 45 //Max terraing slope that this chasis can beat. Bot slows as terrain slope gets near to this value. Ty to beat hills with wheeled bot if you don't know what I mean.
Regeneration = 0 //Abbility to regenerate durablity over time
//Cbot special functions to control chasis behavior in game!
creted(){ //when robot is created
playParticle("particle1","fumes",Always); //Add particle effect particle1 to bone fumes that plays whole time robot exists
}
destroyed(){ //when robot is destroyed
playAnim("explosion",Once); //Plays robot animation one time
produce(Wrack1);
}
always(){ //in every frame of game
if(this.isMoving() == true){
playParticle("particle2","tireL",Toggle); //New Particles stops being created if this function is not called
playParticle("particle2","tireP",Toggle);
playSound("sound1",Toggle);
}
}
//There can be much more functions like damaged(),healed(),gotBattery(),recharging(),recharged() etc.
Tool code:
Code: //Basicly like chasis code
Name = Grabber
Tags = #transport,#basic
//Model is automaticly attached to chasis bone called "tool"
Model = "folder1/folder2/grabber.mod"
AddSound("sound1","folder100/folder4/grabbing.wav")
Chasis = #basic //All chasis types from unmoded game
//Should have abilyty to modify chasis stats and overwrite Fly/Dive abilyty.
Armor = -0.1
Speed = 0
//Energy cost will be set in code
//Cbot functions to control tool behavior in game!
cbot:use(int where = 1){ //Special function use called by default on use (Enter key). cbot: = Usable by player in Cbot.
if(load == null){
grab(where);
}
else{
drop(where);
}
}
cbot:grab(int where = 1){ //Not special function, but will be usable in game.
playSound("sound1",Once);
object o;
if(where == 1){
o = radar(Front) //Special radar mode to simulate front grab finding
}
else if(where == 2){
o = radar(EnergyCell);
}
else if(where == 3){
o = radar(Behind);
}
playAnim("armDown",Once);
if (o != null){
abilityGrab(o); //adds object o to load and attached to transport bone
}
playAnim("armUp",Once);
}
cbot:drop(int where = 1){
//... Drop code tl;dw
}
//Gui Buttons
AddButton("image.png",use) //Adds button to gui that calls function use
Battery code:
Code: //Basicly like chasis code
Name = UnstableCell
Tags = #unstable
//Model is automaticly attached to chasis bone called "energyCell"
//Have animation energyLevel lets sey with 100 fames, that reflects energy level in battery. 10% battery will use frame 10 of this anim.
Model = "folder1/folder2/uCell.mod"
Chasis = #basic, Hover, #myChasisMod
EnergyLevel = 15 //how much energy have
Rechargable = no //cant be recharged
Regeneration = 0.01 //regenerates 0.01 energy over second
//Cbot functions to control battery behavior in game!
always(){
if(energyLevel == 0){
destroy(); //autodestruction
owner.destroy(); //destroys robot ovning this battery
}
}
Additionaly game should automaticly add this parts to StatCom, using decription from translation file.
PS. I know it there is many mistakes in this codes, and some things should be designed better, but this is only suposed to convey the basic idea.
RE: Modable bots. Better factory menu. - krzys_h - 08-12-2016
Adding something like this is nearly impossible at the current state of the engine. That level of modability is our goal, but tbh at the current speed of development it won't happen in years.
Some time ago @piotrdz and I have started refactoring of the main CObject class and all code that checks object types with if(type == OBJECT_SOMETHING), but it's far from being able to easily add any new objects to the game at all, not to mention loading them with full specification from files.
Another problem we're working on is designing and implementing animations in new model format and extracting all existing hardcoded animations from code. The new animation format should not actually be any kind of code files, just plain data. So far nobody suggested a good design of that, and that's what we'd really need at this point.
RE: Modable bots. Better factory menu. - Smok - 08-13-2016
Too bad I can't help. I have some skills in c++ but when it comes to game engines, it seems over complicated to me. It would probably took me years to learn everything needed about model and animation formats, and I don't even know where to start.
|