AGS-Lua Evangelism

Started by Calin Leafshade, Mon 24/12/2012 13:23:28

Previous topic - Next topic

Calin Leafshade

Quote from: Khris on Mon 31/12/2012 12:42:34
Quote from: Calin Leafshade on Sun 30/12/2012 22:13:03Take a look at my very unfinished RPG engine made entirely in Lua (with a little AGS Script support).
I did and I like!

So the two LuaControl scripts are used to keep the usual AGS events and would pretty much be essential for anybody willing to switch, right?
When I tried to compile the game, the "official" plugin couldn't deal with the Lua.Scripts/ScriptCount functions; I guess you added those to the plugin yourself?
(I called the scripts manually and it compiled fine.)

Yes, those extra script function Denzil added specially for me on request. And yes, those scripts are basically my interop between ags and lua. I think it's pretty unintrusive and neat tho.

Quote from: Khris on Mon 31/12/2012 12:42:34
I'm still wondering though whether it's actually reasonable to use AGS and 99% Lua. It seems like you'd either use another engine entirely or stick to AGS/AGSScript and only use Lua when necessary, depending on whether you're creating mostly a classical adventure game or not. Does AGS's engine part warrant building a Lua game...?

I use AGS for a couple of reasons. Firstly I understand the systems and it's a very stable platform. Secondly, I can save the whole state of the game with a single function call. That should not be underestimated as a time saver. And thirdly AGS encapsulates animations and stuff very nicely. I think AGS still has a role but that using Lua to script it is a wholly better idea.

Quote from: Khris on Mon 31/12/2012 12:42:34
And let's not forget that the current editor for the lua scripts is nothing more than a colorful Notepad. There's no jumping to functions, no auto-completion, no code folding.

I don't use the AGS editor for the lua scripts. I edit them in notepad++. The plugin is clever enough to see changes and grab the latest versions. There are Lua editors with full support for lua with syntax highlighting and function completion and stuff.. You aren;t limited to using the ags editor.

Khris

True, savegames are a good argument.

I use notepad++ myself and it's good to know that you don't have to copy-paste stuff to and fro.

Joseph DiPerla

QuoteI think the *best* way forward would be a language agnostic system with several different bindings for different languages.

This! :)

Leave AGS Script, but add the ability to use LUA Script as well and the user can then choose which language to develop in. Might make it easier to support backwards compatibility as well.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

monkey0506

Quote from: Khris on Mon 31/12/2012 12:42:34Does AGS's engine part warrant building a Lua game...?

Lol stawp trolling.

Khris

Let me clarify, in case anybody else too didn't get the point I was trying to make (and could have worded a bit more elaborately).

If I want to build a game, and that game's going to benefit greatly from the stuff Lua can do that AGSScript doesn't support (well) because the game is far removed from a classical adventure with rooms and characters' walk cycles and the like, do I really still need/want the AGS engine as base? Say I want to make an Angry Birds clone or something of the sort; shouldn't I use something else for the backend, for instance something with built-in cross-platform support?

I'm saying that at the point where I'm writing huge parts of the actual game engine in Lua, isn't this a job for something other than AGS?
(And wasn't this more or less the original topic of this thread anyway?)

Denzil Quixode

Quote from: KhrisIf I want to build a game, and that game's going to benefit greatly from the stuff Lua can do that AGSScript doesn't support (well) because the game is far removed from a classical adventure with rooms and characters' walk cycles and the like (...)
Well, back when I originally made the plugin I did intend for it to be used for adventure games. (I don't think I even had RPGs in mind, I'm not much of an RPG guy myself.) What I really hoped for is that it would be helpful to someone who wants to make an adventure game that pushes the bounds of what an adventure can be, without losing its identity as an adventure game. I would love to help people do ambitious, experimental, new things in their adventure games -- ideally, things that would be as new to us today as the interface in Loom or the Virtual Theatre system in Lure of the Temptress were, 20-odd years ago.

That's the dream, anyway. So it depends what you mean by making a "classical adventure"-like game: whether you only mean going with specific conventions and mechanics originally established by those games, or whether there is also room for trying to continue in the spirit of inventiveness, experimentation and upheaval that a lot of those games actually had at the time they came out.

Crimson Wizard

#86
I think, if you will be writing your own "co-engine" (in Lua, or AGSScript, or C++ - as AGS plugin) using AGS as a backbone for animations and similar stuff, then sooner or later you'll cross a line, beyond which the percent of used internal AGS features will be smaller than percent of unused AGS features. So the real question would be, what's more important for you: to have a clean engine optimized for your game genre, or to save your time (or be lazy ;)) and just use what you already have.

Another thing is Editor, ofcourse. Writing tools/compilers take time; and some people may consider that most boring part in game development.

Calin Leafshade

I think AGS is a fantastic platform to make games in and Lua just enhances that.

I also think that Lua can help make advanced things even within adventure games. Take a look at the kinds of things Barely Floating did and how short a period they managed to do it in.
Barely Floating *felt* different. It didn't feel like an AGS game it just felt like an adventure game.


