Scriptable Training Missions / Tutorial System - part 1

A place to post suggestions for new features, new bugs, and comments about the existing code.
MrChaos
Posts: 8352
Joined: Tue Mar 21, 2006 8:00 am

Post by MrChaos »

As promised and fwiw to Count

I used to program in C++ back when MFC was the hot new thing (sue me Im old :lol: ) as the cavaet to the next bit

Your origional links

While I could not put together a training mission without some hand holding via documentation or direct discussions i.e. just the coding comments aren't enough for a voob like me. The task wasn't anything to daunting imho. It would require a not trivial investment in time to learn Allegcentric stuff to use this feature and that is probably where the wheels come off the cart. Time investment to productive output for the average over eager gamer who has big ideas.

So if you are going to do this (and it looks like you are) here is my advice; make it easy enough to get something pleasing to the end user in say, one hour. Not a finished product but stuff, doing stuff ;) Getting ships to undock fly across the sector and engage something, constructors and miners that go where you tell them easily is what Im nattering on about.

Thanks Count for the work but a friendly word. Don't *sigh* at me :lol: Take it from someone with the same scars as you. Go talk to management before you get to far down the road. Cause angry and pissed off is NOT the reward I'd like to see you get for all of your work

MrChaos
Last edited by MrChaos on Sat Jul 23, 2011 10:08 am, edited 1 time in total.
Ssssh
madpeople
Posts: 4787
Joined: Tue Dec 16, 2003 8:00 am
Location: England

Post by madpeople »

KGJV wrote:QUOTE (KGJV @ Jul 17 2011, 07:22 PM) "non-programmers" is a very vague notion.

There is a huge step between programming in C++ within Allegiance code and writing scripts. That's the whole point here.

A lot of so called 'non-programmers' with enough brain can do nice things with a scripting system whatever the language.
These same persons will refuse to invest time in C++ because of the complexity and burden.
I'm not talking about C++ as a language alone but about a complex C++ project like Allegiance with all the libraries, SDKs, tools and knowledge required.
I think we're thinking along similar lines, a reasonably smart person or at least someone motivated enough to learn, who isn't a programmer (in the sense they could get a job as one / write a decent sized application). I think you're thinking of someone who maybe has done maybe a beginner course of java / python, where as I'm thinking of someone with no real language experience (but has done stuff with say AHK).
Anyway I think we're thinking on similar enough tracks about this aspect that it doesn't need any more discussion.

QUOTE What matters is the global environment.[/quote]
Agreed.

QUOTE I don't see the point designing a brand new language because I want to leverage existing stuff.

Adding scripting to an application can be complex. Using existing parsers and error handling modules of an existing language is the way to go.

Using existing language(s) allows to reuse code too. Either by direct import (with 'modules') or by copy/pasting. Python and JS have a big advantage here, there are tons of existing modules out there for all sort of things.

I might even go for multi-language scripting, leaving the choice to the users. Something like Active Scripting might be the way to go.

Actually it has already been done in Allegiance. The Pigs system uses it. I might reuse this. Take a look at the original Pigletsfor instance. You'll see the language is a parameter of the 'pigs'.

The 'scout2' piglet is a nice example of why using a widely used scripting language is interesting. by using JavaScript, they were able to quickly adapt/reuse Dijkstra's shortest path algorithm in a module and then use it in the piglet (see include/dijkstra.js). Try doing this with your own language, you'll have to reinvent the wheel.[/quote]

Your point about code reuse is a good one, but I disagree about some points.

