Author Topic: On the fly plot generation?  (Read 1603 times)

Offline Anticheese

  • Hero Member
  • *****
  • Posts: 651
    • View Profile
On the fly plot generation?
« on: July 24, 2006, 02:17:53 AM »
By the time you have played a couple of GH I games you realise that most of the missions are just the same thing with a different name, I would like to ask if the following is possible:

1) Have a plugin for Gearhead that would examine your characters actions and generate missions that fit in with your characters ethos, And a few that dont to give the character oppertunity for change

2) Missions each have a somewhat unique flavour, Insofar that there could be different settings and denizens to replace or suppliment something like the classic sewer cleaning mission

3) Missions involving skill use and intellegent teamwork - As in your character who happens to be a skilled hacker (Code Breaking) might get called in by a law enforcement (or underworld) agency to lead a sting opperation on an enemy compound

4) Non Linear central plot - In GH I its either you kill your archnemesis or he kills you, So how about more than one way to get through the plot?

5) Improved story generation - At the moment the summary of a characters life is pretty concise, So how about at the end of a game (Or after permadeath) the game tallies the characters actions (even those that are not plot related) and creates an epic story?

If each action has a point weight assigned to it, And someone makes 400 points worth of mecha repair on a regular basis then one way to factor it in on the epic generator could be "After each battle he would pull over into town and repair his Mecha, Each time gaining valuable insight into their inner workings" or somesuch, It may seem corney but it would make for a great post mortem type arrangement (See doomRL post mortems for an idea of post mortem dumps.)

Thanks for reading!

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
On the fly plot generation?
« Reply #1 on: July 24, 2006, 04:09:04 AM »
Some of these suggestions are things that I'm trying to work into GearHead-2. Maybe some of them could be retrofitted to GH1 at some point in the future, or the GH1 campaign rewritten to run in GH2.

Here are my thoughts, point by point:

1) In my opinion, ignoring finite system resources, it's better to make all the content available all the time and just vary the way that individual plots react to the PC based on his skills/reputations. For example, have plots based on specialist skills (medicine, codebreaking, etc) always loaded but these jobs will only be offered to PCs with the relevant skills.

2) This one should be improved somewhat in GH2, where plots are more modular and encounters adapt themselves to the situation.  For GH1, it's mostly a matter of adding more plots and stories. Maybe we need some fan modders. :)

3) There are a few missions which use skills (the thief missions and the medic missions), but not any that require teamwork.  More of these should be added... again, modders needed.

4) Good idea. There are a number of story components with multiple paths, but they're in the minority, and usually there's always the option to simply blast your way through. I'm hoping to do better with this in GH2.

5) I haven't played DoomRL since it's official release. I'll have to get off my butt and download it.

Offline Anticheese

  • Hero Member
  • *****
  • Posts: 651
    • View Profile
On the fly plot generation?
« Reply #2 on: July 24, 2006, 04:47:29 AM »
Quoting: Joseph Hewitt
2) This one should be improved somewhat in GH2, where plots are more modular and encounters adapt themselves to the situation. For GH1, it's mostly a matter of adding more plots and stories. Maybe we need some fan modders. :)


An official guide to modding that is written in a way that your slightly above average gamer can understand would be a great motivation for this kind of thing, Just the kind of thing GH needs.

Quoting: Joseph Hewitt

3) There are a few missions which use skills (the thief missions and the medic missions), but not any that require teamwork. More of these should be added... again, modders needed.


I think that this could be done with certain actions triggering events, I dont know how the code in Gearhead works so I'll use generic Fake ++

--
//Infiltration mission with the player as a SWAT team hacker
:start
if dooropened = 1 then goto "1"
else faliure = faliure + 1
if faliure = 5 then //After 5 failed attempts
 {
   NPC_Commander say "Allright, Just break down the door!" //You heard the man!
   NPC_Soldier1 attack nearest_instance(mansion_door) //Guess
   xppenalty = xppenalty + 0.2 //20% reduction on XP reward at the end of mission
   goto "1" //Carry on to the next part
 }
else goto "start"
: 1
//Next part of the mission
--

And on it goes..

Quoting: Joseph Hewitt
5) I haven't played DoomRL since it's official release. I'll have to get off my butt and download it.


Ok, When you start it up just look in the bottom left corner of the screen.

Also when you die, Look at the mortem.txt - I was thinking of something like this for a GH dump, Except more detailed.

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
On the fly plot generation?
« Reply #3 on: July 24, 2006, 07:00:37 AM »
A guide to plot writing is just exactly the kind of thing the wiki is perfect for. I'll see about copying over some of my posts from the message board to start with.

Offline Anticheese

  • Hero Member
  • *****
  • Posts: 651
    • View Profile
On the fly plot generation?
« Reply #4 on: July 24, 2006, 09:28:08 AM »
I would have thought the forum a better medium for sharing a development guide, It could be posted as a sticky in the Gearhead Internals forum.

Offline Tung Nguyen

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • http://tunginobi.spheredev.org/
On the fly plot generation?
« Reply #5 on: July 24, 2006, 10:40:12 AM »
Oh that's easy, just make a topic that links to the wiki article, and sticky the topic.

Scripting in and of itself isn't too difficult to pick up: many of us have had some level of exposure to procedural languages, and working with a mnemonic opcode-ish script isn't too tricky.

