Tuesday, February 25, 2014

Captains orders. My hopes and ideas for LUA

There's not much documentation yet about the lua interface for interacting with VIs... so this is just wild speculation while I wait for a meeting to start.  Regardless of the syntax of the language used, Schema will need to program a library of routines and condition flags for the gamers to use...  so let's think about this. Maybe we'll come up with a cool idea or three and maybe they will find their way onto the right screens.

In keeping with the spirit of the voxel sandbox, I'd like the programming to be a fairly low-level thing.  Simple like a cube or half-cube is simple.  I'd wager there are a lot of programmers playing star-made, and we can make and share subroutines to make the process simpler for the rest.  Let me ask enough questions about my environment and I can write a routine to approach and plot a nice circular orbit around a planet.  Then I could share my routine like I share my ships.  Now anyone can incorporate my routines to navigate and orbit by having their dave interface with the navigation station and invoking the following to travel to sector 5,7,9 and orbit the planet there at a distance of 600M.

ship.orbit(600,5,7,9)



Complex Command Routines:
I think we can build these ourselves from simpler engine calls.
TargetSys(Int): locks targeting on a specified "t-menu" subsystem of targeted entity)
Orbit(entity, int):  Navigates current entity in a circle around other entity at a specified distance.
entity.navigate(x,y,z): Entity navigates to specified sector.
entity.psphere(x,y,z,r):  Entity plots a random flight pattern, with a maximum distance of r sectors from sector x,y,z
entity.parea(a,b,c,x,y,z)  Plots a random flight pattern in the cuboid described by sectors x,y,z and a,b,c.
entity.orient(p,y,r):  Orients entity against space.  p, y and r are integers between -180 and 180 that indicate yaw, pitch and roll deflections.  0,0,0 is like hitting "c".  A value of "X", substitutes with the current orientation of the entity.


Let's make a story of it so it makes more sense...
My ship is named Veritas.  We are arriving at Sector 18,5,6  A large station in sector is named Elisium.
I imagine AIs talking with eachother such that we can overhear in console text.  The portions of the conversation below in bold are printed on the screen for anyone logged into the ship or station:

