Talk:Entity Listing

From modwiki

Jump to: navigation, search

Contents

Proposal: Entities tree

Just an idea, but couldn't it work to make this list tree-like? Loads of those entities are derived from one default and mostly don't need to be explained again once you know what the base entity does.

Of course, that's not something to do by hand. I'll see if I have the time to make a GAWK (grep's offspring, so to say) script. Such script can hopefully parse all the entity defs for inheritance and their base classes. (It can at least get the same results as grep)

However, it could still take some time before that script gets made. So I'm not holding you back to start documenting some fundamental things like worldspawn or player_base, rather just warning that some work may be automated. -Kamikazee 18:02, 2 April 2007 (CEST)

Sure

The article is a mockup at this point. I'm open to suggestions on how we can best present the information.

--Rich 08:49, 3 April 2007 (CEST)

Update: parsing script not finished

Just a quick update: I've got a script able to extract the keys, values and inheritance "chains". It can detect overridden and "base class" keys too. It has some problems with editor variables though, so those will need to be sorted out.

While nice on it's own to find where a value was set, it will take a little more work to give wiki-ready output. I can't predict anything, but it will probably have to wait for another month. I'll see if I can get the main entity tree done first. --Kamikazee 20:15, 20 May 2007 (CEST)

Some thoughts and questions

Most of the key/value pairs used by various entities are not specific to one particular entity. For instance, all the trigger entities are going to have 'wait', 'random', 'delay', ect... key/value pairs.

I envision it's going to be rather tedious to retype each definition for every entity where a given key/value pair is used. It would be much nicer if the key/value pairs and their definitions where stored in one location and each entity article retrieved the definitions it needed.

I know we could resolve the problem by creating a template for each key/value pair but that doesn't seem like the most robust solution. Anyone know of a better way to do this?

--Rich 03:34, 5 June 2007 (CEST)

Still thinking about it

I'm still thinking about how to do this. My little script can extract a wealth of information about the key/values, but inserting them remains a problem.

  • I could write my script to "spit out" text files ready to be inserted. (So all keys/values should be posted again, making it a large heap of date)
  • Alternatively, we could list the inherited keys on the "parent" def's page and only mention extra keys. (This requires more work from the reader as he needs to work his way through the whole inheritance chain.)
  • A third option would be to make an Template:Entity with parameters for each key. Wikipedia supports something called parser extensions, adding if/else support to wikitext. If you would create an entity page, you could write it like this:
{{Entity
| description=The trigger_flashlight entity is used to activate targeted entities or call a script function. In this case, the trigger is tripped by shining the flashlight on it.
| key_wait=1
| key_random=1
| key_call=1
}}
whereas the template would look somewhere along the lines of this:
==Description==
{{{description}}}
==Spawn Arguments==
{| class="listtable"
! KEY !! VALUE
|-
{{ #ifeq: {{{key_wait| }}} | {{{key_wait|u}}} | <nowiki>|</nowiki> wait <nowiki>||</nowiki> The duration in seconds before a trigger is reset, thereby allowing it to be tripped again. '-1' can be used to prevent the trigger from reseting, hence making it a single use trigger. <nowiki>|-</nowiki> }}
{{ #ifeq: {{{key_random| }}} | {{{key_random|u}}} | <nowiki>|</nowiki> random <nowiki>||</nowiki> A random value between 0 and the number specified here is added to the duration specified by the 'wait' key/value pair. <nowiki>|-</nowiki> }}
{{ #ifeq: {{{key_call| }}} | {{{key_call|u}}} | <nowiki>|</nowiki> call <nowiki>||</nowiki> The script function to call when tripped. <nowiki>|-</nowiki> }}
It does have quite some negative points though:
  • It needs some file to be installed on the server. I don't know when iceheart could find the time for that.
  • I think it's obvious that it is a tedious job to insert all key descriptions into one template.
  • Also, you can't change a key's description for one article, all pages will use the same description. (The same is true for D3 vs Q4.)
  • Fourth way: somehow moving all key descriptions to the end of the article and make it so you can include the parent's page into the child page. (Pages do not need to be templates to be included.)

One last note though: tables can be put in templates, but you can't insert a table as a parameter to a template. See Blend (Material stage keyword) to know what I mean.

I hope I didn't give you a headache with all of this, but it is a tricky problem. I think this needs some time for templating the entity page, as well as resolving the redundancy. --Kamikazee 19:32, 6 June 2007 (CEST)

Transclusion

I definitely think it's important to list all the key/value pairs that function with a given entity. If the reader was left to navigate the whole inheritance chain to find all the working key/value pairs, the wiki wouldn't be a much better reference than the def files themselves.

I like the idea behind parser functions but it's probably best to keep the wiki running stock. Every addon that's installed increases the complexity of our markup and I think it's best for the community to keep this site both simple to read and edit. Also, mods stand a good chance of breaking something should the wiki software ever need updated.

I just found this interesting bit...

http://en.wikipedia.org/wiki/Wikipedia:Transclusion

It would be perfect if it worked for a portion of a page. Unfortunately this sort of thing doesn't appear to work...

{{:Scripting#syntax}}

Instead, the whole article is included.

--Rich 14:14, 7 June 2007 (CEST)

Extensions

Personally, I'm fine with installing extensions if they work and do something valuable, like the syntax highlighting extension. I was planning on installing that source quoting thing someone wanted already.

The wiki software won't get upgraded until this backwards host upgrades to PHP5, and even then extensions shouldn't break.

--iceheart 14:46, 7 June 2007 (CEST)

The Fourth Option It Is

You are correct Rich, transclusion is what is powering the whole Mediawiki template system. It's actually what I wanted to say with the 4th option I listed, I only forgot it's called "Transclusion" on Wikipedia. Thanks for fetching the article.

There are a few practical problems though, like the fact that the parent page can probably not be entirely written as a template. (So you'd need to copy/paste some more markup, or need to make a template Entity_top and Entity_bottom.) Also, there can be no key changing from one context to another because it would be listed twice. (One definition from the "base def", one from the "derived def".) However, I guess that would be rather uncommon, seeing how the inheritance chain would just start from another base def.

I'll make a few tests in my user space to see how well this turns out. Expect some results tomorrow, because I'm far too busy today.

--Kamikazee 14:51, 7 June 2007 (CEST)

Python

I've been tinkering with Python a bit lately in hopes that I might be able to write a script to do a bit of data visualization with the entity declarations.

I'm new to the language so I have a lot to learn but here's where I'm at so far...

""" idTech 4 data visualization script """

import fileinput
import re

entdef = re.compile('entityDef\s(\w*)\s{')
keyvalue = re.compile('\s*"([^"]*)"\s*"([^"]*)"')
enddef = re.compile('}')

entlist = list()
entdict = dict()

for line in fileinput.input('E:/Doom3 Assets/def/mp.def'):
    if line.endswith('\n'):
        line = line[:-1]

    entmatch = entdef.match(line)
    kvmatch = keyvalue.match(line)
    endmatch = enddef.match(line)

    if entmatch:
        entdict['~name'] = entmatch.group(1)

    if kvmatch:
        entdict[kvmatch.group(1)] = kvmatch.group(2)

    if endmatch:
        entlist.append(entdict.copy())
        entdict.clear()
        
for entity in entlist:
    print entity['~name']
    for pair in entity.iteritems():
        if pair[0] != '~name':
            print pair


It's not much. All it does at present it read in the declarations from a single file but it took quite a bit of time for me to get to this point so I thought I'd share.

Perhaps one of you has a better idea on how to structure the data in memory to make it easier to work with.

In theory you could do some very interesting things with the data once it's all correctly loaded into memory. For instance, you could have the script write out a inheritance diagram in SVG.

--Rich 03:34, 14 September 2007 (CEST)

Game specific mockup

Entity Listings

Image:D3square_25.png Entity Listing (Doom 3)
Image:Q4square_25.png Entity Listing (Quake 4)
Image:Preysquare_25.png Entity Listing (Prey)

I've created game specific mockups of entity listings. If we can agree that the result is suitable this page should probably be deleted.

--Rich 11:24, 11 October 2007 (CEST)

Personal tools
Main
id Tech 5