It's the concepts that are really boggling. Where should the script belong in the greater scheme of things? What's a trigger? How do you set up quest content? How do you pick out specific entities for roles in an adventure? What exactly constitutes an adventure? I don't really know the answer to any of these things, or even if I'm asking the right questions that will enable me to write my own scripts.


::EDIT::

Tracked down one of the plot writing guide posts:

http://games.groups.yahoo.com/group/gearhead_dev/m essage/1525

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
On the fly plot generation?
« Reply #6 on: July 24, 2006, 12:22:03 PM »
That's the thing. I think I suffer from mad scientist syndrome, myself- I've made this enormous mess and although it works and makes perfect sense to me that doesn't excuse it from still being, well, a mess.

I think you're right- defining terms would be a good place to start, and also some step by step guides for making specific kinds of content.

Offline Anticheese

  • Hero Member
  • *****
  • Posts: 651
    • View Profile
On the fly plot generation?
« Reply #7 on: July 24, 2006, 10:36:12 PM »
With Gearhead II around the corner this would be a perfect time to tidy up the GHScript engine and perhaps add more functionality.

I'll see if I can hack up a plot for GH I Later on...

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
On the fly plot generation?
« Reply #8 on: July 25, 2006, 04:16:30 AM »
The big thing I'd like to change about the GH scripting language is to add honest-to-goodness assignment and operations. At the moment, everything is handled through imperative commands. I think it'd be much easier to read something like:

V1 := 1 + 2

Than the current equivalent:

V= 1 1 V+ 1 2

Of course I transferred from Math to English right around the time my CS class was covering tokenization, script interpretation, and all those useful things.

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
On the fly plot generation?
« Reply #9 on: July 25, 2006, 04:27:33 AM »
Quoting: Anticheese
I think that this could be done with certain actions triggering events, I dont know how the code in Gearhead works so I'll use generic Fake ++


It would be possible to script a door such that if the PC failed to unlock it several times, an order would be sent to a specific team to attack the door. Unfortunately without changing anything else this might have some bad effects, such as calling all the teammates from all over the map to drop whatever they're doing and head to the door. If the teammates can't bash the door (say, because they've run out of ammo for their big guns), they might get stuck there semi-perminantly.

Offline Anticheese

  • Hero Member
  • *****
  • Posts: 651
    • View Profile
On the fly plot generation?
« Reply #10 on: July 25, 2006, 07:52:16 AM »
One of the reasons why I suggested an upgrade of GHScript to be more tidy.

P.S There is an edit button y'know ;)

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
On the fly plot generation?
« Reply #11 on: July 25, 2006, 09:45:45 AM »
Quoting: Anticheese
One of the reasons why I suggested an upgrade of GHScript to be more tidy.


I guess the best thing to do, then, would be for me to research this subject before writing too much more scriptage for GH2... The more scripts I have the harder it's going to be to change them all significantly.

Quoting: Anticheese
P.S There is an edit button y'know ;)

That's easy for you to say. You already have a Chameleon!

Offline Tung Nguyen

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • http://tunginobi.spheredev.org/
On the fly plot generation?
« Reply #12 on: July 25, 2006, 10:17:22 AM »
I thought about this for a while, about what must be wrong with GHScript, since I still wasn't getting it. At first, I thought it had something to do with the underlying design of the language, until I realised that the design itself wasn't too bad.

GHScript is too terse.

That's the major issue. It tries and does fit whole sequences of code on a single line, which isn't that bad, until you realise that even the more obscure commands are abbreviated almost beyond recognition. Sequences of code definitely need to span more than one line.

In-order expression evaluation would work wonders for readability.

If (cond) Else (tag) is really disorienting to read, even after I've encountered it a few times and have come to know how it works. A JumpIf (cond) (tag) would work much better.

The whole sub-inv structure works out neatly in code, but seeing those in a plot file doesn't allude at all to what those things should contain when inside a GHScript plot file. One section contains criteria to pick out NPCs, locations and important items, and the other contains the plot code itself, right? Instead of "sub" and "inv" keywords, why not support "props" (like those on the set of a stage) and "script" (as in the description of a theatre play)?

Extra mnemonics for things like player stat identification, game variables would be handy. In particular, I feel it should be possible to alias those obscure V1-8 variables, and other abbreviated variables and symbols.


One thing I do like about GHScript is that control is kind of event-based, with tags to section off bits of code.

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
On the fly plot generation?
« Reply #13 on: July 25, 2006, 01:43:32 PM »
How's this for an idea: the interpreter itself can continue to use the terse code, while the gearparser unit will be given a new script compiler that can take scripts written in a more human-readable form and convert them to the terse ASL scripts.

One problem: String attributes are stored as 255-char strings; this is part of the reason why ASL is so terse. With a compiler it would be easy to unintentionally overflow this limit. I could change the strings to unlimited-length ANSIStrings, but I haven't tested these yet and don't know if there would be a performance hit. GearHead does lots of inefficient string work... I could maybe make a system where an overlength line would be split into several lines, but getting this to work properly with things like the megalist script mixer would be tricky.

Maybe I should go all the way and replace the ASL scripts with Lua or some other "real" language. Or, alternatively, compile the ASL to some kind of bytecode.

Offline Kornel Kisielewicz

  • Administrator
  • Jr. Member
  • *****
  • Posts: 58
    • View Profile
    • http://chaosforge.org/
On the fly plot generation?
« Reply #14 on: July 27, 2006, 03:26:13 PM »
Have you ever considered using Lua? It integrates with FreePascal realy smoothely...
At your service,
Kornel Kisielewicz
ChaosForge