Andail

Quote from: Denzil Quixode on Tue 01/01/2013 15:56:44
What I really hoped for is that it would be helpful to someone who wants to make an adventure game that pushes the bounds of what an adventure can be, without losing its identity as an adventure game. I would love to help people do ambitious, experimental, new things in their adventure games -- ideally, things that would be as new to us today as the interface in Loom or the Virtual Theatre system in Lure of the Temptress were, 20-odd years ago.

This is probably off-topic, but I think the reason AGS games - and adventure games - work is that we've found a formula that doesn't age that badly. It's simply a concept that works, and that's why most people prefer to stick to it, instead of trying to modernize the genre. After all, even if we do make the games much more advanced, featuring all sorts of advanced scripting and hi-tech GUIs, we only end up with games that look like they are 10 years old instead of 20. It's not like we're ever going to cater to new audiences.

I'm a huge Lure of the Temptress fan, but ojectively I can tell that it sucked.  And it sucked mostly because of the virtual theatre thing, which was just clumsy and unnecessary. I'd much prefer if the characters simply were positioned here and there, maybe with an idle animation or two, like in traditional adventure games, instead of restlessly and aimlessly wandering around in fixed patterns, bumping in to me all the time and causing frustration.

When I'm making my game, I'm reluctant to trying out new languages or engines not because I learn code slowly (although I do) but simply because there's nothing I would like my game to do that can't be done with AGS, and I think most people feel the same.


Monsieur OUXX

#89
Quote from: Andail on Tue 01/01/2013 23:38:41
When I'm making my game, I'm reluctant to trying out new languages or engines not because I learn code slowly (although I do) but simply because there's nothing I would like my game to do that can't be done with AGS, and I think most people feel the same.

Just to be 100% objective: AGS can't do Telltale-like games, like Sam&Max. Or 2.5D games, like the original Alone in the Dark. Well, it can, but it would require A LOT of work. Plugins exist, but as soon as they're released, they get obsolete, because they're often unfinished or badly documented or the technology has already moved forward.

But with Lua, the binding with DirectX and such would be much simpler, not only for the rendering part but also for all the stupid 2.5D calculations (for example, when the player clicks on an object in a 3D scene). All the libraries are out there somewhere.
 

Denzil Quixode

#90
There is a serious problem with Lua C modules (like a DirectX binding) in AGS, unfortunately. There is no reasonable way for the plugin's Lua state serialization system to know how to save an external C function. All the standard built-in C modules ('math', 'string' etc.) are carefully processed when the game starts up, but once you load your own one the next time the game tries to save it is likely to not be able to. There are ways to get around this (like removing the loaded module when you save the game and restoring it after you load), and hopefully in the future features could be added to make it easier to deal with, but I think it is impossible to ever make it completely seamless.

theSynapse

So if I wanted to start using AGS this year (probably within the next couple of months or so), would I be okay using it as an opportunity to learn Lua and dispense with learning AGS Script? Or are there things that can't be done in Lua that can in AGS Script, and are there still tutorials for Lua in AGS?

Denzil Quixode

#92
To be honest, the way things are now, it is likely to be confusing to jump straight to Lua. The plugin does not completely replace AGS-Script. Instead, it adds special functions to AGS-Script's standard set of functions, and these functions can run Lua scripts and call Lua functions, etc. So it's still AGS-Script running the show, handling game-events and so on, but it can choose to pass control over to Lua.

For example, in AGS-Script, if you want to do something whenever a mouse button is clicked, you would add an on_mouse_click() handler in AGS-Script:

Code: ags
function on_mouse_click(int button)
{
  Display("You clicked mouse button %d at co-ordinates (%d,%d)", button, mouse.x, mouse.y);
}


...and that's it, that's all you need to do.

But to do the same thing with Lua, you could first create a Lua script - let's call it mousehandler.lua - that defines the function:

Code: Lua
-- mousehandler.lua
function on_mouse_click(button)
  ags.Display("You clicked mouse button %d at co-ordinates (%d,%d)", button, ags.mouse.x, ags.mouse.y)
end


...and then you also need to set up AGS-Script to run mousehandler.lua when the game starts up, and then call the function when it should be called:

Code: ags
function game_start()
{
  Lua.RunScript("mousehandler.lua");
}

function on_mouse_click(int button)
{
  Lua.Call("on_mouse_click", Lua.IntValue(button));
}


Quoteare there things that can't be done in Lua that can in AGS Script
Well, you can only call standard built-in AGS functions, so you can't use any other plugins from Lua, and you can't directly use AGS-Script modules (you'd have to convert them to Lua). You also can't do bitwise operations very easily at the moment (but if you don't happen to already know what those are, it probably isn't going to be something you need).

theSynapse

My brain just melted. I'll stick with AGS Script in the first instance then....

Just thought it'd be a good way to help me learn Lua. I'll go back to my plan for Space Invaders in Love2D!

SMF spam blocked by CleanTalk