Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Calin Leafshade

#601
Quote from: miguel on Wed 26/12/2012 11:42:44
- does the AGS-Lua plugin allow me to completely code a game in Lua? I understand that all the character, hotspots, objects, etc, can be "called" normally?

Yes

Quote from: miguel on Wed 26/12/2012 11:42:44
- If so, why is this debate happening? If the plugin has no "side-effects" then it should be optional. No?

It's entirely optional bu my contention is that its better in almost every way and i wsh to evangelise that to the people.

Quote from: miguel on Wed 26/12/2012 11:42:44
- where can I find some common "workarounds" to stuff like non-blocking functions? The search engine is a pain.

I would argue that there are no common work arounds because non-blocking stuff in AGS is difficult to easily modularise. Monkey may disagree.
The closest example i can think of is the Character Controller module that allows you to queue up actions for NPCs from a list of predefined actions.

This is a good example actually of a common problem in AGS that lua solves.

People often want to do something like this:

Make a character walk to a specific location and then do something when it's arrived while not blocking the interface.

In AGS one would do something like this:

Code: ags


bool sentGuy = false;

function MakeWalk()
{
    cGuy.Walk(300,300,eNoBlock);
    sentGuy = true;
}

function FinishedWalk()
{
    cGuy.Say("I have arrived at 300,300");
}

function repeatedly_execute()
{
    if (sentGuy && !cGuy.Walking)
    {
        sentGuy = false;
        FinishedWalk();
    }
}


I'm sure we can all agree that that is perfectly serviceable and works fine.. but can we also agree that it's a little unintuitive?

In Lua you could simply have a background coroutine for the room. Let's say I wanted a guy to do several repetative tasks in a room over and over again:

Code: lua

function backgroundThread()
    while (true) do
        cGuy:NonBlockingWalk(300,300)
        cGuy:NonBlockingSay("I have arrived! I will now walk back again!")
        cGuy:NonBlockingWalk(100,300)
    end
end


(The NonBlocking functions are just self-yielding, reuseable, wrapper functions which are easily modularisable)

Now see how much more intuative that is? Semantically, one can say that this guy will do this things over and over again in a loop, without interrupting program flow. We've essentially self-contained his behaviour into one function without having repex involved at all. Tell me that aint cool?
#602
Yes, the AGS-Lua plugin is essentially a drop-in replacement for AGS Script. All the functions and properties available to AGS Script (like rooms and dialogs and stuff) are all available to the Lua plugin.
#603
I refuse to partake in your pagan, heathen rituals.

Y'all need Jesus.
#604
Quote from: Sslaxx on Tue 25/12/2012 17:15:36
Then the aim should be to add those features to AGS Script.

I disagree.

Lua (or AngelScript or Python or whatever) are established languages with a user base that eclipses AGS. Why bother writing and maintaining our own proprietary language when off-the-shelf alternatives exist which have far better testing regimens and far greater support upstream?

Also I should say that my argument was not necessarily in favour of changing the defacto language for AGS to Lua. Merely that users such as myself should consider it as a very viable alternative to ags script. What the AGS developers do is of no consequence to that discussion.
#605
I should be clear that I am not advocating for Lua *over all other languages*, merely *over AGS Script in its current state*.

If AGS Script were more C like (pointers to custom structs and so on) then I would not be as combative on the issue (Although I still think Lua would be preferable to C in a scripting environment).

The reason I advocate for Lua specifically is because its there and it works now.
#606
I think that would be a very bad idea.

Can you imagine something like Resonance written in an Inform 7 style language?
#607
Quote from: Crimson Wizard on Tue 25/12/2012 08:43:01
Quote from: Calin Leafshade on Tue 25/12/2012 08:19:05
Certainly you *could* cobble together a non-blocking say function but how would you chain calls in an easy way?
By queuing them, storing information in array for instance. That won't be hard to do.

What if i want to run a function once all the says are completed? What if i have a callback i want to pass to the function when it finishes? What if i want to run a different function each time? What if i wanted to do this 1000 times for my RPG?

Sure it's *possible* but i think we can agree that it would be horribly messy, require a lot of duplicate code and be impossible to modularise .

