Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring & improvements to template system #306

Open
Zarickan opened this issue Mar 18, 2018 · 4 comments
Open

Refactoring & improvements to template system #306

Zarickan opened this issue Mar 18, 2018 · 4 comments

Comments

@Zarickan
Copy link
Contributor

The template system could really use an overhaul and better documentation regarding what variables do what etc., while I am not terribly familiar with the codebase I would be willing to help, provided some guidance.

I propose that the templates be moved to the actual mission config, where they can be expanded to support a wide array of more options. With this we would need various supporting functions that help us retrieve the wanted data from the config.

Fx. for vehicles we can not only define just an array of vehicles, but an array of (classes) in the config, where each entry has a vehicle, a price, and a set of animations and textures that are applied to the vehicle when it is spawned (with BIS_fnc_initVehiclel, like the export from virtual garage does).

This would allow for a much greater diversity, and greatly improve support for new features coming with the tanks DLC, like SLAT armor and/or camonets for vehicles.

The config for a vehicle could then look something like this:

class i_apc_03_slat {
    classname = "I_APC_Wheeled_03_F";
    price = 2000;
    animations[] = {"showSLATHull"};
    texture = "Indep_01";
};

Alternatively BIS_fnc_initVehicle supports randomly selecting both what texture is used and what animation are enabled, and could be used instead, or along with a config like this.

@StefArma
Copy link
Member

Interesting!!

@Zarickan
Copy link
Contributor Author

Zarickan commented Mar 18, 2018

Suggestions for the format of the config entries for the factions would be very much welcomed, especially what information etc. should be kept about each faction, infantry, vehicle and such.

Another option would be to have faction information separate from vehicle information, then we would have a config for vehicles, to which the faction config would just reference, avoiding possible duplication.

Perhaps something along these lines (for AAF, given only the Kuma MBT):

class Faction_ind_aaf {
    side = "IND";
    name = "AAF";

    color = "ColorGUER";
    marker = "flag_AAF";

    class Vehicles {
        // MBT-52 Kuma
        class mbt_03 {
            type = "mbt";
            classname = "I_MBT_03_cannon_F";
            texture = "Indep_01";
            animations[] = { "HideTurret", 0, "HideHull", 0, "showCamonetHull", 0, "showCamonetTurret", 0 };
            price = 100;
        };
        class mbt_03_camonet : mbt_03 {
            animations[] = { "HideTurret", 0, "HideHull", 0, "showCamonetHull", 1, "showCamonetTurret", 1 };
        };
    };
};

And a script for spawning a vehicle, given the name in the config and the faction it belongs to:

/*
	Spawns a vehicle as specified in the config for the given faction.
	This also applies any modifications made to the vehicle, as well as choice of texture.
*/
params [
	["_faction", [nil], [""]],
	["_type", [nil], [""]],
	["_position", [nil], [[]]]
];

// Get information
_vehicleEntry = missionConfigFile  >> _faction >> "Vehicles" >> _type;
_classname    = getText (_vehicleEntry >> "classname");
_texture      = getText (_vehicleEntry >> "texture");
_animations   = getArray (_vehicleEntry >> "animations");

// Spawn and modify
_vehicle = createVehicle [_classname, _position, [], 0, "NONE"];
[
	_vehicle,
	[_texture, 1], 
	_animations
] call BIS_fnc_initVehicle;

// Return the spawned vehicle
_vehicle;

@StefArma
Copy link
Member

@Barbolani77

@Zarickan
Copy link
Contributor Author

In addition to the missionConfig we can look for factions/templates in the "game" config file, allowing mods to specify their own for the missions. (As could be done in etc. a RHS compatibility mod).

Thus we should also allow players to either have the factions selected automatically (as is currently done) or specify them before the missions starts, allowing them to select from all the found factions (something like you do at setup in the Dynamic Recon Ops mission).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants