Tag Info

Hot answers tagged

61

Scripting is a programming abstraction in which you (conceptually) have a program (the script) running inside another program (the host). In most cases, the language in which you write the script is different from the language in which the host is written, but any program-inside-a-program abstraction could be considered scripting. Conceptually, the common ...


30

The only benefit I can currently think of is that you can make some coding updates, via Lua, without having to recompile. Do not discount the utility of this so easily. You will never understand how productive you will be until you take away the recompilation step. The "flow" is a fairly well-understood psychological concept when it comes to work. The ...


18

TL;DR: Lua does have overhead, but if used properly it is negligible and easily mitigated. Don't use it for heavy math operations or transforming geometry. You will probably not see any performance problems at all using it to script a GUI. I've done some basic benchmarks regarding Lua's performance as a game scripting language, and it's pretty damn fast. ...


18

Where I work: Pros: iteration time improvements. Our game is set up to poll a host filesystem for changes and automatically "slurp" in changes. (They only take effect at next file open, but in practice, that's a major improvement: reload the level, and your new lua changes come in immediately.) console integration. Any debug functionality can be hooked ...


16

As far as scripting languages go, Lua is very fast, but like anything it varies depending on the processor. For example, Lua would not be great on a console platform because it tends to be very branchy, and some console platforms branch very slowly. To best answer your question, I would suggest running some benchmarks. See how fast Lua performs some various ...


14

If you're interested in developing games using Lua, I'd highly recommend checking out LÖVE which is a framework for making 2D games in Lua. Checkout their wiki for lot of resources to get you started. :)


12

You may want to keep an eye on Polycode. It is a 2D/3D framework written in C++ that has a complete set of lua bindings. Polycode is about to be rereleased with improved Lua bindings and a Lua IDE.


12

The iOS developer program agreement section 3.3.2 reads (in part) as follows: An Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded. When the license agreement was updated in 2010, this change was ...


12

Since you are talking about screens, I feel it's best to separate all that logic into different Screens. What I normally do: Define an interface called screen, and have multiple screens implement it. Like LoadingScreen, MainMenuScreen, GameScreen, GameOverScreen, HighScoreScreen etc. In your game you put a variable that holds the current screen. Each loop, ...


11

Sorry, no matter what kind of encryption on the client side you do, if you store sensitive stuff on the client, it will be hacked. The client has to be able to read the data in the "encrypted" file. So you are giving the lock and the key to the client in a competitive game, and telling them not to edit anything inside your encrypted file. Your client will ...


11

We have a similar situtation in our project, and we solved the problem by saving components (not functions) to LUA metatables. Basically, when we are creating an entity (or game object as we call them) on LUA side, code looks something like: function createShip() ... self.transform = registerToComponent("transform") self.sprite = ...


9

You can precompile lua using the luac tool in the standard distribution: luac myluafile.lua -o mycompiledluafile.luac To obfusticate the file, use the -s option to remove all the debug info. This won't make you immune to decompiling, but why does that matter? The -l option produces an annotated bytefile, which is really nice for learning how lua works ...


8

A socket based messaging scheme can be used to allow any arbitrary language to interact with the AI. You could use binary based messages, xml, text, etc. Just clearly define what the message format is and what messages you will send and receive. This technique works relatively well for light to modest communication handling. There is a latency penalty ...


7

Disclaimer: I've created the two tutorials I'm going to link here I've done two tutorials. None of them is complete, but will get you from 0 to 80% quickly. The first one is a LÖVE-centric one called love-tile-tutorial: https://github.com/kikito/love-tile-tutorial It's about 50% done. Starts with the basics, and deals with Images & Quads, as well as ...


7

This will be hard to fix in so little time, especially since you're using such a peculiar structure, but well, let's give it a try. I'll post and edit as I notice the most glaring problems. Step 1) Proper Camera Panning The first thing that jumped out of your post like a madman was the part where you said: So, instead of the character moving, ...


7

