Archive

Posts Tagged ‘Lua’

New puddlejumper in the next release

February 1st, 2009 7 comments

puddlejumperSome of you might have known this already. The new puddlejumper (V3), modelled by VoteKick and coded by LightDemon (based on Catdeamon’s shuttle SENT) will be in the next Stargate Pack release for Garry’s Mod.

So far, I needed to modify some minor code passages to make it work more efficently. But this is not the major work I have done. The main issue was, that the jumper used a hard-coded keyboard layout. You might think “huh, that’s not such a problem”. Well, it’s kind off. I’m a player who uses the left-/right-/up-/down- keys and numpad for gaming instead of the WASD keys. Sadly these keys have been used by LightDemon to handle stuff like zoom in/out so while I flew the jumper, my view always zoomed in and out. (Keys were bound twice)

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

Anyway, now I coded a system which gives you the freedom to bind your keys to the wished one. I’m quite proud of this work, because it’s 100% Lua and uses some hacks to work correctly. And it is coded object orientated so in future, when LightDemon and VoteKick finished their X302 or Hatak, I can easily add my keyremapper to these ships too.

Stuff

January 16th, 2009 2 comments

Oh well hi again.

I was busy the last days with finishing my practicum protocol (Get it here. It’s in German), where I made mostly every image, calculated all values while my practicum partner wrote the text. After I got this done the next task applies: Learning for an exam in less than two weeks.

But what I actually was going about to tell you is, that I started working on a little Duplicator enhancement for Garry’s Mod, which should be more userfriendly compared to AdvDupe. I planned to make it an enhancement of the original Duplicator rather than a new tool. It should also load the old AdvDupe saves of course.  Any file action is meant to work like in the windows explorer (that’s where I’m currently at). Spawning should not be that slow and laggy like AdvDupe is (I’ll orientate on VMFSuit’s spawn algorithm). And there will be a way to mass-save stuff, which isn’t constrained to each other (Quad/Circle select).

But I can’t tell you, when it will be readyor if I will ever finish it. It’s just I’m all over busy with other stuff or I get bored by coding due to a simple issue I can’t solve easily.

Categories: Blog, Garry's Mod, Lua, Physics Tags: , ,

Long time no news – So here it is

September 30th, 2008 6 comments
The current two modes for the wallhack

The current two modes for the wallhack

I was quite busy the last days. I’m still learning for my exam on 6th October. It’s physical chemistry – Physics for chemicians. Well I’m not a chemician but chemistry was a course I have chosen additionally to my physics study. I had to chose some and trust me, chemistry was the easiest of all in my opinion.

On the other hand I’m coding in my leasure time on several lua projects. But I have to disappoint you, it’s not the stargate pack.

I’m still with my Poker game and I also started a lua “hack” out of boredome (for personal usage only). It currently has an aimbot and a wallhack. But before you flame me as a “hacker”: I’m none. My intention in coding it is because I can – That’s all. And it’s incredible easy.

The player table. Not finished yet or even functional.

The player table. Not finished yet

To the poker game which I’m coding in Lua: I just added the player boxes. In these boxes you see the player’s cards, their current cash and bets. Again it’s quite impressed by PokerTH which is, obviously, a really cool game.

Ah well: I just started reading some E-Books about super string theory. I’m not really far with it due to the much time it takes but it’s really interesting.

Instead of describing forces or particle as points, it tries to describe them as vibrating strings or branes (imagine branes like a piece of paper you can fold).

The math in it is highly advanced: So far I have seen it uses variation calculus at the beginning then describes the relations between the branes and normal spacetime using differential forms and manifolds. And all in index notation (Physicians like this because it’s easier to see links and short in writing).

You should not consider about trying to understand this theory if you haven’t passed at least 2 or more years of intensive physics study at university. And I’m in 5th semester now (already had 2 years). The book I’m with is by the way Introduction to Superstring Theory by John H. Schwarz. It is supposed to be a 4 lesson lecture to bring a short overview about what string theory is.

