Mutators

Ideas and suggestions for how to improve the Warzone 2100 base game only. Ideas for mods go in Mapping/Modding instead. Read sticky posts first!
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Mutators

Post by Emdek »

Those who played Unreal Tournament can skip first paragraph. ;-)

Mutators are concept of modifiers that can alter gameplay which is used in Unreal Tournament (it won't turn Warzone into FPS, so don't say about cloning others ;-)). I don't know how exactly they are internally implemented (well, UT is closed, but AFAIK newest one has free SDK at least) but I guess that they are scripts that hooks into scripts which handles gameplay and modify some values.

In case of Warzone those would be simple JS files (though giving them more possibilities would require turning them into .wz packages) which would hook into existing algorithms to allow to change gameplay aspects like what should happen when oil derrick is destroyed (script would determine what to do using data like derrick completion level, to who it belonged and who destroyed it).
I would like to separate that concept a bit because those would be meant to be simple modifications (comparing to existing full blown ones), which could work with mods changing details only (so we could have few different mutators enabled for individual game).
In future they could register options (as do those in UT) that would allow to further customize their behavior (could be useful for more complex ones - it's better to have one mutator with options than few nearly identical without), and this ability could be given also to full blown mods (done by putting INI file with GUI definition into package).

I would love to see ability to hook into unit menu and add options like preferred target type (tanks, cyborgs, structures etc.). :-)
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: Mutators

Post by Shadow Wolf TJC »

This concept doesn't sound any different from some of the upgrades that I've seen on other rts games out there, including Command & Conquer, Starcraft, or Supreme Commander 2, in which upgrades could provide units with additional effects to their weapons (like in Starcraft 2, there exists an upgrade for the Marauder that causes its shots to slow enemy movement), special armor (like adding forcefields for Scrin units in Command & Conquer 3, which can absorb a single EMP), or additional selectable abilities to name a few (like Jumpjets for C&C3's Zone Troopers, or Hunter-Seeker Missiles for Starcraft 2's Raven).
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Mutators

Post by Emdek »

Shadow Wolf TJC, it's not about upgrades but about changing gameplay by injecting code altering it (well, in fact it could be used also to add upgrades).
And by:
Emdek wrote:I would love to see ability to hook into unit menu and add options like preferred target type (tanks, cyborgs, structures etc.). :-)
I mean that I would like if mutators would be able to do such things (hook into various GUI parts, mostly like PHP injecting in WordPress).
And of course I would like such option, but this was only example. ;-)
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: Mutators

Post by cybersphinx »

Instagib at 150% speed!
We want information... information... information.
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Mutators

Post by Emdek »

Custom game modes are another thing that I would like to get. ;-)
In another thread I've discussed CTF using artifact as "flag". ;-)
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Mutators

Post by aubergine »

I've been giving this sort of thing a lot of thought also - I was looking through a lot of game sources recently to help with documenting the JS API and I was thinking that a lot of it could be converted to Javascript.

If it was, then it would be easy to do all kinds of stuff through mods, because you can easily add your own code and transparently override existing code.

I feel that it's something that would need thinking through conceptually before diving in to code changes though. Its why I was doing so much research in to the tech tree, and thinking about alternate ways to organise data about it and so on. I've also been thinking about how common objects such as droids, structures and features could be made extensible - eg. the ability for a script to define it's own commands, and then other scripts that alter the UI to expose those commands to human players, etc.

It's actually one of the ulterior motives of my Backports project, for example my orderDroid.js not only backports that function to earlier versions of the JS API, it allows new orders to be added or existing orders replaced via a very simple API. So, what I've essentially got is a way of masking native functionality (by putting stuff of same name in the global scope). This means that the native stuff is still available and unchanged, but a mod can transparently override/extend it without affecting the rest of the script (such as an AI).

And, because it's all done programatically at runtime, this would make things like gameplay style switching very easy to achieve (assuming the massive undertaking of refactoring most of the Warzone C++ code in to Javascript was done first LOL).

A lot of the things I've been asking / suggesting are all aiming at this sort of end-goal, but I didn't want to really set out the bigger picture because I thought everyone would run away screaming...
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Searge-Major
Trained
Trained
Posts: 182
Joined: 10 Sep 2011, 03:36
Location: Great Southern region, Western Australia

Re: Mutators

Post by Searge-Major »

aubergine, forgive me for not knowing much about coding and programming in general, but I was under the impression that javascript was one of the worst things to program under, especially a game. I had heard that it executes much slower that C or C++, perhaps you could put me right, or improve my knowledge? :)
I fully realise my input is just another drop in the proverbial bucket. It is my goal to make each drop count.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Mutators

Post by aubergine »

Actually JS if done properly will often be faster than C or C++.

However, there are certain things where it will still be much better to use C or C++, primarily in terms of the 3D interface and some stuff that needs very regular polling - eg. units moving across a map, with pathfinding etc.

What I'm thinking is that WZ could be boiled down to a core essence of an API defined in C++. Things like projectiles, network code, 3D engine, etc., all need to be in a fairly low level language like C++.

But in terms of most other things, the actual amount of processing that goes on is relatively low. For example, a droid being told to build a derrick on an oil resource:

* Move to resource
* Check if someone go there first = abort
* Start building a derrick
* Stop when derrick is complete

There's a bunch of stuff that happens for each of those things, so in the "Move to resource" step there's obviously a bunch of pathfinding stuff, dealing with obstacles/terrain along the way, obviously visualising the movement in the 3D interface, etc. But from JS perspective, all that's required is to give the order to move to the resource.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Mutators

Post by Emdek »

aubergine, I have the same opinion. :-)
Core (basic and most often used) stuff should be available as C++ functions / methods exposed to scripting environment.

Searge-Major, there are much worse (in cases of syntax, consistency etc.) languages. ;-)
JS is not best but is good enough, and thanks to competition between browser vendors we get more advanced and faster engines (using JIT and other optimizations).
And QtScript module has functions to glue it with C++ code (so we get functionality exposed by Lua, as far as I've reading about that particular language).
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Mutators

Post by aubergine »

One other thing to factor in is how much cruft there is in the C++ code at the moment. For example, the moral(e) stuff that Per discovered is just bonkers. By shifting a load of stuff out in to JS scripts, which has added benefit of enabling easy mutations & mods, it will help with efforts to simplify the remaining C++ code and make it really lean and mean.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Mutators

Post by Emdek »

Yep, but that will require lots of work...
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Mutators

Post by aubergine »

Yup, just thinking about it scares me, and I'm not even the person that would end up doing it heh. Although I'd love to help with porting stuff to JS...
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Mutators

Post by Emdek »

How much work it will be depends on how it will be done, personally I would like done this that way:
http://codex.wordpress.org/Plugin_API#H ... nd_Filters
Filters for altering variables and actions to do something new (well, filters can do that too ;-)), with priorities to set execution order for functions that modify the same thing (are hooked to the same place).
Then we don't need to start redoing engine into JS first, just expose some places to hook into. from JS. :-)
I'm only a bit afraid about performance, so we would need to test it first (pretty easy to do).
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Mutators

Post by Emdek »

Example of power of JS:
http://mrdoob.github.com/three.js/examp ... namic.html
(don't look at performance since this is mainly WebGL implementation fault)
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Mutators

Post by aubergine »

@Emdek - my view is that most of the C++ code is called so rarely that it could be ported to JS with no noticeable performance drop. So far I've found a few things that definitely need to be in C++, either because they are accessed often or need lots of processing (for which strong typing will yield performance boost), but lots of stuff that is called only occasionally can be in JS.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Post Reply