Support OpenKore:
Learn about
the Fund Pool

Programming language

OpenKore can be split into several components:

Component Programming language Notes
Main program
  • openkore.pl
  • functions.pl
  • *.pm
Perl -
Pathfinding, DLL injection (X-Kore), and more.
  • XSTools.dll (Windows)
  • XSToos.so (Linux/Unix)

(The source code is found in src\auto\XSTools)

C/C++ Some things in Kore are written in C or C++, for the following reasons:
  • Performance. Parts that do a lot of calculation are optimized in C++.
  • Some features are not directly available in Perl. Some techniques used by X-Kore mode use very low-level Windows API calls, and can only be implemented in C or C++.

XS is the native C-to-Perl glue. You can write stuff in C/C++ but provide a Perl API through XS.

The following things are implemented in XSTools:

  • Pathfinding calculation. It used to be written 100% in Perl, but that was (literally) 100 times slower.
  • DLL injection functions, used by X-Kore mode.
  • Platform-specific functions, such as a wrapper for ShellExecute() on Win32.
  • Various other utility functions.

Because of performance reasons, the most performance-critical parts are written in C++ (such as pathfinding).

Network data interception and redirection.
  • NetRedirect.dll

Source code (found in src\auto\XSTools\win32):

  • netredirect.cpp
  • utils-netredirect.cpp
C++ Used by X-Kore mode. This DLL is injected into Ragexe.exe's process space, and intercepts all incoming and outgoing network data, and redirects some of it to Kore. This makes it possible for Kore to control the Ragnarok Online client.

About Perl

Perl (Practical Extraction and Reporting Language or Pathologically Eclectic Rubbish Lister) is an open source, cross-platform, interpreted, programming language. It's main strength is string handling and parsing. Regular expressions makes it extremely easing to manipulate strings. You rarely have to worry about memory management since a lot of it is done automatically for you. It's syntax may be weird at first (compared to other languages, like C++, Pascal, Basic, etc.), but once you know it, you'll find out it's actually quite powerful. Perl, if used properly, is a very productive language.

Although Perl is an interpreted language, it can be "compiled". Kore uses ActiveState PerlApp (part of ActiveState Perl Dev Kit) to produce a Win32 binary. Compilation is only done by developers when they release a version to the public, since you can't expect all Windows users to install a Perl interpreter. There's no reason for developers to compile openkore.pl every time they make a change; it's much easier to run openkore.pl directly from the Perl interpreter. Linux users can run openkore.pl directly. Most Linux distributions come with a Perl interpreter by default.

Documentation

Learning Perl is a good online book which introduces you to the Perl programming language.

Other Perl documentation:

The IRC channel #perl at irc.freenode.net is a good place to get help if you can't figure out something. If you have a Kore-specific question you could ask at our forums.

If you have and don't know where to get a Perl interpreter/compiler, see Setting up the development environment.

More information about XS

About C++

If you're a developer then it's unlikely that you haven't heard of C++ already. There are many books about C++, try looking at your local library. And if you don't want to read a book for whatever reason, try these websites:

XSTools.dll and NetRedirect.dll should be compilable by any standards-compliant C++ compiler. But the recommended compiler is GCC (part of Cygwin). See also Setting up the development environment.