Tagged Questions

Lua is a powerful, fast, lightweight, embeddable scripting language. Lua is widely used as a scripting language by game programmers, perhaps owing to how easy it is to embed, its fast execution, and its short learning curve.

learn more… | top users | synonyms

1
vote
1answer
39 views

Custom 3D Noise function incorrectly generating in Lua

I have been working on a custom noise generator (not Perlin on Simplex or whatever), which works fine in two dimensional space, but upon converting it into three dimensional space, it turns into a ...
2
votes
3answers
84 views

Building a C-E engine in a high level language, how can I integrate optional lower-level components that own overlapping state?

To clarify, by overlapping I do not mean overlapping between said components, but rather, let's say I have: My entity contains components, and a parent-children system. Call it a mandatory Hierarchy ...
0
votes
0answers
13 views

Touch-detection in cocos2d-x (Lua): Catering for bounding boxes and scale factor

I am trying to write an app in Cocos2d-x with Lua. I have a sprite that I have added directly to a scene, and now I want to detect touches on the sprite. Right now, my touch begin function looks as ...
0
votes
0answers
13 views

Lua mud using c snippet for protocols? [duplicate]

I've been working on teaching myself to program in Lua for the past couple of months and I've been working on my own MUD using lama as my starting point. I've learned a lot and added quite a bit of ...
0
votes
1answer
111 views

Run Love2D on iphone and android

I have a game developed in lua using love 2d, and now i want to run it in ios/android. Is there any porting or way available to do that. Thanks.
1
vote
1answer
67 views

Love2d: Failed to load tileset map

I'm reading the Love2D Development book, which i think i will stop reading because is outdated and very instable, sometimes i got a lot of troubles. Backing to the question, i made a tileset map with ...
1
vote
2answers
191 views

How to run multiple Lua scripts within the same lua state without conflict

I've been working with Lua for sometime and there is a problem that I could never solve it. First, I'm using a single lua state to have a connection between my scripts so they could transfer data via ...
0
votes
2answers
91 views

Switching a project written in Lua to a compiled language [closed]

I am experimenting with game development in Lua using the Love2D framework, and while it works fine, I am getting tired of using a dynamic scripting language. I would like to have better performance, ...
2
votes
0answers
180 views

Lua Implementation

I'm struggling to get Lua implemented into my game engine. I've read dozens of blogs and articles revolving around how to wrap C++ classes and I seem to have hit a wall. No matter how I structure the ...
2
votes
1answer
395 views

How can I manage entities(in entity component system) using Lua scripts?

Suppose I have a code like this in C++ // Game.cpp Entity* hero; Entity* witch; ... // entity initialization if(/player near witch/) { if(hero->get<HealthComponent>()->getHealth() ...
3
votes
1answer
93 views

Make an object follow the mouse pointer with LÖVE2D

I've been trying to make a picture follow the mouse pointer with LÖVE2D. I want that the object follow the mouse, and not just be the mouse coordinates, I did that. So I toked the distance between ...
0
votes
1answer
53 views

Phone crash when try to use vibration on Android

Im developing an app that when you click a button the phone has to vibrate, the issue is that the phone just chashes. Saing that I need permitions to vibrate. I've already set this permition in the ...
0
votes
2answers
172 views

Smooth moving on tile-based map, how to fix simple collisions?

I've already had some experiences about the work of 2 dimensional square-based playfields and moving a player on them. Though, when a square has multiple pixel sizes, and player moves e.g. 1 pixel per ...
0
votes
1answer
70 views

file:write restarts Corona app