I would take argument against you example of the scripter (our novice/non-programmer) re-using Dijkstra's algorithm however, and here's why:
I think the person writing the script (who doesn't necessarily have much programming experience) should only have to worry about what they what to happen not how to do it.
I think our script writer should just say something like "GoTo <target> SHORTEST" instead of having to import an implementation of Dijkstra's algorithm to generate a route, then have to create event handlers to handle the change of destinations to proceed along the route and other stuff too. Assuming the script is interpreted (unless you get fancy with JIT compiling and stick a compiler in allegiance.exe) then it could be quite easy to import some processing heavy algorithm that will be interpreted quite slowly (ok, this argument on performance is a bit weak, but it's more a side note).
My point is that our non-expert programmers should be focused on what should be happening in the mission, not how to implement the technical details. I'm not saying they shouldn't worry about any 'how's - in my example language I as the programmer had to think of how to advance mission objectives using the variables. I didn't however have to program how to detect if the player was within 1000m of some coordinates (yes, it's easy to program that but it's likely a common requirement so should be a quick executing easy to call function). Our novice programmers most likely haven't even heard of Dijkstra's algorithm anyway.


QUOTE A GUI system is way too soon to even think of it. It could be added later by someone else as it doesn't need Allegiance code to work. That's the advantage of this approach too.[/quote]I actually designed my example language to be simple to generate using a GUI (or perhaps simple to make a GUI for?) ;)


Anyway, this is your project it's up to you what you do. My thoughts are that the mission writers should only have to worry about what happens in the mission and how to make what they want happen, but not how to implement the low level details (like plotting a course in your example*, determining the range between coordinates in my example, calculating the correct turn rate to make the ship lead it's guns on a target for another example). I think that writing a simple language bespoke for this specific task with compiled functions to hide the details of how things are achieved is a good idea. That said I do tend to do things my self when I should use what other people have done (like the time people started talking in morse code on the forums, my first thought was to write my own morse code encoder/decoder, and only after finishing it did I think to google online morse code translators).

*Why did the implementers of pigs need to import an external shortest course algorithm anyway, allegiance already has one in the autopilot code (one which knows about allegiance specific things like teleport receivers and stuff), shouldn't they have been calling that instead if they wanted a shortest course?
Last edited by madpeople on Sat Jul 23, 2011 12:50 pm, edited 1 time in total.
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

I get your point about the Dijkstra's algorithm but I choose this example to even more illustrate the benefit of scripting.

ok your 'scripter' guy should focus on what and not how. Totally agree on that.

but what if some 'how' isn't implemented ? let's say for example, there is no shortest path stuff anywhere in the game code.

Then your scripter guy will have to ask the C++ guys about expanding the 'GoTo' script command to handle something like "GoTo <target> SHORTEST".
We're back where we are today: depending on the Alleg C++ gurus and the whole FAO 'decide, build, publish' days/weeks/months delay thing.

Let's say our guy is lucky and some C++ guys do the patch and FAO publishes the code. Now he starts experimenting with the new GoTo version and after a few tests, he finds out he sometimes needs a switch to not use teleports ( something like "GoTo <target> SHORTEST NOTELE" ).
And Bam! we're back again to <scroll up a few lines>.

See the problem ?

Now if the shortest algo can be implemented in script and if the scripting commands (like GoTo) can be modified or extended within the scripting system then we solve a lot of problems. Sure your scripter guy still depends on other to provide him the 'how' changes but this time the population that can do this is huge compared to just our usual Alleg C++ gurus and there is no 'administrative' delays (decide/build/publish).

Think layers: we have 'layers' and different persons in each layers. Today with have C++ code layer, MDL layer and IGC layer (core).
Adding scripting add a layer in which more layers can be added and so widening a lot the general population of who can do what.
If we add scripting at the 'how' level only, we only add 1 new layer.

Ideally, the final objective is to move all the game logic (including server side) to the scripting system. The C++ code should only be a framework to handle heavy stuff like network communications, inputs and 3D graphics. Everything else, UI and game logic should be scripted.

When you look back at all the ideas that were published in the 'core' forums (CC & others) and how many of them couldn't be implemented because of depending on some code changes, you'll see the huge potential of scripting.

Not only you can add new training missions, tutorials and solo campaign game but you add tons of new stuff to the multiplayer game with server side scripts controlling special AIs or generating special events for instance. Even the whole 'core' system could be more dynamic with scripting.

