2021 Source (232 heroes)
Access: Contributor, Core
Read Before You Start first. This page only covers what is specific to the 2021 source.
Quick facts
Section titled “Quick facts”| Heroes | 232 |
| Visual Studio | 2010 (toolset v100), Win32 |
| Database scripts | Yes: full schema and stored procedures for three databases (needs SQL Server 2022) |
| Server config files | Included in server-config\: the original, unmodified set from the Korean service, with gameplay tables |
ls_query.ini |
Included in server-config\ls_dbagent\ |
| Client | Separate download: a Korean client with 231 heroes (one hero short of this source), see Client |
Repository layout
Section titled “Repository layout”| Folder | What is in it |
|---|---|
win\ |
25 solutions, with server and library projects in win\projects\ |
src\ |
Source code: servers, client, engine, launcher (LSAutoUpgrade), LSWebBroker, tools, gperftools, ziparchive |
lib\ |
Prebuilt libraries and DLLs, plus msado15.tlh/.tli for the DB agent |
extra\ |
Billing-server libraries (LS_HTTP, LS_NXSoap, LS_RestAPI, tinyxml, lib, include). Not in the original release; the community repository adds them from the 2019 source. |
LosaGame.sql, LosaGame_Log.sql, LosaLogData.sql |
Database scripts |
Database
Section titled “Database”The three scripts were generated by SQL Server Management Studio and are saved as UTF-16. They use compatibility level 160, so you need SQL Server 2022.
| Script | Database | Contents |
|---|---|---|
LosaGame.sql |
LosaGame |
134 tables, 1061 stored procedures, 9 functions, 6 views |
LosaGame_Log.sql |
LosaGame_log |
20 tables, 2 stored procedures |
LosaLogData.sql |
LosaLogData |
67 tables, 81 stored procedures |
-
Create the folder
C:\LosaDB\. The scripts place the data and log files there. Or edit theFILENAMEpaths at the top of each script. -
Run the three scripts in SQL Server Management Studio. Each one creates its own database.
-
Each script ends with a
CREATE USERfor the loginlstggame(andlstgloginLosaLogData). If those logins do not exist yet, that statement fails with error 15007 and everything else still imports. Create the logins first, or ignore that one error and add users later.
Things specific to 2021
Section titled “Things specific to 2021”extra\folder. The billing server projects expectextra\(LS_HTTP,LS_NXSoap,LS_RestAPI,tinyxml), which the original release does not have. The community repository includes those folders (plusextra\libandextra\include) from the 2019 source, sols_billingsvrbuilds without other changes.- Listed but missing headers:
ls_gamesvr\INILoader\BaseDataManager.h,ls_mainsvr\BoostPooler.h, the client’sXtrap\XTrapSDK_Integrity.h, andConsoleTextColorDefine.hfor TownPortal and LSLogClient. They are leftovers in the project files; the build test below succeeds without them. - Encoded DB password.
ls_dbagent.exe -x <password>prints the encoded form to put in the[SQL] PWkey. - Client Debug sheet.
src\LSClient\DebugSheet.propscopies the client toC:\LosaMyDevand expectsC:\Bonus\lib\. Create those folders or edit the sheet. - Fixed output folders. Some Debug builds write to
D:\LostSaga\Korea\Server\...orD:\Work\trunk\build\.... Change the Output Directory if needed. - Hard-coded test addresses exist in
ls_mainsvr\MainProcess.cpp(CheckTestZone) and the client’sioApplication.cpp. In the community repository the public ones are the placeholder192.0.2.1(a reserved address that never matches); replace them with your own. - Launcher chain. In production the client starts through the web browser, then
LSWebBroker, thenLSAutoUpgrade, thenLostSaga.exe. For development, use the debug login described in Before You Start.
Client
Section titled “Client”The client for this release is a Korean client with 231 heroes (one short of this source), taken from the Nova private server and shared as a separate download (about 1.7 GB zipped, 3.8 GB unpacked), not in Git. Its data is not packed: config\, xml\, resource\, scripts\ and shader\ are plain folders, so you can read and edit everything directly.
- The programs are rebuilt from this source (Release):
lostsaga.exe,io3dengine.dll,iofreetype.dll,lslog.dll,townportal.dllandiopac.dll. The other DLLs come from the source tree’slib\folder and from the DirectX June 2010 and VC++ 2010 redistributables.bdcap32.dllandFlash9f.ocxare kept from the original client. - Removed: the launch files with real login data, saved accounts, logs, the Nova launcher and command generator, GameGuard, the web broker, uninstaller, crash dumper and unused DLLs, plus leftovers (
resource\swf.rar,.bakfiles). - Addresses were replaced with
127.0.0.1:log_server_ipinconfig\sp2.ini,load_urlandfile_server_ipinconfig\sp2_guild.ini,storage_urlinconfig\sp2_custom_texture.ini. Set them to your own servers. Theconfig\sp2_channeling_*.inifiles still hold the old official Korean web addresses. start.bat.templateshows the launch line with every value removed. Copy it tostart.batand fill in the values from your own login server, or use the debug login in Before You Start. This Release build is not a shipping build: the options field stays0, because this client has nors.iop/map.iop(see How the login works).
Run it locally
Section titled “Run it locally”Tested on 2026-11-07 on one Windows machine: all nine server processes start and talk to each other, and three test accounts log in to the game server (CONNECT_OK with the full login data). The client was then played against these servers: login, lobby, rooms and a match work. Three windows still have layout problems from the modified client data (being fixed).
How the login works
Section titled “How the login works”In the original service the publisher web site logged the player in and started the client with a key. The 2021 (Korean) game server only checks that key against the database, so for a local setup you build the key yourself:
- The client’s command line is
<check block>?<key>?<options>?<IP key>?<server address>?.... For this client the options field is just0, and the field after it is the IP key. - Key = SEED-encoded login key (30 hex characters) + SEED-encoded user ID. IP key = the same 30 characters + the encoded IP address. The user ID and IP are encoded with the “second key”, the newest row of
define_encode_keyinLosaGame. The code isioLocalKorea::ParseLoginDataandUtil\ioEncrypted.cppin the game server;tools\lskey21.cppin the ZIP is a small command-line version. - The game server then reads
game_login_get_data: the user must exist inuserMemberDB/userLoginDB,userLoginDB.userIPmust equal the IP inside the IP key, andgameServerIDmust be 0. With[TEST] LocalTest=1inls_config_game.ini(the original value) the login key itself and its 30-minute expiry are not checked. - The server address is the IPv4 address and port packed into one 64-bit number (address bytes first):
127.0.0.1port21009is90232984699007.
Things that stop a local server
Section titled “Things that stop a local server”- Listen address. The servers listen on the address of your network adapter (
gethostbynameof the host name), and the relay and login servers on0.0.0.0, never on127.0.0.1. Either use your LAN address everywhere, orset LS_BIND_IP=127.0.0.1before starting: the community repository reads that environment variable in place of the adapter address and the hard-coded"0.0.0.0". Without the variable nothing changes. - Game server tables.
ls_gamesvrloads binary tables fromconfig\tables\*.datand stops if one is missing or has another header version. They are not in any release.LSC_SnakeLadders_Move.datfrom the client works; the ZIP has empty tables with the right version for the other seven, so the dice event, practice mode, gashapon boxes, hero items/weapons and excavation have no data. - Account type.
userMemberDB.cpTypemust be-1. The default0means Wemade channeling, and the server refuses those users. - User ID length. 4 to 12 characters.
- Client version. The rebuilt client reports version
1, so set[ClientVersion] IsUse=0(orClientVersion=1) inls_config_main.ini. - Anti-cheat.
[NProtect] use=0inls_config_game.ini; the client has no GameGuard. - Client ports. In the client,
config\sp2.ini log_server_portis the DB agent in log server mode andconfig\sp2_guild.ini file_server_portis the file write server.
Ports used
Section titled “Ports used”| Server | Port |
|---|---|
ls_mainsvr |
21000 (servers), 21001 (GM tool) |
ls_dbagent game / log DB / log server |
21011 / 21012 / 21013 |
ls_billingsvr |
21021 (21022 monitor, 21023 GM tool) |
ls_gamesvr |
21009 (client, TCP and UDP), 21031 (relay and login), 21032 (monitor) |
ls_relaysvr |
21055 |
ls_loginsvr |
21005 |
ls_filewritesvr |
21030 |
Known gaps
Section titled “Known gaps”- No billing: every cash purchase fails, and the billing server keeps retrying a publisher connection (log noise only).
- The DB agent logs
QUERY DISMATCH FIELDS ... 2112once:game_spirit_get_datareturns different columns than the main server expects.
Build test results
Section titled “Build test results”The community repository has a few small fixes on top of the original release. PATCHES-LosaDev.md at the repository root lists every one of them. Built on 2026-11-07 from that repository in Release|Win32 with the v100 toolset, the Version.h fix and static-runtime Boost:
| Solution | Result |
|---|---|
ioINILoader, Log, LogDLL, FrameTimerDLL, iocpSocketDLL, LSLog, SharedContainer, PerfMon, TownPortal, ioFreeType |
Build |
io3DEngine |
Builds |
ls_dbagent, ls_mainsvr, ls_billingsvr, ls_gamesvr, ls_relaysvr, ls_loginsvr, ls_filewritesvr |
Build |
LSClient |
Builds LostSaga.exe in src\LSClient\Release\ (about 6 minutes) |
ioPac |
Builds (with the BigPac fix below) |
What the fixes were
Section titled “What the fixes were”ls_relaysvrfailed withC2661:Manager.cppcalledUDPNode::InitMemorywith 5 arguments, butiocpSocketDLL(source and prebuilt library) only has 3- and 7-argument versions, and no other version exists in any of the three releases. The 2014 relay server has the same line with the last two arguments commented out, so the repository now does the same:InitMemory(3000,16384*2,6000/*,6000,1000*/).ls_billingsvrneeded theextra\folder (see above).LogDLLandFrameTimerDLLcopy their DLL intobuild\zone_office\...after building. That step now skips folders that do not exist instead of failing the build.ioFreeTypelinked../LSLog/bin/LSLog.lib, a folder this release does not have (LSLogbuilds intolib\).src\ioFreeType\StdAfx.hnow points at../../lib/.ioPacdid not compile:BigPac.cppis newer thanBigPac.h(the header is the 2014 one) and uses members and functions the header does not declare.BigPac.hnow declares them, andOpenBigPacAll(IOP Manager only) is wrapped in#ifdef STATIC_PAC_APIlike the function it calls. The rebuiltiopac.dllexports everything the original did.
Placeholders in the repository
Section titled “Placeholders in the repository”Real addresses, keys and accounts were taken out of the code before it was shared. PATCHES-LosaDev.md lists every file:
- Public IP addresses the code connects to are
127.0.0.1; where the code compares the server’s own IP against a fixed list, the address is192.0.2.1(reserved, never matches). - Publisher, operator and game-service host names (Nexon, Gemscool, Z8Games, Garena, PlayPark, Valofe, OGPlanet, Daum, the old
lostsaga.comweb, patch and CDN hosts and others) are gone: URLs start withhttp://127.0.0.1/and keep their path, bare host names areexample.invalid, and staff e-mail domains are@example.invalid. - Passwords, API keys, app ids, hash keys, login tokens, test accounts and anti-cheat license strings are
CHANGE_ME. - Vendor SDK binaries (XTrap libraries,
bxIPGClient.dll) are not included. The billing server uses a small stand-in header forbxIPGClient, so it still builds; the Japan IPG and Adbill billing calls just fail.
Point these at your own servers when you need them. The pack passwords and the client/server protocol keys were kept, because the game needs them.
Good first tasks
Section titled “Good first tasks”- Turn the multi-machine
server-config\set into a ready one-machine set. - Add the missing headers listed above, or remove them from the project files.