I am attempting to implement an auto-save feature into a mobile game. I have the following code writing to the save file: function saveFunc(input) local saveData=input local file = io.open( ...
2
votes
1answer
282 views

Generating transformation matrix for 2D camera with pan/zoom/rotate

Question How do you implement a camera with pan/zoom/rotation for a 2d game? Is it acceptable to multiply together a series of transformation matrixes to generate a final transformation matrix that ...
39
votes
7answers
6k views

How does Lua work as a scripting language in games?

I'm a little hazy on what exactly Lua is and how a game that is programmed in C++ would use it. I'm asking primarily about how it is compiled and run. For instance when you use a program written in ...
0
votes
0answers
69 views

Gideros Repeating and Clipping Background

I want to have a background with a repeating x-axis, that can be moved horizontally. What I have so far: local background = Texture.new("parallax01.png", true, {wrap = Texture.REPEAT}) local shape = ...
1
vote
1answer
89 views

How should I go about protecting my script files?

I am working on a small multiplayer game with a whole bunch of scripting components. I know I can't store my files in plaintext otherwise anyone would be able to change the functionality of core ...
1
vote
2answers
131 views

Using Lua for configuration and localization data

Since my game is already going to be scripted with Lua, I've decided to make all my configuration and localization data defined using Lua tables. For example, this could be a basic locale file: -- ...
0
votes
1answer
103 views

How should I organize Lua scripts so that some entities do not have access to functions they shouldn't?

For my game in C++ I'm using different objects (like player, enemy, et cetera) which will have to be controlled by a Lua script. My problem is that if I were to write a function in my player script, ...
0
votes
0answers
42 views

Checking if two lines are crossing [duplicate]

How can I check if two lines (created with function love.graphics.line) are crossing themselves? I may use this ability to create procedural maps via graphs.
1
vote
2answers
267 views

Perlin Noise Help

Okay so I have been trying to make perlin noise, fractal noise to be specific, with mixed success. What I do is I fill 5 arrays with white noise, basically just floating point values. Each array is ...
1
vote
0answers
106 views

Determine required camera pitch/yaw change based on mouse movement and roll?

I'm sure this is going to be a pretty simple answer but I can't quite figure it out on my own. Each frame, I'm getting the mouse's distance from the center of the screen (left/up is positive) and ...
0
votes
1answer
82 views

How do I lock drawn lines to be orthogonal to an existing one?

I'm making a 2D game in Corona for Android/iPhone that is similar to Volfied. In my game, the user has to touch the screen to draw a line for the character to move along. How can I force the lines to ...
1
vote
2answers
243 views

Perlin Noise Variations

Currently I'm making a voxel survival game. About a month ago I embarked on procedurally generating terrain using Perlin noise. I understand how to use and apply it for the most part. However I do not ...
2
votes
1answer
115 views

How to set speed based on screen size

I am making a breakout clone for mobile and was wanting to make the ball speed to be related to the screen size. Larger screen would mean faster speed. Right now I have it set like so: ...
1
vote
2answers
116 views

Is it possible to develop web-based games using Corona SDK?

Some clients asked me to develop 2D web-based games and later on they might want to release those games on mobile platforms. I know Corona and I don't want to rewrite my code twice. Is it possible to ...
1
vote
1answer
370 views

How to store generic data in game database?

To clarify things a bit: I want to create a kind of database for my game, that simply is a class that stores all game-state information like object positions, player scores, etc. The main problem I ...
1
vote
2answers
145 views

LUA - Keeping track of game state for a digital card trading game

I am building a card game. Let's say it's similar to Magic the Gathering, Hearthstone, etc. The problem I am trying to figure out is how to architect "auras" and how much damage each card takes. ...
2
votes
2answers
92 views

Breakout intersection logic issues

I'm learning Lua and thought I should try my hand at making a Breakout clone. It is pretty much playable, but there seems to be odd intersection logic at some points, specifically the ball-brick ...
1
vote
0answers
52 views

Overlay scene not showing

I have 2 scenes: One main scene with a button, and another scene with only 1 text. button action in Main Scene: local options = { effect = "fade", time = 400, params = { ...
1
vote
1answer
118 views

How to allow other games to communicate with my Lua scripts?

I am planning some small games that will all rely on a single system of Lua scripts to manage some unified data about: Some achievements that are common to each game. The player's progress in ...
1
vote
0answers
35 views

Verb+Noun Parsers and Old School Visual Novels [duplicate]

Hi I'm working on a simple old school visual novel engine in Lua. Basically I have most of the code set up besides one important feature. The Text Parser. Lets get into how words are generally ...
1
vote
2answers
190 views

Store voxel type data in XML or Java classes?

So, I want it to be very easy to create all the entities of my game and for other people to come in and do the same. I was thinking I could just let the users/myself create an XML sheet the stores all ...
3
votes
1answer
497 views

How to transfer a luabind::object between two lua states

I store an object by a function call from Lua to C++ in first script in my application and after that I'll try to pass that object to other scripts and vice versa. A part of script class in C++: ...
5
votes
2answers
355 views

How to keep Lua bindings from cluttering up C++ code? [closed]

I'm writing a game engine that uses C++ and Lua (and Luabind). Currently, I'm writing all the bindings inside the constructor of the class being binded. I really don't like this because it's ...
1
vote
3answers
899 views

corona sdk scale images

How to scale images to full screen on all devices, i want to use % The method I've seen so far is to define pixels image_variable_name = display.newImage( "testimage.jpg", 100, 300 ) I want to do ...
1
vote
1answer
128 views

Starter love2d physics program not working

I am starting out with my first love2d (using LöVE 0.8) physics program. I am just creating some ground/floor, a car body and attaching two wheels with revolute joints and setting the motors a-go. ...
3
votes
2answers
689 views

How to bind std::map to Lua with LuaBind

Is this possible in lua to achieve? player.scripts["movement"].properties["stat"] = "stand" print (player.scripts["movement"].properties["stat"]) I've done getter method in c++ with this approach: ...
1
vote
1answer
3k views

2D and 3D Perlin Noise Terrain Generation

I'm using 2d perlin noise to generate a heightmap and then adding 3d perlin noise to the heightmap to create overhangs and ridges. But it's not turning out like I would like it to. There are too many ...
2
votes
1answer
421 views

Scripting a sophisticated RTS AI with Lua

I'm planning to develop a somewhat sophisticated RTS AI (eg see BWAPI). have experience programming, but none in game development, so it seems easiest to start by scripting the AI of an existing game ...
1
vote
1answer
431 views

how to link a c++ object to a local variable in Lua

I'm completing my scripting interface with Lua, but recently I've stuck at some point. I have several functions for my Entitiy events like Update(). I have a function called create_entitiy() which ...
2
votes
1answer
162 views

How does one update the physical state of an object after scaling it in Corona?

I am new to Corona and Lua. I have the following question: I have an object cake with these physics parameters (doesn't really matters): ["cake1"] = { { ...
3
votes
1answer
4k views

why lua is so important ( frequently used ) in game development [duplicate]

I wrote some small games for fun myself, and never used LUA myself. but I can see people discussing lua used in games everywhere. I don't know what benefit I can get from using LUA in game ...
2
votes
1answer
334 views

Game Development AI, NPC & Entities Definition using Scripting Languages

i am developing a Multiplayer(actually MMORPG) architecture for learning purpose. I do have some game developement background, but all my engines were very rigid and completly developed for the game ...
0
votes
1answer
104 views

Why does this LUA code not render any objects on the screen? [closed]

Did I mess up something somewhere? If i put a putsxy in the same box, it renders a string just fine, but for some reason this code hates objects. What this code is supposed to do is render a set of ...
-1
votes
1answer
314 views

Overload C++ functions in lua [closed]

I have had a look around but I believe this to be impossible due to compile time of c++. However is it possible to have a class registered in lua and c++ that has a overload update function which I ...
0
votes
1answer
268 views

How to generate an explosion? [closed]

I'm currently working in an Angry Bird-esque game, where the user flings a bomb at buildings and the bomb explodes. How do I create explosions in Corona? Essentially some sort of area of effect ...
1
vote
1answer
453 views

Love2D : How can I keep up with lots of small sprites' collision data?

So I'm using a SpriteBatch to keep up with lots of small pieces for a falling-piece puzzle game. I have an array of Quads (for different color blocks), and they are randomly added to the ...
0
votes
1answer
293 views

Love2D : Problem rotating image in a SpriteBatch

I'm working on a falling blocks type of game with triangular pieces. I'm using a SpriteBatch to accumulate and remember the pieces and their locations. The problem is that when I rotate a scaled ...