API documentation

MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
In Build 246 we silently included "documentation" on the entire API that is exposed to Lua by the game engine. You can find this under the Natural Selection 2/docs/api folder in Steam. I put documentation in quotes because this is just a list of all of the classes, functions and parameters -- it doesn't include any explanation on what the functions do yet. Even though it's limited, I think this is a important first step.

I contemplated generating nicely formatted HTML files from this information, but I concluded that the people in the community would probably do a much better job than I would, so instead I exported the data as machine friendly JSON. These JSON files are automatically generated by our build process so they will always be up-to-date. My plan is to start including descriptions of the functions in the JSON data, but this will take some time for us to flesh out.

I look forward to seeing what you can do with this data!

Comments

  • JimWestJimWest Join Date: 2010-01-03 Member: 69865Members, Reinforced - Silver
    Are there all functions from the engine you can use in lua included?
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    JimWest wrote: »
    Are there all functions from the engine you can use in lua included?
    It should be the complete list.

  • McGlaspieMcGlaspie www.team156.com Join Date: 2010-07-26 Member: 73044Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Onos, WC 2013 - Gold, Subnautica Playtester
    Fantastic! I've really wanted something like this for a very very long time. Really looking forward to seeing where this goes.
  • MCMLXXXIVMCMLXXXIV Join Date: 2010-04-14 Member: 71400Members
    Cool! Thanks for these Max, they are going to be pretty useful. I'd imagine a good XSLT would be a way to turn these into HTML... I'll see if I can knock something up when I have time.
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    Brian has already started working on documenting the functions in more detail, so we'll definitely have some of that ready in the next patch.
  • RedSwordRedSword Join Date: 2006-12-07 Member: 58947Members, Reinforced - Shadow, WC 2013 - Supporter
    Thanks; this is great news. Any plan on hosting an online version ?

    (something like http://docs.sourcemod.net/api/ for sourcemod <3)

    It is really appreciated (at least; from me) when you can just check someone's code and get to know what function do what without searching local files (useful when on someone else computer without NS2, so you can take some of your free time to check code, and wonder which function does what).

    Red
  • BruteBrute Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    Are there Classes missing? I.e. I can't find "Alien".
    What is a 'class' anyways? It seems that this is not part of the lua language. So where and how is "class 'Alien' (Player)" interpreted?
    My current understanding is that it copies all parts of the "Player" table to a new "Alien" table, when the .lua file is parsed.
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    Brute wrote: »
    Are there Classes missing? I.e. I can't find "Alien".
    What is a 'class' anyways? It seems that this is not part of the lua language. So where and how is "class 'Alien' (Player)" interpreted?
    My current understanding is that it copies all parts of the "Player" table to a new "Alien" table, when the .lua file is parsed.
    The classes that are part of the engine API are included, but Alien is not part of the API (it's a completely game level construct).

  • VenatosVenatos Join Date: 2012-03-31 Member: 149762Members, Reinforced - Shadow, WC 2013 - Gold
    thank you for this max. ill start browsing through it as soon as i get home! ;)
  • MCMLXXXIVMCMLXXXIV Join Date: 2010-04-14 Member: 71400Members
    Thanks for doing these Max! I've already found them useful (for when I was making the DSP effects for the new Devour)...
  • JimWestJimWest Join Date: 2010-01-03 Member: 69865Members, Reinforced - Silver
Sign In or Register to comment.