NetDuke32

From EDukeWiki
Jump to navigation Jump to search

About

NetDuke32 is a multiplayer-centric port based on EDuke32, developed by Jordon "StrikerTheHedgefox" Moss. Started late 2015 as a series of maintenance builds of EDuke32-OldMP, it has since branched out and evolved. NetDuke32 brings new features, QoL (Quality of Life) and netcode improvements, and tries to improve the overall multiplayer experience.

Features

(Page is a work in progress)

  • 16 player support, vs Duke3D's original 8.
  • Improved networking code that is more reliable and less prone to desynchronization than vanilla Duke3D.
  • Rewritten prediction code that gives immediate and smoother response to weapon and inventory use.
  • New, easier to understand scoreboards for both DukeMatch and CO-OP, including ping display.
  • Lifted limits for number of spawn points allowed in a map, and maps with fewer spawns than players no longer cause broken behaviour, allowing SP maps to be played online.
  • Smarter DukeBot AI that's better at pathfinding, can swim, use jetpacks, use steroids, retreat and/or prioritize items based on combat situation, and understand how elevators work. They can also be used online with other players, too!

Documentation

NetDuke32 has a few exclusive DEF tokens, GameVars, and structure members to access a few of its features. They will be listed here.

NOTE: Since NetDuke32 is still very much an early work in progress, these may be subject to changes, deprecation, or outright removal.

DEF Tokens

  • addplayercolor <palnum> <name> - Adds a palswap to the list of selectable player colors for multiplayer.
Example: addplayercolor 17 "Green (Blue Skin)"
  • delplayercolor <palnum> - Deletes a palswap from the list of selectable player colors for multiplayer. A value of -1 deletes them all. (Make sure to define your own after!)
Example: delplayercolor 23 (Which would make "Yellow" un-selectable.)

CON Commands

  • interpolate <curVal> <oldVal> <return> - Returns the interpolated value between curVal and oldVal for the currently drawn frame, useful in EVENT_ANIMATESPRITES and other display events where you might want to interpolate custom coordinates, or inherit the interpolated coords of another sprite.
  • ldistvar <x1> <y1> <x2> <y2> <return> - Returns the distance between two arbitrary x/y coordinates.
  • distvar <x1> <y1> <z1> <x2> <y2> <z2> <return> - Returns the distance between two arbitrary x/y/z coordinates.

GameVars

  • predicting (Read-only) - Returns the processing state of NetDuke32's prediction system. Useful to prevent desynchronization or visual artifacts in certain scenarios; For example, trying to call spawn in player code that is normally predicted would result in a de-sync, but guarding it with ifvare predicting 0 will make sure it only happens during the canonical gamestate, preserving synchronization.
Values:
0 = Currently processing canonical gamestate.
1 = Currently predicting upcoming gamestate.
2 = Making corrections to any mispredictions.
  • numteams (Read-only) - Returns the number of currently defined teams for TDM.
Example: whilevarvarl TEMP numteams { addvar TEMP 1 } (Will loop while TEMP is less than numteams. Useful for things like displaying information for all teams, or setting an attribute for all.)
  • DMFLAGS - Gets or sets the current DMFlags. See UserDefs section for a list of flags.
Examples:
ifvarand DMFLAGS 4 { spawn LIZTROOP } (Will spawn a LIZTROOP if DMFLAG_RESPAWNMONSTERS is enabled.)
orvar DMFLAGS 256 (Will enable DMFLAG_NOPLAYERID)

Structure Members

UserDefs (get/setuserdef[].)

  • teampal <teamnum> - Team's palette number.
Example: getuserdef[].teampal 2 TEMP // Gets team's palswap.
  • teamfrags <teamnum> - Team's frag count.
Example: getuserdef[].teampal 2 TEMP // Gets team's frag count.
  • teamsuicides <teamnum> - Team's number of suicides.
Example: setuserdef[].teamsuicides 2 0 // Sets team's suicides to 0.
  • dmflags - A bitfield containing a series of gameplay-affecting flags, such as friendly fire, respawning items, whether or not FOV changes are allowed, etc.
