Installation¶
The Smwv module is published to the Maven Central Repository.
Smwv client¶
Smwv is divided into two, you need to include the dependencies and static library in your jni¶
Add dependency:¶
implementation "io.github.ruan625br:smwv:<version>"
implementation("io.github.ruan625br:smwv:<version>")
[versions]
smwv = "<version>"
[libraries]
smwv = { module = "io.github.ruan625br:smwv", version.ref = "smwv" }
build.gradle.kts¶
implementation(libs.smwv)
Adding the static library¶
- Download the static library from the release page
- Extract the file and copy the
mwv
folder to: /your_jni/vendor/. - Open the
Android.mk
file and includelibMwv
:... # libMwv include $(CLEAR_VARS) LOCAL_MODULE := libMwv LOCAL_SRC_FILES := vendor/mwv/libMwv.a include $(PREBUILT_STATIC_LIBRARY) ... LOCAL_STATIC_LIBRARIES := libMwv
Setup the static library¶
Open the file /your_jni/net/netgame.cpp Add the following code:
...
#include "vendor/mwv/Mwv.h"
...
CNetGame::CNetGame(const char* szHostOrIp, int iPort, const char* szPlayerName, const char* szPass)
{
...
m_pRakClient = RakNetworkFactory::GetRakClientInterface();
if(!m_pRakClient)
{
Log("[err:NetGame]: m_pRakClient doesn't inited. Wtf?");
exit(0);
}
mwv::initializeNetwork(m_pRakClient, ID_JUAN); //change ID_JUAN to another packet Id
...
}
...
void CNetGame::UpdateNetwork()
{
...
switch(packetIdentifier)
{
...
case ID_JUAN: // you packet Id
mwv::processIncomingPacket(pkt);
break;
}
}
Warning
The ID_JUAN
is your packet id, check the availability in PacketEnumeration and create one
Smwv server¶
- Download the
SMWV.inc
file from the release page - Copy to /your_server/pawno/include/
- Install the following plugins: