ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
Modified LuaJIT library

« Previous 10 events | 1 2 3 4 5 6 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  19:06:21  26 December 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
Messages: 867

---QUOTATION---

Lastly, if there are any C/C++programmers interested in helping this project along, a GitHub repository is easily set up. Just sayin'.
---END QUOTATION---



Although I don't know C/C++ I do believe there are a few programmers floating around here that do so I think it would be sweet if you released the source on github.

I'd like to learn C/C++ so maybe having the source for your great project would inspire me to try and learn.
  19:31:06  26 December 2013
profilee-mailreply Message URLTo the Top
Xetrill
(Senior)
 
On forum: 07/08/2008
 

Message edited by:
Xetrill
12/26/2013 19:32:18
Messages: 129
Jketiynu: LOL, this project is hardly great, not by any standard. I'm just extending and enhancing LuaJIT to make it better in regards to STALKER.

If you are new to programming, might I suggest an alternative to C/C++. Something simpler like Python; not because C/C++ is so hard, but because there goes a lot into it. Like toolchains and build-systems.
IDE's like Visual Studio hide a lot of that, but it's still all there.
Although, using say STL's (the man, not the library) MinGW distro (http://nuwen.net/mingw.html) would make getting started easier, especially if you focus on C++11.

But if you want to look at some pretty good C/C++ code, how about Doom 3's?
Doom 3: https://github.com/TTimo/doom3.gpl
Doom 3 BFG: https://github.com/id-Software/DOOM-3-BFG
Fabians analysis: http://fabiensanglard.net/doom3/

Or, a library I recently reviewed and think of using for this project: EA's STL (https://github.com/paulhodge/EASTL). It's not a complete STL replacement, but functional and indeed very elegant.
Compared to Dinkumware (Microsoft) or GCC's STL, EASTL is a marvel of simplicity -- which of course, is only really possible because it doesn't follow the C++ standard. But as it turns out, that is good thing.
  22:31:43  26 December 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
Messages: 867
Thanks for the suggestion, perhaps I'll start with Python then.

Just curious, do I have to set the -nojit command line parameter to use this correctly? I have the Steam version so I can't use any command line parameters.
  22:34:53  26 December 2013
profilee-mailreply Message URLTo the Top
SetaKat
Ex modder, Zones only ferret and will someday release a game
(Resident)

 

 
On forum: 02/20/2010
Messages: 6342

---QUOTATION---
Thanks for the suggestion, perhaps I'll start with Python then.

Just curious, do I have to set the -nojit command line parameter to use this correctly? I have the Steam version so I can't use any command line parameters.
---END QUOTATION---


Doesn't the Steam version of Stalker have the "Set Launch Options" button in the properties under General?
  23:04:32  26 December 2013
profilee-mailreply Message URLTo the Top
Xetrill
(Senior)
 
On forum: 07/08/2008
 

Message edited by:
Xetrill
12/26/2013 23:21:58
Messages: 129

---QUOTATION---
Just curious, do I have to set the -nojit command line parameter to use this correctly? I have the Steam version so I can't use any command line parameters.
---END QUOTATION---


Well, first like SetaKat already mentioned Steam allows to set command line parameters.

But, no(!) that's definitely not what you want. Assuming that parameter does something, it would disable jitting, which means instead of LuaJIT performance you get just Lua performance.
You see, JIT stands for Just-In-Time compilation, a process to that translates bytecode into machine code. Machine code runs directly on the CPU while bytecode has to be translated for the CPU to understand. This is done by the a virtual machine.

Installing this 'mod' is rather easy, it's a straightforward replacement for the lua.JIT.1.1.4.dll file in <game>/bin directory.
There are other files as well in my archive I uploaded, but they aren't required and are meant for modders. Which should know what to do or not do with them.

Some Wikipedia links:
https://en.wikipedia.org/wiki/Just-in-time_compilation
https://en.wikipedia.org/wiki/Tracing_just-in-time_compilation (what LuaJIT does)
https://en.wikipedia.org/wiki/Virtual_machine