Veritas.Navigator: "Sector navigation complete, captain.  Confirming sector 18,5,6"  (standard confirmation whenever a preprogrammed flight path has reached terminus, Sector 18,5,6 can now be addressed as "sector"
Veritas.Navigator: sector.hail("",arrival)
Ellisium.Control: triggered by "arrival" pulls the ShipID from the hail.  Veritas.get.faction()   The value returned shows me to be in the same faction.
Ellisium.Control: Veritas.hail("Elesium control, here. Welcome Veritas. Would you like to dock?",dockoffer)
Veritas.Navigator: Veritas.dockoffer() among other things, prompts the player "They are inviting us to dock.  What say you captain (Y/N)"
(y)
Veritas.Navigator: executes Elesium.hail("Elesium control, this is Veritas.Navigator, requesting a docking solution.",Dockrequest,200,52,75)
Elisium.control: In resonse to the invocation of "Docrequest" executes Veritas.hail("Welcome Veritas You are cleared for docking on pad 3.  Sending navigational solution.") ; Veritas.Navigator.upload(dock3landingfile,dock); Veritas.Navigator.hail("",Dockresponse,dock) (Elisium.control compared the ship dimensions to his many docks and found that pad 3 was the best fit of those available.  He then selected a navigational program to bring a ship to the correct side of the station, orient  to face dock 3, flutter the engines for a slow approach to to docking range, target Elesium.DockID003, and activate the docking beam for 2 seconds.)
Veritas.Navigator: in response to "Dockresponse" and seeing that the solution is named "dock", executes Elesium.hail("Thank you control, I have the solution.  Brews are on me.";Veritas.Navigator.dock()
The ship then executes the navigational program previously uploaded from the station. The last line of the program deletes subroutine "dock"
Station.control: triggered by successful docking, executes Veritas.hail("We have you Veritas, enjoy your stay.  Try the cantina on the observation deck."
In response to a station docking, Veritas.XO, asks "shore leave?"


So what basic programming blocks would I like to see?  This is just a quick stab, neither complete nor thoroughly thought out... but this gives the flavor of the game I'd like.

=====Entity Methods
entityid.
get.EntityType(int): 0=structure 1=avatar 2=star 3=sector
get.sectorx()  Sector x coordinate
get.sectory()
get.sectorz()
get.secposx() X coordinate in sector
get.secposy()
get.secposz()
get.name()
set.name(Str)
hail(Str)   Sends a message to entity.
query(int) prompts the entity, waits (int) seconds and then returns the reply.
extort(int1,int2) Dialog box offers to transfer int1 credits to the extorting entity.  Waits int2 seconds and then returns the value transferred if any.
comandeer(int) dialog offers to surrender the controlled entity to the faction of the extorting entity.  Waits int seconds and then reports the response.
press(int) presents a dialog of entity NPC crew.  Selected crew are refactioned and transferred to the control of the extorting entity

=====Avatar Methods (Avatar is a class of Entity)
avatarID.
get.type(): 0=Player 1=NPC 2=Bobby
set.target(Str): designates the string of the entityname targeted.
get.faction()
set.faction(Str)
get.ship()
set.ship(Str)
get.rank()
set.rank(Str)
get.crewstation()
set.crewstation(Str)
learn(defined.method): uploads a defined method to the NPC or Bobby.
forget(defined.method): removes a routine from the VI
export(filename): Dumps NPC scripts to a file
threatScan(): Creates an ordered list of enemy entities aliased as Target##  Returns the number of targets identified.
get.health(): returns an integer representing the HP
get.gravity() 0=not in gravity 1=in gravity


AIs and NPCs react to commands which can be typed by a player, triggered by icons on the command row or issued by an NPC captain.
GQ: (general Quarters) preparing for combat.  Triggers the "avatarID.GQ" subroutine on all NPCs who are crew to your ship.  All might don their helmets.  Security (with gunfighting routines) might pull weapons and head for the bridge and storage units. Weapons teams (with targeting programs) might might head for fire control and start targeting hostiles.  
WF: (weapons free)Fire control targets enemies and fires on them, while helm might turn the ship to bring more hostiles into range of the main guns. Turret control crew with both targeting and target aquisition routines spin turrets and fire at will.  Scanning officer might announce that an enemy is nearly out of shields, which would trigger the missile control NPC to target and fire on that enemy.
RB: Repel boarders

=====Structure Methods (Structure is a class of Entity)
Structure "get" methods are unrestricted when used on unshielded structures or structures within your faction.
Tactical information about enemy ship internals like energy,  may be unavailable while the ship is shielded

StructureID.
get.structuretype(): Returns 0=ship, 2=base, 3=asteroid 4=planet
get.xdim(): Returns x dimension of structure.
get.ydim(): Returns y dimension of structure.
get.zdim(): Returns x dimension of structure.
get.xspeed(): returns the speed of the entity along the X axis
get.yspeed(): returns the speed of the entity along the Y axis
get.zspeed(): returns the speed of the entity along the Z axis
get.target(): returns the entity name currently targeted by entity
get.mass():   Returns structure mass
get.blockcount(int): returns structure count of blockID designated by int
set.alias(intx,inty,intz,Str): Sets a particular block ID as addressable by a String
get.pitch(int -180 to 180): returns pitch deflection of orientation point from universe or docking host.
get.yaw(int -180 to 180:   returns yaw deflection of orientation point from universe or docking host.
get.roll(int -180 to 180):   returns roll deflection of orientation point from universe or docking host.
get.energy(): returns energy level of structure
get.amcdps():   Returns DPS of collected AMC arrays.
get.shield(): Returns shield strength as an integer.
get.value() appraises the value of the structure being scanned
dockscan(): Creates an ordered list of docking sites on the specified structure as Dock###. Returns the number of docking ports on the ship.
DockID.
get.docktype() Returns 0=regular 1=turret
get.xdim() Returns X dimension of docking field
get.ydim() Returns Y dimension of docking field
get.zdim() Returns Z dimension of docking field
get.status() 0=enabled 1=disabled 2=occupied 3=blocked
get.occupant() Returns the shipID of the occupying entity
undock(int) Undocks the docked entity in int seconds
set.larclimit() prevents a docked structure from rotating left past int degrees (between -180 and 180)
set.rarclimit() prevents a docked structure from rotating right past int degrees (between -180 and 180)
set.target(Str): Designates an entity, within scanner range, as "target".  could be "entityID" or "entityID.Subentity"
crewscan() Creates an ordered list of crew on the specified structure as crew###.  Returns number of crew registered to the structure. Entities can then be addressed by crew###
subsystem(ControlMenuItem,Aliasname)  Allows you to address "controlBlockA3" as "AMCCannons"

===============Ship Methods (ship is a class of Structure, and includes any structure with a ship core block)
ShipID.
set.structuretype(int): 0=ship, 1=turret
get.xthrust(): int -1=reverse, 0=off, 1=forward
get.ythrust(): int -1=down 0=off, 1=up
get.zthrust(): int -1=left 0=off, 1=right
set.xthrust(int): -1=reverse, 0=off, 1=forward
set.ythrust(int):   -1=down 0=off, 1=up
set.zthrust(int):   -1=left 0=off, 1=right
set.pitch(int): -180 to 180 Sets pitch deflection of orientation point from universe or docking host. limited for turrets, disabled for docked.
set.yaw(int):   -180 to 180 Sets yaw deflection of orientation point from universe or docking host. disabled for docked.
set.roll(int):   -180 to 180 Sets roll deflection of orientation point from universe or docking host. Disabled for docked and turrets.
destruct(int) Core block goes critical, with int seconds on the count-down timer.
corestatus() Returns an integer. 1000=undamaged. Any lesser number indicates a count down to self destruct.
Dock.
get.[attribute]() Acts as an alias to the structureID.DockID.get to which the ship is currently attached.  See DockID methods above.

---------------------------------------------
Disclaimer:  I am not in the employ of any game company.  These ideas are not provided in exchange for or expectation of any compensation whether monetary or non-monetary.  (... Although a mention in the credits would be nice) I provide these ideas solely in the hope that I might strike on an answer that the game developer may be struggling with, and thus nudge the final product towards the sort of game I would like to play.  


No comments:

Post a Comment