but then again, the #1 advantage isn't what can be done with such a system but who can do it.
Last edited by KGJV on Sat Jul 23, 2011 5:57 pm, edited 1 time in total.
Image
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

madpeople wrote:QUOTE (madpeople @ Jul 23 2011, 02:48 PM) *Why did the implementers of pigs need to import an external shortest course algorithm anyway, allegiance already has one in the autopilot code (one which knows about allegiance specific things like teleport receivers and stuff), shouldn't they have been calling that instead if they wanted a shortest course?
AFAIK, the autopilot code and shortest path thing is in the WinTrek client (main part of Allegiance.exe).

Pigs share only the lower part of Allegiance client (game logic code and network code).

They are clients without Gfx/Sounds/Inputs using only scripts to control them. Since "autopilot" and even "goto" isn't part of the game logic, they had to import an external shortest course algorithm.
Image
Spunkmeyer
Posts: 2013
Joined: Fri Jun 27, 2003 7:00 am
Location: Contact me regarding: CC, Slayer and AllegWiki.

Post by Spunkmeyer »

KGJV wrote:QUOTE (KGJV @ Jul 23 2011, 12:53 PM) Ideally, the final objective is to move all the game logic (including server side) to the scripting system. The C++ code should only be a framework to handle heavy stuff like network communications, inputs and 3D graphics. Everything else, UI and game logic should be scripted.
I wasn't too excited about this till now, but now I am. You are talking about adding a whole game-logic layer, as was done first with Quake.

That'd be awesome.
Last edited by Spunkmeyer on Sat Jul 23, 2011 7:10 pm, edited 1 time in total.


Want bigger games? Log on to play at the official game time: 9pmET/8pmCT/7pmMT/6pmPT every day of the week. Also Saturdays 8pm UTC.

Orion
Posts: 1733
Joined: Tue Jul 01, 2003 7:00 am
Location: Planet Min·ne·so·ta
Contact:

Post by Orion »

Yeah, would also be nice to improve upon / replace the lower layers though :P
Image
DonKarnage
Posts: 545
Joined: Mon Nov 01, 2010 7:18 pm

Post by DonKarnage »

A stand-alone program that uses drag and drop actions and conditions I think would be the best if you wish to make it easy for everyone to use.
You *could* have an advanced mode, or expandable options for the things that would be helpful in rare situations, but otherwise just clutter up the space and overwhelm a new user.
It is Karnage! Don Karnage! Roll the r!
madpeople
Posts: 4787
Joined: Tue Dec 16, 2003 8:00 am
Location: England

Post by madpeople »

Ah, so the objective here isn't really to help create more training missions by lowering the requirements of making them. It's actually to lower the barrier to implementing just about everything. In which case your use of a 'proper' language makes more sense (Though I would wonder if you want core stuff to be modified without compiling the source as you do now, then I wonder if you should be re-doing the internals in c#.net and the logic could be interpreted (apparently bytecode is fast yo! http://byteworm.com/2010/11/21/the-fastest...de-interpreter/ , though it's easy to suggest you re-write the whole game, slightly more work to actually do it...).
Spunkmeyer
Posts: 2013
Joined: Fri Jun 27, 2003 7:00 am
Location: Contact me regarding: CC, Slayer and AllegWiki.

Post by Spunkmeyer »

If the game logic is exposed this way, a lot of the stuff *will* be rewritten, although it wouldn't be as much work since it'll be based on the existing code.


Want bigger games? Log on to play at the official game time: 9pmET/8pmCT/7pmMT/6pmPT every day of the week. Also Saturdays 8pm UTC.

Orion
Posts: 1733
Joined: Tue Jul 01, 2003 7:00 am
Location: Planet Min·ne·so·ta
Contact:

Post by Orion »

I'm in favor of rewriting allegiance in .NET

It's definitely doable, but it would doubtless be a huge undertaking even for the most dedicated and talented team this community could 'field'.
Image
Post Reply