DXS PlugIns

“DX Studio is a 3D editing + engine suite for Windows XP/Vista/7/8/10. It was most popular between 2005 and 2010, but can still be a useful tool for creating interactive 2D+3D on Windows.”


DXStudio Plugins ‘Hands On’ Document

This is a little pamphlet I wrote about the basics of plugin creation for DXStudio.

FileFile-DateSizeRemarks
DXStudio Plugins_HandsOn_1.0.1.pdf9/27/2010960 KBDXStudio Plugins 'Hands On' Document. v1.0.1

mikochess_plugin_scr1

Chess Plugin

The chess plugin consists of a (threaded) chess engine that lets you calculate moves, so that people could play against the computer (or the computer playing by itself). There are some features to support saving and loading of games and adjust the strength and so on. The plugin by itself does not implement any graphical representation of the chess board. That is what we have DXStudio for, eh?

License

As the plugin uses code from Marcel van Kervinck’s MSCP chess engine (which is under the GPL), the plugin itself is released under the GPL. Download the license and source code below.

Plugin Properties (v1.0.2)

sID_String
Returns the plugin’s identification string (read only).

iStrength
The chess engine’s search depth (= strength). An integer value ranging from 1(weak) to 8(strong). Default value: 4 (read/write). Higher strength will cause longer thinking times.

iCalcRunning
A flag, indicating that a (threaded) calculation is running in the chess engine. 0=nothing active, 1=thread running. (read only)

Plugin Methods (v1.0.2)

NewGame
Resets the chess board and prepares for a new game. Returns ‘true’ on success, ‘false’ on error.

GetCurrPlayer
Gets the current player who should do his/her move. Returns 0 for WHITE and 1 for BLACK.

MakeMove
Submits a new move to make. sMove should be in formats like ‘e2e4’ (regular move), ‘e7e8=Q’ (promotion). Castling is done by submitting the king move. Returns ‘true’ on success, ‘false’ on error.

RequestMove
Calculates *and executes* the next move on the board. Returns the result as a string parameter to a callback routine, given in string ‘sCallback’. The data passed to the callback routine is in formats like ‘e2e4’ (regular move), ‘e7e8=Q’ (promotion). Castling is expressed by giving the king move. ‘1-0’ (white wins), ‘0-1’ (black wins), ‘1/2-1/2 Draw by repetition’, ‘1/2-1/2 Maximum moves reached’, ‘1/2-1/2 Stale mate’). Returns ‘true’ on success, ‘false’ on error.

GetValidMoves
Calculates possible moves of the token on the ‘sFrom’ field (sFrom, like, ‘e2’) and gives back a string (format like ‘e2e3,e2e4’; castling is expressed by showing the possible king move). Returns an empty string on error (or when no movements allowed).

SetPositionsFEN
Sets the current token positions on the board by submitting a string in ‘Forsyth–Edwards Notation (FEN)’ format. Returns ‘true’ on success, ‘false’ on error.

GetPositionsFEN
Gets the current token positions on the board by returning a string in ‘Forsyth–Edwards Notation (FEN)’ format. Returns an empty string on error.

AbortThinking
Aborts the (threaded) calculation of a move (e.g., when search depth was set too high). It is recommended to abort the game and reset, as this could leave the chess engine in an undefined state. Returns ‘true’ on success, ‘false’ on error.

IsValidMove
Checks if the given move string is a valid move. Must not be called when a calculation is running. Returns ‘true’ or ‘false’.

IsKingAttacked
Checks if the king of the current active player is under attack. Must not be called when a calculation is running. Returns ‘true’ or ‘false’.

GetMovesCount
Returns the number of moves that the current player can do (all tokens). Returns an integer (-1 on error).

ProposeMove
Calculates *but does not execute* the next move on the board. Returns the result as a string parameter to a callback routine, given in string ‘sCallback’. The data passed to the callback routine is in formats like ‘e2e4’ (regular move), ‘e7e8=Q’ (promotion), ‘o-o’ (short castling), ‘o-o-o’ (long castling), ‘1-0’ (white wins), ‘0-1’ (black wins), ‘1/2-1/2 Draw by repetition’, ‘1/2-1/2 Maximum moves reached’, ‘1/2-1/2 Stale mate’). Returns ‘true’ on success, ‘false’ on error.

Usage Demo App

This very basic application shows the usage of the plugin. Upon start, the computer begins playing by itself – until an end condition is reached. Then, the app idles.

mikochess_plugin_scr2

Downloads
FileFile-DateSizeRemarks
GPL_License.txt09/19/201018 KBLicense of the plugin/dxeffect
miko_chess_1.0.2.dxeffect.zip22/11/10 81 KBChess Plugin v1.0.2 (zipped dxeffect)
DXStudio_Chess_Plugin_1.0.2.zip22/11/10198 KBChess Plugin 1.0.2 (Source)
VS2008 C++ project
Chess_Demo_1.0.2.dxstudio.zip22/11/101.5 MBChess Plugin 1.0.2 Demo App
(Unlocked DXStudio document)

mikogetkeystate_plugin_scr1

GetKeyState Plugin

The GetKeyState Plugin is a helper plugin for DXStudio. It can be added to 2D and 3D scenes, and exposes a few functions to detect the state of ‘lock’ keys (like num lock, scroll lock, etc).

Plugin Functions

Please see the example doc for information on how to use these functions.

GetCapsLockOn()
Returns TRUE if CAPS LOCK is on. Returns FALSE otherwise.

GetScrollLockOn()
Returns TRUE if SCROLL LOCK is on. Returns FALSE otherwise.

GetNumLockOn()
Returns TRUE if NUM LOCK is on. Returns FALSE otherwise.

GetInsertLockOn()
Returns TRUE if INSERT LOCK is on. Returns FALSE otherwise.