Quote from: Crimson Wizard on Tue 25/12/2012 08:43:01
I am actually curious how would I break the sequence if I use coroutines. Like what if something may happen during non-blocking "say". Can I trigger the exit from the function without executing the rest of custom "says"?

If you dont want to resume the coroutine then just don't resume it.
#608
Quote from: Crimson Wizard on Tue 25/12/2012 08:06:20
Quote from: Calin Leafshade on Mon 24/12/2012 14:24:50
On a custom say function: What if i don't want it to be blocking? What if i want the user to be able to answer yes or no to a question? In Lua (it's not an abbriviation by the way while we're being pedants) coroutines allow you to essentially have a kind of threaded system.
<...>
Now, I have no doubt that such a system is perfectly possible in AGS but it wouldn't be as pretty and you couldn't make it non-blocking because AGS only has a single scripting thread and no coroutines.
Now. That's simply not true. I can make a non-blocking custom say function in AGSScript, since AGSScript has repeatedly_execute functions it is possible to organize a classic state machine there. The fact that it has only one thread means only organizational problem (but so does multi-threading). To be frank, I found this statement quite naive... not to offend you, Calin, but how do you suppose any program could run any number of simultaneous tasks having one thread? Such things are, of course, possible and valid.

Not naive, factual.

Certainly you *could* cobble together a non-blocking say function but how would you chain calls in an easy way?

For instance:

Code: ags

    player.CustomNonBlockingSay("Hi There!");
    player.CustomNonBlockingSay("Uh oh.. this function has run immediately after the preceding one...");
    player.CustomNonBlockingSay("Oh no! Now i've missed two say functions because the function kept running!");


Lua avoids this problem with coroutines.