Flags:
DMFLAG_FRIENDLYFIRE = 1
DMFLAG_NOMONSTERS = 2
DMFLAG_RESPAWNMONSTERS = 4
DMFLAG_RESPAWNITEMS = 8
DMFLAG_RESPAWNINVENTORY = 16
DMFLAG_MARKERS = 32
DMFLAG_NOEXITS = 64
DMFLAG_WEAPONSTAY = 128
DMFLAG_NOPLAYERID = 256
DMFLAG_NOFOVCHANGE = 512
DMFLAG_NOWEAPONICONS = 1024
DMFLAG_ALLOWVISIBILITYCHANGE = 2048
DMFLAG_NODMWEAPONSPAWNS = 4096
  • m_dmflags - Same as above, but contains the flags selected in the menu, before being confirmed and transferred to dmflags when starting a new map.

Player (get/setplayer[].)

  • lowsprite - The sprite the player is standing above, if applicable. (-1 if no sprite, >= 0 if there is one.)
  • highsprite - The sprite the player is standing underneath, if applicable. (-1 if no sprite, >= 0 if there is one.)
Examples:
getplayer[THISACTOR].on_ground TEMP
ifvare TEMP 1 // We're standing on something...
{
    getplayer[THISACTOR].lowsprite TEMP // Get sprite we're above
    ifvarn TEMP -1 // We're above something...
    {
        getactor[TEMP].picnum TEMP2 // Get picnum...
        ifvare TEMP2 SEENINE // We're standing on a SEENINE!
        {
            setactor[TEMP].htextra 9999 // It's unstable! It's gonna explode!
        }
    }
}

getplayer[THISACTOR].highsprite TEMP // Get sprite we're under.
ifvarn TEMP -1 // We're under something...
{
    getactor[TEMP].picnum TEMP2 // Get picnum...
    ifvare TEMP2 THWOMP // Oh no, it's a thwomp from mario! (implying a custom actor, here.)
    {
        setactorvar[TEMP].CRUSH_DUKE 1 // Signal to the thwomp to make a Duke Burger.
    }
}


Events

NetDuke32 has some new CON events for some of its functionality.

  • EVENT_DOQUAKE [UNSYNCHRONIZED!] - Called when the game applies the screen shake for earthquakes. Allows implementing your own screen shake by setting RETURN to 0 and manipulating the camera(x/y/z/ang/horiz) variables.
THISACTOR = Player sprite.
RETURN = Earthquake time. Setting this to 0 cancels the shake.
getplayer[THISACTOR] = Current player.
  • EVENT_BOTGETSPRITESCORE - Called whenever a DukeBot tries to get the score/priority of a sprite it is considering picking up. Useful for getting bots to pick up custom items under a scripted criteria.
THISACTOR = Current sprite.
RETURN = Current sprite score/priority. Higher values mean higher priority. Set to 0 to ignore the sprite entirely.
getplayer[THISACTOR] = Current bot.
  • EVENT_FRAGGED - Called whenever a player is killed.
THISACTOR = Sprite index of fragged player.
RETURN = Sprite index of fragging player. Setting to -1 cancels the frag. See Note #1.
getplayer[THISACTOR].frag_ps = Player index of fragging player.
getplayer[THISACTOR].wackedbyactor = Sprite index of killer, regardless if a player or not.
Note #1: THISACTOR and RETURN will be the same if killed by a non-player, so check those before checking wackedbyactor.
  • EVENT_PREWEAPONSHOOT - Called just before a projectile is spawned by a weapon. Useful if you want to cancel or stagger shots, adjust player angle/pitch before firing, or work with custom ammo variables when fired, among other things.
THISACTOR - Sprite ID of player firing.
RETURN - Setting this to non-zero cancels the shot.
getplayer[THISACTOR] = Current player.
  • EVENT_POSTWEAPONSHOOT - Called just after a projectile is spawned by a weapon. Useful for adding additional functionality after the shot fires, or undoing any angle/pitch adjustments that were done in EVENT_PREWEAPONSHOOT.
THISACTOR - Sprite ID of player firing.
getplayer[THISACTOR] = Current player.

Compiling NetDuke32

The process of compiling NetDuke32 is identical to these articles, except in MinGW and Linux, you type make netduke32 instead of make.

Links