GetPauseLockOn()
Returns TRUE if PAUSE LOCK is on. Returns FALSE otherwise.

Downloads
FileFile-DateSizeRemarks
getkeystate.dxeffect.zip8/24/201048 KBGetKeyState Plugin v1.0.0.1
getkeystate_sampledoc.dxstudio.zip8/24/201050 KBA demo doc, showing the usage of the different functions

cryptorplugin

Cryptor Plugin

The Cryptor Plugin is a helper plugin for DXStudio. It can be added to 2D and 3D scenes, offering string and data en-/decryption (using the 3DES algorithm of the Windows CryptoAPI).

Plugin Functions

Please see the example doc for information on how to use these functions.

EncryptString()
Submit a password and string and get it back encrypted and base64 encoded (thus again being a string).

DecryptString()
Submit a password and encrypted and encoded string; get it back decoded and decrypted.

EncryptByteData()
Submit a password and a Javascript Array of byte values. Get another Array of byte values back, encrypted.

DecryptByteData ()
Submit a password and a encrypted Javascript Array of byte values. Get another Array of byte values back, decrypted.

EncryptStringCallback()
Useful for lots of data to encrypt. Submit a password, data string and a string pointing to a function that shall be called back once encryption is ready. Use ‘GetCryptJobStringData’ in the callback routine then, to retrieve the data.

DecryptStringCallback()
Useful for lots of data to decrypt. Submit a password, data string and a string pointing to a function that shall be called back once encryption is ready. Use ‘GetCryptJobStringData’ in the callback routine then, to retrieve the data.

GetCryptJobStringData()
Used with ‘DecryptStringCallback’ and ‘EncryptStringCallback’ (see above).

Downloads
FileFile-DateSizeRemarks
cryptor.dxeffect.zip7/26/201063 KBCryptor Plugin v1.0.0.1
CryptorSampleDoc.dxstudio.zip7/26/201073 KBA demo doc, showing the usage of the different functions

particlesplugin

2D Particle Plugin

The Particles2D Plugin is a helper plugin for DXStudio. It can be added to 2D effectpoints in 2D scenes of DXStudio documents, providing some basic emitter functionality.

Plugin Functions

Please see the example doc for information on how to use these functions. By design, the plugin is configurable by JS script only. Setting attributes via the DXStudio editor interface is not implemented.

getPosWorld(…)
setPosWorld(…)
addColorBlip(…)
addBitmap(…)
setAngularRange(…)
setSpeedRange(…)
setLifetimeRange(…)
start(…)/stop(…)
setFrequency(…)
getParticleCount(…)
setExplosion(…)
setGravity(…)
setFading(…)
setRotRange(…)

Downloads
FileFile-DateSizeRemarks
particles2D.dxeffect.zip6/4/201068 KBParticles2D Plugin v1.0.0
Particles2D_sampledoc.dxstudio.zip6/4/2010266 KBA demo doc, showing the usage of the different functions
2DWaterfall.dxstudio.zipp6/13/2010930 KBCardek's 2DWaterfall Demo
A demo doc (pwd locked), made by Cardek, posted at the DXStudio forums

utilplugin

Utility Plugin

The MiKo Utility Plugin is a small helper plugin for DXStudio. It can be added to DXStudio documents and exposes some functions that might be useful (and are not yet in the core engine).

Plugin Functions

getHDDSerial()
Returns the system’s HDD C:\ serial number (or 0 if not found), retrieved from kernel32.dll’s ‘GetVolumeInformation()’. This will return a unique serial that is assigned by windows upon FORMATTING of the respective partition. Read: The number will change on HDD reformat.

getShaderVer()
Returns the gfx card’s shader version, as reported by DirectX’s ‘GetDeviceCaps()’. A string of format ‘major_ver.minor_ver’ is returned. On error, it is ‘0.0’.

getProcInfo()
Returns the computer’s processor info, retrieved from Window’s registry. A string of format ‘VendorIdentifier * ProcessorIdentifier * ProcessorNameString’. On error, it is ‘n/a * n/a * n/a’.

getVideoMem()
Returns an estimate of the amount of available texture memory in MB, retrieved from DirectX’s ‘GetAvailableTextureMem()’. The value is rounded to the nearest MB integer value. Returns 0 on error.

getTotalMem()
Returns the size of the computer’s total physical memory in (and rounded to) Kilobytes (KB). Will return 0 on error.

getFreeMem()
Returns the size of the computer’s free physical memory in (and rounded to) Kilobytes (KB). Will return 0 on error.

saveScrnShot(sFilePathName,sFiletype)
Saves a screenshot of the current front buffer to disk. Pass in complete path and filename (e.g., ‘C:\screenshot.png’) as sFilePathName. sFiletype is the format to be saved (string) with possible values ‘bmp’, ‘png’, ‘hdr’ (lower case). Will return FALSE on error (Note that the call might return TRUE and fail afterwards, as it is executed async to the JS call.

getWindowsVer()
Returns a string, identifying the Windows version running. Possible values are: ‘Windows7/Server2008R2′,’WindowsVista/Server2008′,’WindowsServer2003′,’WindowsXP’,’Windows2000′. On error, it is ‘n/a’.

getEthMAC()
Returns a string, identifying the MAC address of the first ethernet adapter being found by Windows. Format like ‘123:12:23:34…’ (numbers given as decimals). On error, it is ‘n/a’.

getGfxName()
Returns a string, describing the primary graphics device (graphics card) registered to the system. On error, it is ‘n/a’.

Downloads
FileFile-DateSizeRemarks
UtilPlugin.dxeffect.zip5/22/201058 KBUtility Plugin v1.0.3
UtilPluginDemo.dxstudio.zip5/22/2010331 KBA demo doc, showing the usage of the different functions