Garry’s Mod Garbage Collection causes FPS drops

September 23rd, 2008 11 comments

Two days ago I read about not reusing tables (and other datatypes) in Lua can cause massive FPS drops. I first didn’t want to believe this but now I know it’s real. This also explains an issue I had on my server for months now: My frames per second randomly drop from about 300 to below 10. And that every 5 minutes. The duration of this lag in most cases is around 1 and up to 15 seconds.

The reason for this is the Garbage Collection of Lua. Imagine this the following: You write postcards. Lets say about 2 every 5 minutes. But some are crap so you want to get rid of them – They get into your garbage bin. But your bin can get full of course. So you have to bring it down for waste collection. Lets say this takes 5 minutes: You can’t write 2 more letters during that time: “You lag”.

With GMod Lua this is even worse – It seems Lua does not only bring the garbage down for waste collection: It looks like Lua directly brings it to the next landfill which is miles away – By feet.

You can test this the following way: First of all, rename your addons folder (to make sure no other script interferes).

Now start a new game and enter

lua_run_cl hook.Add("Tick","GC_Makes_FPS_DROP",function() for i=1,10000 do lol = {} end end)

into your console.

Your FPS should be normal now. But wait: Just a few seconds after you entered this your FPS drop to below 1 FPS. And this now every 10 seconds.

What does this script above actually do? Well, remember you writing postcards? The code above writes 1000 postcards on every tick. This means every time the game calculates stuff. This is many hundred, up to thousand times, a second.

“But wait, over 1000*1000 postcards every second – Isn’t that very much?” you might ask now. Well basically yes. It’s much. But remember that these postcards above were empty.
And scripts like Wire,Depthhud and others exactly do similar stuff like my example code. Not so often, but full of data and often enough to call the Garbage Collection at least every 5 minutes.

And seriously doesn’t make a lagging game you stop playing it? For me it does.

Categories: Garry's Mod, Lua Tags: ,

I finished the Card-VGUI

September 18th, 2008 6 comments

poker_card_beta2.PNG

I just finished the card-vgui for my Poker game I currently code in Lua. The ranking is nearly done, the pot is coded and I thought: Hell yeah, next step will be the VGUI.

Another reason why I did it was because it’s horrible to identify the different cards by e.g. D.Q (Diamonds Queen) or S.7 (Spades Seven) – Just to name some.

Some information about the VGUI: You can resize it without any issues and only those textures which are necessary are saved.

E.g. the suits and only the upper half of the J,Q,K are stored in materials. The rest is done by the VGUI. This probably increases the code of the VGUI from about 30 to 130 lines compared to those which uses every card as imaged directly. But this decreases the size of the necessary textures from several MB to just around 236 kB.

Categories: Blog, Garry's Mod, Lua Tags: , ,

Poker!

September 13th, 2008 16 comments
Royal Flush: The best in Hold'em you can get

Royal Flush: The best cards in Hold'em

Poker is an awesome game. I especially like Texas Hold’em so I decided to code a poker engine in lua!

It’s currently only finished to the part where everyone gets cards and chips. This was easy.

The current thing which nags me are sidepots: Let’s say A has 100, B has 50 and C has 100. Minimum to bid is 100. So A bids 100, B can’t bid more than 50 so he goes all-in and C just puts the required 100 to fill the pot.

This creates a sidepot for A and C with a total of 2*(100 – 50) = 100 and a pot for B with 3*50 = 150 he can win.

Sounds easy, but is really eating my brain cells. Currently it works for especially the situation I mentioned above. But it fails if A bids 50, B goes all in with 100 and A just calls by filling the pot with 50 more bucks.

I’m sure I can fix this. The only thing I’m really afraid of is coding a GUI for the engine *ugg*

Categories: Garry's Mod, Lua Tags: ,