And some good resources learning Python:
https://www.khanacademy.org/science/computer-science-subject/computer-science/v/python-lists
http://learnpythonthehardway.org/book/
http://docs.python.org/3/
http://stackoverflow.com/

Update: So, I just uploaded a new version. Same deal, except you can expect to not crash. Unless you use string/buffer.split.
All my test cases pass (see ui_main_menu.script, lib\lxsext_c_tests.lua) except for one (testJoin_WithSingleDelimiter). But _G.buffer is solid and functional, one thing I noticed is that, some reallocations (buffer.cap(size)) can crash the game. For example calling cap(), with 10, 20 and 10 again does. So...don't do that.

Lastly, if you have questions about the APIs take a look at lib\lxsext_c_tests.lua as I'm done for today.
  23:11:30  26 December 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
Messages: 867

---QUOTATION---
Thanks for the suggestion, perhaps I'll start with Python then.

Just curious, do I have to set the -nojit command line parameter to use this correctly? I have the Steam version so I can't use any command line parameters.
Doesn't the Steam version of Stalker have the "Set Launch Options" button in the properties under General?
---END QUOTATION---



It doesn't recognize any Stalker command line parameters. It's a known issue after some Google searching.

Anyways, thanks for all the help Xetrill.
  00:42:28  27 December 2013
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
12/27/2013 0:48:48
Messages: 2230
With Steam you can right-click the game in Library and set launch options or you can create a steam shortcut on desktop. EDIT: NEvermind I didn't understand what you meant. Yeah, you are right. Stalker doesn't recognize the parameters on Steam version even if you put them there.



---QUOTATION---
Lastly, if there are any C/C++programmers interested in helping this project along, a GitHub repository is easily set up. Just sayin'.
---END QUOTATION---



It's been 7 years since I've even written any C++. However I can cheer you on!
  18:03:59  31 December 2013
profilee-mailreply Message URLTo the Top
Mac34
Senior Resident
 

 
On forum: 03/10/2013
 

Message edited by:
Mac34
12/31/2013 18:04:31
Messages: 313
Maybe I'm completely missing some obvious point (I'm not a programmer), but I can't make this work. The lua mod works fine in CoP, but every version I try it with CS (steam) the game crashes when I choose a save game, or when I start a new game.
Do I have to alter any settings/other files then the lua (and shiny) file?
  19:53:24  31 December 2013
profilee-mailreply Message URLTo the Top
Xetrill
(Senior)
 
On forum: 07/08/2008
 

Message edited by:
Xetrill
12/31/2013 23:02:54
Messages: 129
Mac34 It's not really meant to be used for anything other than experimentation, and aimed at modders. At least for now.

It's not need anyway, the vast majority of performance enhancements will come from new or changed APIs, which require modders to make use of them.

To be a bit more technical, yes you can make it work. If you patch up some things in Lua. See, STALKER uses some deprecated functions from earlier Lua versions*. I didn't like that very much, so I changed all of them, and verified by disabling the compatibility back porting.

If you're still reading, here's how to make it work regardless:
1. open gamedata\scripts\_g.script from the game's install directory with a text editor.
2. at the very first line add this line (without the quotes): "string.gfind = string.gmatch; math.mod = math.fmod"
3. save and try again.

* string.gfind was renamed string.gmatch
math.mod was renamed math.fmod and the %-operator was introduced

Progress update
Since I'm already here, I've fixed 'join' (all variations), it turned out it never had any problems, my test code did... Also, string/buffer.split is now fully implemented, it needed a custom implementation instead of relying on C's stdlib to capture empty tokens. Which lead to a rather simple yet really fast routine.

And the bad news, my latest builds suffer from (Lua C) stack corruption. That's bad, the stack is what keeps order in Lua and it's how everything interacts with it.
I've already put about 8 hours into finding why and fixing it, without much to show for it.
Now, the good thing about that is, that I clearly screwed something up and as a result of that future versions will be more robust, with lots of new checks in place (in debug builds).
  22:41:38  31 December 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
Messages: 867
Just wanted to confirm that making the changes mentioned in _G.script works for COP too and this LuaJit now runs with COP.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2021 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.