It seems to me that the easiest way to do this would be in two steps: Determine the smallest possible convex polygon surrounding all red nodes. Expand the convex polygon until it reaches the largest possible area without intersecting with white nodes. Suppose we start with this situation: Look at that glorious programmer art. I've chose red and green ...


7

Lua was actually designed to be an efficient data file format. It's original use was to load huge geographical data sets. Actual scripting/logic features came later. Even with all the new scripting features, it is still used by its original authors to store and load large data sets. That is not to say that Lua is the most efficient choice. That will ...


7

Do python games use Lua? Generally? No. Is it a resonable thing or I should just stick to pure python? Define "reasonable"? Python has been used in many game development scenarios. While Lua may be well known among some game mod circles (like WoW GUIs, Garry's Mod, and so forth), Python was the language of choice for Civilization IV modding. So ...


6

Lua's C implementation is specifically designed to run on embedded devices. It's small and fast (for a scripting language). I would have thought it was fine for at least light tasks.


6

This is were I would point you (http://www.xnua.com/xna_lua_xnua), but it hasn't been updated for a long time. C# is great language, and could in a sense be used as a scripting language within your c# game. Nick Gravelyn has created some nice tutorials about tile engine (http://blog.nickgravelyn.com/downloads/#tileengine) and used a custom scripting engine ...


6

I'd recommend taking a look at LÖVE "an awesome framework you can use to make 2D games in Lua. It's free, open-source, and works on Windows, Mac OS X and Linux." It's clearly not an alternative to the Cryengine, but should certainly demonstrate how to effectively utilize the potential of Lua for entity creation and game logic. Combine that knowledge with how ...


6

I've heard good things about LuaPlus. It wraps the low level C API into a higher level C++ one.


6

Scripting is generally used in bigger projects to allow non-programmers to easily add content to the game. This can be new quests, interfaces, gameplay for levels, etc. A scripting language in itself shouldn't be difficult for a programmer to learn, what will take time is the integration into your game framework. Whether it's worth it or not is really your ...


6

A corollary of FxIII's answer is that you should design everything (that would be moddable) in the scripting language first (or at least a very decent portion of it) to ensure that your integration logic actually provisions for modding. When you are certain that your scripting integration is versatile enough rewrite the required bits in C#. I personally ...


6

You'll probably get farther with Google with a bit of terminology: the usual jargon for a recalculation of an A* path is a "replan". In more specific direction, the situation you raise is the primary stated motivation of HPA*; it's a fairly well proven-out algorithm at this point and is likely to provide solid guidance.


6

I'm fairly sure Lua can do everything you need relatively simply. I use Lua and C++ in my game. I looked at various wrappers like LuaBind, or using a generator like Swig, but I decided I didn't want any of that stuff and I wrote my own wrapper which I ended up making open source in case other people found it useful. Using my little library you can do stuff ...


6

LÖVE isn't as a library that you import into Lua. What it does is embed the Lua interpreter and expose its game functionality to that interpreter. If you'd like to interactive play with the API, there's a couple of libraries built for debugging and live coding: https://love2d.org/forums/viewtopic.php?f=5&t=2473 https://github.com/vrld/love-console ...


6

A good approach is to design the behaviors in C++, and put the desicion parts in Lua scripts. The benefit is you can modify AI decisions without compiling your game; and with some good design, you may be able to modify AI desicions at runtime (opening up a debug window in game and change the variables to affect the decisions). A behavior can be related to ...


6

The method I have used with good results is to give each class that needs Lua bindings a static class method with the following signature: static luabind::scope luaBindings(); The definition of this method looks like this: luabind::scope MyClass::luaBindings() { using namespace luabind; return class_<MyClass>("MyClass") ...


6

You really shouldn't use pixel coordinates for game logic. Just use coordinates that are independent of screen size, and make rendering code account for different screen sizes, this way you get much more flexible and maintainable code. So for example assume you are using 1 meter as one unit. Your screen is 2 meters high and 1 meter wide(on every device). ...



Only top voted, non community-wiki answers of a minimum length are eligible