[WIP] Spectator Utility Library

Maps, modifications, add-ons, projects, and other releases for Zandronum. Also includes announcers.
Post Reply
User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

[WIP] Spectator Utility Library

#1

Post by ibm5155 » Wed Feb 07, 2018 1:26 am

Heh, zandronum doesn't have Zscript yet but we got SUL :biggrin:
And also Thanks Torr.

Download V1.1
Spoiler: old versions (Open)
After years of research I'm here to present you the Spectator Utility Library (SUL), SUL is a packet of scripts that will help you to Interact with spectators, with that you can do stuff like knowing the coord from where the spectators are looking at, check if the spectator is looking to an object and what's his distance from that object,...

The Project is broken in 3 sub projects:
>SpecUtil : The main library with the minimal required files to get information from spectators.
>SpecExample_1.0: An example mod with build in code to demonstrate some of the use cases of SpecUtil, some of those are:
--Rendering where the spectators are ingame.
--Showing who's watching you (coop spy) [limited to only show the spectators that are watching you but it could be expanded]
>DumbTid: This is a simple wad that sets the players a tid, this is only needed in case you want to run SpecExample with a mod or no mods where it doesn't set the players tid.

Here's an example of SpecExample in action (not as perfect as it's right now)
https://www.youtube.com/watch?v=UZ8o0f20ldU
In Knuckles Horde I used SUL for:
-Rendering the spectators (black transparente balls)
-Rendering the Knuckles (since weapons skin cannot have 3D models :( )
-Adding Dead animation to knuckles.
-Showing who's watching you.

-----------------------------------------------------------------------

Q: I want to Modify or Add those files inside of my mod, am I allowed to do that?
A: Yes, feel free to do what you desire with this mod.

Q:How do I include the SpecUtil to use with my wad?
A: You just don't, all you need is to write this :

Code: Select all

int SpecZ = ACS_NamedExecuteWithResult("GetConsolePlayerCameraZ");
if you have loaded the SpecUtil pk3 file OR you have added the acs lib file inside your acs folder and added his name into loadacs, it should be working just fine.
If SUL wasn't loaded then it'll show an error messagel like script GetConsolePlayerCameraZ wasn't found.

Q:Why scripts with return and not functions
A: Because of
-I wanted to force everyone to use the SOL code in clientside only code.
-So you could make decorate objects that could interact with the SOL "functions" without the need of adding new acs code.
Last edited by ibm5155 on Sat Feb 10, 2018 7:17 pm, edited 1 time in total.
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

[WIP] Re: Spectator Utility Library

#2

Post by ibm5155 » Thu Feb 08, 2018 12:49 am

Function List From SpecUtil V1.0:

Code: Select all

-GetConsolePlayerCameraX: 
//USAGE:
// Get the X view Coord from the activator, this way you can find where the activator is looking at
//RETURN:
// (FIXED POINT) X Coord

-GetConsolePlayerCameraY: 
//USAGE:
// Gets  the Y view Coord from the CONSOLEPLAYER, this way you can find where the CONSOLEPLAYER is looking at
//RETURN:
// (FIXED POINT) Y Coord

-GetConsolePlayerCameraZ: 
//USAGE:
// Get the Z view Coord from the CONSOLEPLAYER, this way you can find where the CONSOLEPLAYER is looking at
//RETURN:
// (FIXED POINT) Z Coord

-GetConsolePlayerCameraAngle: 
//USAGE:
// Gets the the angle Coord from the CONSOLEPLAYER, this way you can find where the angle that CONSOLEPLAYER is looking
//RETURN:
// (FIXED POINT ANGLE) Pitch

-GetConsolePlayerCameraPitch: 
//USAGE:
// Get the the Pitch Coord from the CONSOLEPLAYER, this way you can find where the Pitch that CONSOLEPLAYER is looking
//RETURN:
// (FIXED POINT PITCH) Pitch

-CheckConsolePlayerCloser (int Distance, bool check 2D)
//USAGE:
// Check if the object who called this script (the activator) is closer to the CONSOLEPLAYER
//INPUT:
// Distance: (INTEGER) the max distance that the activator should be from the CONSOLEPLAYER
// Check_2D: (BOOL) 1 if you want to ignore the z coord, 0 if you want to also check the z coord
//RETURN:
// (BOOL) 1 if the Activator is closer to the clientside player, else 0.

-GetConsolePlayer_VectorAngleWithTid (Tid)
//USAGE:
// Check the angle formed by the CONSOLEPLAYER (being the center) with a given Tid
//INPUT:
// Tid: (TID) The Tid to be checked
//RETURN:
// (FIXED POINT ANGLE) Angle

-CheckifConsolePlayerLOS (Tid, LOS Angle)
//USAGE:
// Check if the CONSOLEPLAYER is in Line of Sight with a given Tid.
//INPUT:
// CheckTid: (TID) the Tid of the object to be checked
// fixed_point_angle: (FIXED POINT ANGLE) the left/right angle offset that the player should be looking at the center of the Object.
//RETURN: 
// (bool) 1 if the player is in LOS with the object, else 0.
//WARNING: 
// THIS function doesn't check for walls
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

User avatar
Fused
Contributor
Posts: 663
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Contact:

[WIP] Re: Spectator Utility Library

#3

Post by Fused » Thu Feb 08, 2018 8:40 pm

Really well done. This can prove very useful when making clientsided effects.
My mods
Image Image

My socials
Image Image

Samuzero15tlh
Forum Regular
Posts: 255
Joined: Wed Sep 09, 2015 2:21 pm
Location: In home, sweet Home
Clan Tag: <skr>

[WIP] Re: Spectator Utility Library

#4

Post by Samuzero15tlh » Thu Feb 08, 2018 10:10 pm

Pretty useful!, NOW its possible to make spectator ghosts, cant wait to use this, good job!

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

[WIP] Re: Spectator Utility Library v1.1 Released

#5

Post by ibm5155 » Sat Feb 10, 2018 7:15 pm

Download V1.1

Ok here's a small but interesting update from SpecUtil and Spec Example kit:

-SpecUtil:
--3 New functions added (GetConsolePlayerX, GetConsolePlayerY, GetConsolePlayerZ)

-SpecExample:
--Now you do not need the DumbTid to work with maps that doesn't set the player tid
--You can now also see the players that are watching you not only the spectators
--set a player tid in case the existing mods doesn't that
--Simplified code so now the server side only send requests from the clients.
--whos watching you font is now smaller.

New Functions in SpecUtil V1.1

Code: Select all

-GetConsolePlayerX
//USAGE:
// Get the X Coord from the activator, this way you can find where the activator is
//RETURN:
// (FIXED POINT) X Coord
    if(SetActivatorToPlayer(ConsolePlayerNumber()) == 0){
		print(s:"Error in SetActivatorToPlayer, return 0");
    }	
    SetResultValue(GetActorX(0));
}

-GetConsolePlayerY
//USAGE:
// Get the Y Coord from the activator, this way you can find where the activator is
//RETURN:
// (FIXED POINT) Y Coord
    if(SetActivatorToPlayer(ConsolePlayerNumber()) == 0){
		print(s:"Error in SetActivatorToPlayer, return 0");
    }	
    SetResultValue(GetActorY(0));
}

-GetConsolePlayerZ
//USAGE:
// Get the Z Coord from the activator, this way you can find where the activator is
//RETURN:
// (FIXED POINT) Z Coord
    if(SetActivatorToPlayer(ConsolePlayerNumber()) == 0){
		print(s:"Error in SetActivatorToPlayer, return 0");
    }	
    SetResultValue(GetActorZ(0));
}
SpecExample 1.1 was tested with the following mods:
-Jump Maze
-Zombie Horde + Addons
-Vanilla Doom
-Who Dun It
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

User avatar
Ænima
Addicted to Zandronum
Posts: 3523
Joined: Tue Jun 05, 2012 6:12 pm

[WIP] Re: Spectator Utility Library

#6

Post by Ænima » Tue Feb 13, 2018 12:54 am

Sweeeeet.

Good job, ibm. :)
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !


ZandroSkins
: a pack made by our community

Post Reply