Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [lua]

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.

0
votes
0answers
16 views

how to register update function in Lua from C game engine?

This is my first attempt to make a SDL2 based 2d game engine in C, i am planning using Lua as scripting language for gameplay purposes. First i learned how to call a C function from Lua: ...
0
votes
2answers
55 views

Any advantage of having chunks with sizes by the power of two?

With my past experience of having my little game lag because of the size of the world, I have decided that in whatever next project I might choose to create, I will split said world into chunks. Now ...
-1
votes
1answer
31 views

Roblox, custom chat filter

So, I would like to add my own chat filter to my game, how would I do this? eg: Player says: "DIE" Goes through chat filter and comes out as: "###" or any other string I specify.
1
vote
0answers
32 views

How to aim bullets at a player in Vavio

In Vavio, how do you make an enemy aim at the player then shoot a bullet? Here's the code I tried: LevelSpawnData/spawnData-L0.json ...
0
votes
1answer
82 views

AABB test does not consistently detect edge-to-edge contact when bounds are very different in size

My function compares two AABBs for collision detection, and when they are around the same size it works fine, but I noticed that if I greatly decreased the size of one of them (or augmented the size ...
0
votes
1answer
92 views

Walking around a sphere in Lumberyard

I am trying to create a simple game using Amazon Lumberyard and my goal is to have levels/stages where the player will be able to walk around a mini planet. I have seen a lot of tutorials about this ...
0
votes
0answers
77 views

How to let player walk on any surface (walls and ceiling) in Amazon Lumberyard?

I am using Amazon Lumberyard to create a game where the player should be able to walk on any surface be it a wall or a ceiling, but the thing is I have no idea how to do this. I tried using the ...
0
votes
0answers
21 views

Binding controls for characters in multiplayer lumberyard

I have this problem when I tried to test my game in multiplayer using mphost and mpjoin where the controls apply to all characters present in the game. Part of the code I used for the controls are ...
0
votes
0answers
87 views

Lua Interpreter [duplicate]

Have anyone here tried Lua as an interpreter on Unity? For example, I want to use Lua for players to be able to program inside the game. I and my teammates are working on a project in which it is an ...
0
votes
0answers
33 views

How to prevent fixed-tile movement

I have a tile-based game with dimensions of 28 x 31 (I'm recreating Mrs. Pacman), and inverted y-axis. The upper-left tile is 1,1 and the lower right is 28,31. Due to the map being very small, I'm ...
0
votes
1answer
70 views

What am I missing for this flycam to work correctly?

Through reverse engineering, I've found an instruction to inject on which allows me to obtain the XYZ coordinates of the camera, as well as pitch and yaw. Thus, I have the following: camX (Plane)...
0
votes
0answers
19 views

Raycasting issues

I have this raycasting code: ...
0
votes
0answers
57 views

How can I load a script once in LuaJit/Lua and use it across multiple VMs in different threads?

So, I came across an interesting problem. I'm implementing some threaded game logic, and one of the things I decided to do was to use Multiple Lua VMs, with each worker thread containing its own VM. ...
1
vote
0answers
38 views

binding glm operators with luabridge

I am attempting to expose glm vector functions/data to luabridge like so: ...
0
votes
2answers
203 views

How can I correct an unwanted fisheye effect when drawing a scene with raycasting?

Hello I have a game using raycasting for the TI Nspire in Lua, and when the player faces a wall so that their degree they are facing is perpendicular to the length of the wall, I am having what is ...
0
votes
0answers
34 views

How to create an instance of class with the hump library for Löve?

I followed that tutorial that explain (among other things) how to use the hump libary for Löve. At the end of the tutorial, I wanted to add the possibility for the player character to shot bullets. ...
0
votes
1answer
386 views

Create a game start-up menu screen with Lua/love 2d

I just got started programming games and decided to try out love2d since I'm learning lua. I was wondering if anyone knows how I can create just a simple 2-3 button menu when you start up the game. ...
6
votes
1answer
397 views

Love2D game and editor in two separate programs

I'm building an engine in Love2D and I need to build an editor who will create scenes with game objects I wrote in lua. The thing is that there's this guy in my team who said : "Don't include the ...
0
votes
1answer
128 views

Love2D STI library not drawing map at all (black screen)

I'm trying to use a pretty standard map with the Simple Tiled Implementation module for Love2D, but no matter what I try, I can't get it to display anything but a black screen. Here's my current code (...
0
votes
0answers
21 views

Shortest rotation value [duplicate]

I have a top down game. The player moves the avatar with WASD where W rotates the avator to 180, S rotates to 0, A rotates to 90 and D rotates to 270. I also do diagonal movement so if they hold SA it ...
0
votes
1answer
42 views

Lua Unknown error when typing something in Zerobrane studio IDE

What is this weird error that I am getting when I typing something in the Zerobrane studio IDE? It crashes my IDE. But The game project compiles and runs fine. When I turn off "Autocomplete ...
1
vote
1answer
108 views

how to control units in a game using scripts

I'm looking to create a game like screeps, in which the user controls their units using javascript. I am planning on using lua as the scripting language that controls the units in my game, as it is ...
1
vote
3answers
308 views

Binding c++ templated functions to lua

I have started using Lua as a scripting language for my game engine. It works perfectly for things like input, audio etc. However, I'm now trying to bind my entity component system functions which ...
0
votes
1answer
115 views

Love2D how to zoom out map?

I've set up a basic map with Tiled, imported it with STI library (https://github.com/karai17/Simple-Tiled-Implementation) and everything looks in place. How can i get a zoom-out feature now? I can ...
15
votes
4answers
3k views

Procedurally generating a building of specific area

Myself and a team are working on a factory builder game that gives the player a random factory at the start of the game. To try to make sure there is a sense of "fairness," ideally the randomly ...
0
votes
1answer
271 views

Change transparency of image at runtime, LOVE2D

I would like to know how to take a defined image (e.g. a tile) in the LOVE game engine and draw it with a transparency that may vary per-frame. Stencils seem to only work for completely hiding parts ...
1
vote
0answers
148 views

Sprite batching and dealing with isometric depth sorting

So I'm using Love2D which uses SDL2* as far as I'm aware and I have a question about texture atlases & spritebatching. I have an isometric chunk, with 2 layers, terrain and objects (trees, ...
1
vote
1answer
126 views

Löve2d: How can i select object with mouse if it's overlap?

I have already some code but i can't solved this. How can i select one object with mouse if the objects are overlap? It's looks like solitaire game. I wish you can understand me... For example my ...
1
vote
0answers
93 views

interace between C and Lua function with 3D vector arguments [closed]

I have C++ function (which runs some physical simulation inside my game engine) which looks like this: ...
1
vote
1answer
29 views

Is it possible to have a fixed camera without a CameraSubject?

I have created a very simple script to set up a fixed camera with no subject. In other words, I want a camera in a static position looking down at the world (a top-down style camera that doesn't ...
0
votes
1answer
106 views

Const returning C++ method can't be bound with LuaBridge

I have a method with this signature: const std::string GameObject::GetName() And then I try to bind it with this line: ...
0
votes
1answer
256 views

What functions should be called in C++ gameloop from Lua Script

I am using sol2 lua wrapper for my 2D game-engine to implement some lua scripting,but I have some questions about what should functions should i call from Lua scripts in c++, and i cannot find any ...
0
votes
0answers
103 views

How to do trigger in tile map?

How to create trigger in tile map? I have this code to draw textures on tiles: ...
0
votes
1answer
84 views

Is allowing the server to remotely execute code on a client a security risk?

My game uses scripts that can be edited by the player and I'm trying to figure out how to handle multi-player, while still allowing custom scripts. What I am thinking about doing is having the server ...
2
votes
0answers
290 views

How to store Lua script's inner state?

Situation: I am working on an Entity-Component system, and I am using LuaBridge as a Lua binder. There is only one Lua State. Currently when I update the game objects, I just check whether it has a ...
1
vote
1answer
285 views

Should I create a Lua wrapper classes for my C++ classes, or should I bind them directly?

I have a fairly standard architecture like this: GameObjects have Transform, and can have ...
0
votes
2answers
314 views

Roblox script: Can't get “IntValue”?

I am new to Roblox scripting (Lua apparently) and was fiddling with a function that is called when one Part (dubbed the "Sender") is touched by another Part, which is actually a tool with a Part ...
0
votes
1answer
482 views

Lua script for World of Warcraft: Get Quest Info

I'm looking to make a very simple addon or even a macro where I can enter a quest ID and get the quest completion status. As it is, I know I can use ...
0
votes
2answers
59 views

Pressed key doesn't run out of special powerups

So I'm making a game in Lua/Love2D and have a problem with my game logic. Mainly I have a spaceship that can use boost and stuff. That part is fine, I click space and it boosts up to speed quickly. ...
0
votes
1answer
335 views

Love2D and 'Tiled' - Detect if player is over certain tile/Collision

I created a 50x50 tile map with 32x32 tiles in Tiled and exported it as a Lua file so I can use it in Love2D. I have a player you can move around the world but I'm attempting to convert the player's x ...
1
vote
0answers
174 views

Reimplemented steering seek behavior from PyGame to LÖVE is much slower than original

I'm learning about steering behaviors and watched this nice explanation tutorial - https://www.youtube.com/watch?v=g1jo_qsO5c4&feature=youtu.be with the source code available at https://github.com/...
1
vote
1answer
251 views

Difficulty understanding integration of Lua with C++ Game Engine

I'm starting work with the Allegro C++ library to get some lower level game development experience after working mostly with Unity. I've read about how Lua is a popular scripting language choice for ...
1
vote
2answers
436 views

Implementation details of Command Pattern in conjunction with Entity Component System

I have implemented an ECS where more or less an Entity is just an ID, a Component is just a wrapper for data, and a System holds the logic on operating over different components. There is an Engine ...
0
votes
1answer
476 views

Can MoonSharp call functions from static classes?

My question is very simple. I'm using MoonSharp to add Lua scripting to my game. One use case involves calling a static artificial intelligence function from a static class I've implemented in C#. I ...
4
votes
1answer
393 views

Garry's Mod gamemode scripting (lua) - How do I tell if an object is inside a hollow cylinder?

I'm fiddling about with gMod trying to make a gamemode where you have to throw a piece of cake into a cylinder that spawns on the map. This is the code I'm using to spawn the cylinder: ...
0
votes
1answer
201 views

C++ - Lua Preventing malicious lua code

Im working on a "game" that uses lua for scripting and i plan on making it very mod-able. However, malicious code can be written without much difficulty in lua... So how can i go about stopping that? ...
0
votes
1answer
129 views

Got unexpected results from perlin noise. Wondering what it is doing?

I was just messing around with perlin noise and got this. Wondering if anyone knows what it is or has seen it before. Here is the code(LUA with love2d engine): ...
0
votes
1answer
131 views

Unwanted line between chunks in heightmap infinite terrain

I can't figure out what is causing the line between my two chunks. They are completely aligned. It must be something to do with the algorithm. I am using lua with the love2d game engine. Here is a ...
0
votes
2answers
449 views

My perlin noise height map doesn't have smooth transitions and goes directly from black to white

I am using lua with the love2d engine to make infinite 2d tiled terrain with perlin noise. This is just the first step and I want to fix the bugs early. The problem is that there is no gradient ...
1
vote
2answers
1k views

Performance Issues Using Lua in C++

I'm making an engine in C++ with Lua for its scripting language (using LuaBridge as the binding). I have a lot of entities and those entities have components. One of the components on those entities ...