Quote
Quote from: Calin Leafshade on Mon 24/12/2012 14:24:50
AGS Script was a great idea 10 years ago. Computers weren't fast enough to have a JIT compiled scripting language and a pre compiled option was a good idea but now it's obsolete.
I was rewriting AGS script interpreter, making it a more type-safe along the way, and recently a user of PSP port reported that certain game became quite slow because of that. And this is still precompiled AGS script.
I don't want to make any assumptions here, but it would be good to know how fast Lua actually works when handling lots of scripting tasks.
(There's of course such thing as optimization. The problem I mentioned may be related to the way AGSScript handles basic operations)

My preliminary findings suggest that Lua is faster than AGS Script when doing pure arithmetic and stuff that is confined within the Lua universe (string operations and so forth).
It is slower than AGS when accessing AGS functions because of all the interop stuff going on.

EDIT:

I should point out that coroutines are not actually threads in the traditional sense. They are just a way of having parallel functions running in a single threaded environment like a scripting thread.
#609
A lot of your criticism of my argument is pendantry at best and just lying at worst.

To argue that AGS can support some kind of function pointer functionality by coding a big if else block to run different funtions based on an enum is laughable. I mean do you even understand what a function pointer is and why they are useful?

Your argument for predefined variables is one of language semantics and could go either way depending on your stance on such things. For a scripting language I'd argue that dynamic, non-typed variables are better but opinions vary.

On writing intuitive modules:

Are you suggesting that, with the function pointer example (maybe an event of some kind), it is better and neater to tell your user to add a new value to an enum in your code, create a new function higher up in the script and add calling the function to the module code? As opposed to just telling them to pass a function? If so then lol.

On a custom say function: What if i don't want it to be blocking? What if i want the user to be able to answer yes or no to a question? In Lua (it's not an abbriviation by the way while we're being pedants) coroutines allow you to essentially have a kind of threaded system.

Code: lua

    player:MyCustomSay("Hi!")
    if player:Ask("Are you a pedant", "Yes", "No") == "Yes" then
        player:MyCustomSay("You are a pedant")
    end


Now, I have no doubt that such a system is perfectly possible in AGS but it wouldn't be as pretty and you couldn't make it non-blocking because AGS only has a single scripting thread and no coroutines.

AGS Script was a great idea 10 years ago. Computers weren't fast enough to have a JIT compiled scripting language and a pre compiled option was a good idea but now it's obsolete. Let's look at the things AGSScript doesn't have that lua does.

dynamic, multi dimensional arrays
function pointers
ternary ops
for loops
dynamically typed variables (you don't get tired of IntToFloat?)
keyed arrays
*proper* forward definition
functions as first-class citizens
the ability to pass data structures (seriously lol)

I could go on.

Quote
These are actually good rationales for using Lua, but that doesn't preclude replacing AGScript with Lua altogether.

Look up 'preclude'.
#610
The lua plugin is as portable as any other plugin and lua itself is exceptionally portable so I doubt portability is a concern unless you're talking abotu running it on a toaster or something.

Also, i'd argue that lua is easier for a beginner because it doesnt have some of the weird idiosyncracies of AGSscript (no forward declarations, weird variable casting and so on)
#611
As i said, most of what lua can do (with the possible exception of coroutines) AGSscript can also do in a roundabout fashion. But I think the lua version is likely to be cleaner and more intuitive.
#612
I suppose I did put the cart before the horse and should make my case first. Ok here I go.

First I should be honest. In terms of actual results, there isnt much that lua can do that AGSscript absolutely can't do but it might be *alot* easier in lua.

Ok a quick example. In my latest adventure game I have a contextual interface. That is to say that when you right click a hotspot you get a list of named actions. I tried to code this in AGSScript before i had lua and it was a fucking nightmare. If/Else statements coming out my wazoo. Because functions pointers dont exist in lua i had to tie all my interactions to cursor modes to separate them which was messy, made no sense and was stupid.

In lua however, i can set up a system where i can add an interaction to a hotspot like this:

Code: lua

RegisterInteraction(roomNumber, hotspotIndex, "Hit the table", function()
    player:Say("I hit the table!")
end)


And I can do this for as many hotspots and interactions as i like with no limitation.

Notice that I used a function like a variable. In lua you can do this which is *very* useful for adventure games.

Another example is that I can add arbitrary values to ags objects at runtime. Let's say my NPC had a 'suspicion' level and when it reached 100 he found me out in my misdeeds or whatever.
In ags I would store this in a different variable. If i had one for each npc I would store it in an array somewhere probably. In lua i can simply type:

Code: lua

    ags.cNPC.Suspicion = 50


And it's done, it's all in the same object and it makes semantic sense.

Also, all lua function and variables do NOT have to be declared before use. In AGS it's impossible to organise nice systems that depend on one another. Say you have a Camera struct and a Map struct and the camera wants to interact with the map but the map also needs to know where the camera is. This is impossible because AGS has no system for forward declaration which means your code has to be messy and shitty.

Reason 4 or 5 or whatever i'm on is that Lua is an established language with a lot of resources available. If you want code to do some pathfinding then there are dozens of Lua scripts already available in nice little modules.

Lua has a couple of plugins for oft-requested ags functions including TCP/IP.

Lua has coroutines which I've use in my RPG engine to have a custom say function which isn't hashed together bollocks like is required with ags and a million if/elses in repex.

Speaking of my RPG engine, I've managed to make an (almost) fully working RPG system with a nice inventory and map system in lua and it took me a few days max. Something no one else has done (to my knowledge) in AGS for a long time.

Lua will allow module makers to make more intuitive modules because we can have classes and inheritance and events and function pointers.

AGS teaches you a worthless skill badly.
AGS script is basically like C but with all the good bits missing and what this does (in my opinion) is teach you to be a poor programmer. You don't learn in terms of data structures because in AGS working with data structures is a chore. Not being able to pass structs either by value or by reference is a *massive* problem when it comes to teaching people how to code. Also, AGS script is only used in AGS. You might as well learn Lua and have another skill to add to your repetoir.

Sorry for the brain dump.. i just kept typing.

(And this before i've even mentioned the magic of tables)
#613
Hello everyone,

Wasn't sure where to put this.. its sort of technical but not technical enough to warrant the tech forum.

Anyway, I have come to the conclusion that everyone should stop using AGS script and move over to Lua for a wealth of reasons. it seems like a no brainer to me and yet I have seen a lot of resistance. I would like to know why that is and I would like to help wherever I can.

Are there modules you need for lua that I can code for you?
Are you just not sure how to link ags and lua together?
Are you afraid of putting in the effort of learning a new language?
Do you not see the benefits?

Tell me why, AGS forumers and I will do my best to help and ease the transition because I think it is a wasted opportunity for all you cavemen still languishing in AGSScript land.
#614
Hmm that works but AGS's framerate drops from 60 to about 4. Presumably because of all the polling.

Have you given any thought to any kind of debugger for the lua plugin? It's something it lacks i think at the moment and allowing for variable inspection at runtime will tip Lua over the edge as a defacto replacement for AGSScript. At least for me.
#615
Another request, apologies for the triple post but it seemed permissible in this instance.

Could you enable some kind of Lua debugger for remote debugging?
Something like this: http://luaedit.sourceforge.net/support.html#faq-002


Scrap that.

I've tried to implement Mobdebug in my game but of course when Pluto tries to serialise the game it tries to serialise the c functions in socket which is not allowed.

Do you have any suggestions on how to get around this?

#616
I also made a 3D adventure game prototype in unity. It's *very* easy and I got my little fella walking around, using and looking and verbing all over the place after just a day.

The problem is that i have no 3D modelling skill so I never did anything about it :>

I did contemplate getting in touch with Ali or someone else with 3D experience but i never bothered in the end.

Bottom line: Unity is piss easy.
#617
The Rumpus Room / Re: N33D H3LP!!
Thu 20/12/2012 00:33:59
OH AND IT HAS SEPHIROTH IN IT SOMWEHRE.
#618
The Rumpus Room / N33D H3LP!!
Thu 20/12/2012 00:32:17
WHAT PAINT PROGRAMZ SHOULD I USE TO MAKE MY NEW RPG?

I HERD PHOTOSHOP IS GOOD BUT SOME THINK MY ART MAIN PROGRAM DO.

HOW DO I DO SCRIPTING? CAN SOMEON POST A SCRIPT TO MAKE MY CHARACTER LOOK LIKE GAYBRUSH

I NEED A WRITER AND A BACKGROUND ARTIST AND A CHARACTER ARTIST AND A LEAD DESIGNER FOR MY GAME IDEA. IT WILL BE COMMERCIAL AND BASED ON INDIANANA JONES AND THE TEMPLE OF DOMM.
INDIANAANNA GOES INTO THE TEMPLE AND GETS THE TRIFORCE I CAN DO THE TRIFORCE GRAPHIC BECAUSE ITS ON THE INTERNET

PLEASE EMAIL ME ON THIS PM FORUM SYSTEM AND REPLY TO MY THREAD FOR MY DESIGN DOCUMENT ABOUT GAYBRUSH AND BANANA JONES AND THE TEMPLE OF BUMS. IT IS VERY SHORT.

YOUR CINSERELY

CALIN LEAFSHADE.





#619
Quote from: Stupot+ on Mon 17/12/2012 13:23:37
It's not going to have much affect on inner city gun-crime, where some people genuinely feel they need a gun to stay alive,

See now, I have never felt like i've needed a firearm to stay alive. I think if someone in a wealthy, developed nation is thinking that then there is something very wrong.
#620
Quote from: Darth Mandarb on Sun 16/12/2012 14:03:44
There are more [documented] school-shootings in the states than there are in other parts of the world.

We have less tossing of acid in women's faces for refusing an arranged marriage.

We have less people strapping bombs to their bodies and blowing up civilians on buses.

We have less little girls being shot in the face because they want an education.

We have less women being hanged because their ankles showed in public.

We have less homosexuals being murdered for their "sin".

So, yes, we may be top of the hill with tragic events like school shootings but that does nothing to diminish my original point that the world is a fucked up place.  Period.

Ok so awesome. The United States of America, who we are frequented told is the "greatest nation on earth" is better than Pakistan.

It is not popular to point out the failings of the US because we like to be bullies, it's because we are frequently getting American Exceptionalism rubbed in our faces.
If you're going to dub your president the "leader of the free world" and stuff like that you'd better be damn well ready to back it up with facts.



SMF spam blocked by CleanTalk