This plugin, similar to the gus plugin, allows your discord server to communicate with the Sven Co-op game server
. Unlike gus, this plugin can be used on any of your servers.
This plugin is not the final version
, it is not multifunctional
and has many problems
including game crashes. This is only a test plugin at the moment.
This plugin is so called because it uses the DPP
(Discord Plus Plus
) library.
I will finalize this plugin when I have free time.
You can add additional features to this plugin, such as the use of ChatGPT
.
Installing the plugin consists of several steps:
- Download the release version of the plugin;
Unzip
the files from the archive to a convenient location;- Go to the root folder of the game (for example
C:\Program Files (x86)\Steam\steamapps\common\Sven Co-op
) and move all modules from theSven Co-op
folder to the root directory of the game. Remember, never rename the name of modules (.dll
); - Now you will need to
create
yourbot
in discord and add it to your server. Go to this link and click theNew Application
button;
- After creating the bot, you will need to go to the
Bot
tab;
- Here you will need to click on the
Reset Token
button. After resetting the token, you will need tocopy
it andsave
it to sometext file
. The token will look something like this:MFEA8U312NjAAJGHFEAFJ11NFG813421QzNTM2MzM2OA.GYRvA8.v-cOI6F0qO412fahfeaJRqfToWKuYGITERBYLWI5IM
;
- Now you need to go to the
OAuth2
tab;
- Here you need to find the
OAuth2 URL Generator
section and in it find thebot
checkbox and click on it. After that, just below inBOT PERMISSIONS
you need to select theAdministrator
checkbox;
- Now there is a
link
at the bottom of the page that you need tocopy and paste
it into yourbrowser
;
- After that you will need to
select the server
on which you want toadd the bot
and click on theContinue
button; - Now you need to create or select an existing
channel
andcopy
its link. In thelink
, you will need tocopy
thelast digits
andsave
to the same file where you saved the bot token;
Important
Now you have two
ways to load the module into the game
process / svends.exe
(The second way is better).
First way
: just scroll down and start reading the instructions from step12
;Second way
: follow the instructions under theImportant
section starting from step1
.
If you chose the second way
, you do not necessarily need to use the SvenJect.exe
program. You can load the module into the game
/ svends.exe
process simply by following the steps below:
- Once you have received the
bot token
and copied thechannel digits
, you will need to go to the..\Sven Co-op\svencoop\dlls
folder; - Move the
SvenDPP.dll
module here; - Go back to the
..\Sven Co-op\svencoop
folder and find theliblist.gam
file there and open it; - After opening the file, insert the line
gamedll “dlls/SvenDPP.dll”
(gamedll "dlls/SvenDPP.dll") at the end (Otherwise yourgame
/svends.exe
will crash). For example:
- Now after running
svends.exe
the module will be loaded to the server automatically. Also if you runsvencoop.exe
and create your local server, the module will be loaded automatically too.
You can only useSvenJect.exe
to save text field values. Just start the injector, fill in all fields and click on theSave
button. You can also change the registry value for the fields manually. To change the field values you need to open the following path in yourregedit
:HKEY_CURRENT_USER\SOFTWARE\SvenJector
.
Also, if you decide to go straight to step two without startingSvenJect.exe
, you will need to create aSvenJector
section in the registry. In it you will need to create fields of typeREG_SZ
:ChannelID
andToken
and write the relevant values there.
12. After these steps, run the SvenJect.exe
program. In the Token
text field specify the bot token
. In the Channel ID
text field specify the channel number
. You can do this using the keys Ctrl + C
and Ctrl + V
. The result of copy and paste should look like this:
13. Now start the game and create your server or run svends.exe
. You can simply use the command in the console: map %mapname%
. You can also select the process in which you want to embed the module;
14. Once the server has been fully loaded, go to the SvenJect.exe
program and click on the Load
button;
15. If you have done everything correctly, then after loading the module into the game process, the bot in discord should send you the message SvenDPP.dll successfully injected to %procname%!
and also, the injector should display a window with the same text;
16. Never rename the SvenDPP.dll
module name. Also SvenDPP.dll
module must be located in the same directory with SvenJect.exe
injector;
17. Now you can send messages
to the game chat
and they will be displayed on your server in discord
. Other players messages will also be displayed in the discord server.
In version 0.4
the ability to determine the country of a user when he writes a message in chat was added.
To be able to view the country of a player who is writing messages in game chat, you will need to follow these steps:
- Go to the
Steam
community for developers at this link: https://steamcommunity.com/dev/apikey; - If you need to bind
Steam Guard
, do it; - After binding
Steam Guard
, give a name to your key. In this case I chose the nameSvenDPP
. Your key will look something like this:F211961A57093ED91357EE49B57725EM
; - Then click on the
Register
button and register yourAPI key
. The final result will look like this:
- Copy the contents of the key and paste it into the
Steam API
field in theSvenJect.exe
program; - After all actions are completed, you will be able to view the country of the player who sent the message in the game chat.
Player country display will not work with thesv_lan 1
command because ofSTEAM_ID_LAN
orSTEAM_ID_PENDING
.
Also, in case a player does not have a country specified in hisSteam profile
, then when he writes something in game chat, his country will not be displayed. For example:
IfSteamAPI
is missing, the requests will not be executed, and instead of the player country icon, the default icons will be displayed when incoming messages are displayed on the server inDiscord
.
You can also enter theSteam API Key
manually by creating theSteamAPI
parameter in yourregedit
underHKEY_CURRENT_USER\SOFTWARE\SvenJector
.
Currently, only a few commands are available to the bot. There are plans to add more commands to interact with the game server in the future. Writing commands is case insensitive.
If you do not specify an argument to the command, the discord bot
will show you the relevant error.
!send %msg%
- Allows you to send messages from your discord to the game server. Messages sent with this command will be displayed to all players on the game server. This is the command you need to write in your discord server. A simple example:!send Hello from Discord!
;!cmd %command%
- Allows you to change the value of any variable on the game server. For example:!cmd sv_cheats 1
.
Build type: Release/x86
Information: SvenJect
uses the standard gdi32.dll
library to render the control, so you don't need to plug in any dependencies or add additional libraries to your project. The gdi32.dll
library is always loaded into all processes by default.
Build type: Release/x86
Information: To compile a SvenDPP
project, you will need to specify the included directories and libraries in the project properties. You also need to add the dpp.lib
library, the wininet.lib
library, and the detours.lib
library to the linker. Also, to learn more about the DPP
library installation process, see Additionally
section.
- The injector interface does not use standard controls with the
OWNERDRAW
flag. All interface elements are drawn manually usingdouble buffer
, but sometimes the interface may flicker. The reason for this is that I am having trouble using thevgui.lib
library to render the window asSven Co-op Dedicated Server
does; - There is also a
TABSTOP
system in the interface as is done in standard windows; - It seems to me that drawing the interface manually is much faster than restyling the interface via the
OWNERDRAW
flag, especially since not all standardWindows
elements support this flag; - There are also font display issues on older
Windows
. The window system menu usesUnicode
characters as text. For example:
TheLoad
,Save
andCancel
buttons are used for the following purposes: Load
- used to inject the module into the game process. If your game will not run or there is any error during injection, the program will show youMessageBox
with the error text;Save
- used to save entered values to text fields. All values are saved in the system registry. Also, field values are saved automatically when you click theLoad
button;Cancel
- used to close the program. You can also close it by pressing theX
button or theEscape
key.
The library that was used is presented below:
- Library repository - https://github.com/brainboxdotcc/DPP;
- Library installation - https://dpp.dev/install-windows-zip.html.
REMEMBER: This library is not a final
product and will be finalized in the future.
REMEMBER: You may also have frequent crashes when using it.
REMEMBER: You may also find junk code
in the source code, which will be removed in the future.
REMEMBER: Also, failures may occur if there is no token
or channel id
.
REMEMBER: If your discord
message that you are trying to send to the game server is too large, it will not be displayed.
REMEMBER: Also, SvenJect.exe
uses only the main window
for drawing, so other dialog boxes
currently use the standard interface.
REMEMBER: The text field
has a simple implementation, so it does not have the functionality of standard Windows
controls.
REMEMBER: You can click on the button to get more information on how to use editbox.
REMEMBER: All this functionality could have been done via Metamod
or SvenMod
.
REMEMBER: You can inject the library manually and without using SvenJector.exe
.