16
votes
Procedurally generating a building of specific area
A simple way to build a procedural generator is:
Randomly build things
Run a function that checks whether the output is good
If the output is not good, go to step 1
Even if it takes thousands of ...
9
votes
Accepted
Calculating Linear force required to hit a specific vertex on a parabola
Quick note: I don't know lua, however I am fairly good at maths/physics and please bear with me if I cover ideas you are already familiar with.
For any object under the force of gravity the ...
7
votes
Procedurally generating a building of specific area
Given a restriction of "all areas are at are at least 3-4 blocks wide" the first idea that leaps to my mind is something like the following:
pick one of 3x3, 3x4, 4x3 or 4x4
place a block of that ...
7
votes
Accepted
Procedurally generating a building of specific area
You could use pre-generated polyominoes as meta shapes to build an assortment of buildings.
Let's say your minimum acceptable distance is 3 blocks.
Then the smallest acceptable building unit we'll ...
6
votes
Accepted
How do I get the player's position in Roblox Studio?
I feel your pain. Roblox is very confusing, despite their claims that it is an easy way to learn scripting.
To get a player's position (server side) you need to access the player's character ...
6
votes
Accepted
var=time() vs time()=var pico8/lua
In math, the = sign represents the equality comparison operator, an assertion that "the thing on the left has the same value as the thing on the right."
This operator is commutative: you can exchange ...
5
votes
Accepted
Love2D game and editor in two separate programs
Alright, found it !
I had to add this to the main.lua file in the editor folder and it worked :
package.path = package.path .. ";../?.lua"
require "core.engine"
4
votes
Accepted
C++ - Lua Preventing malicious lua code
could block certain functions, but that wouldn't be nice for the modders
It's perfectly nice for modders and is basically what everyone does. The only ones you need to restrict are the IO functions, ...
4
votes
Is allowing the server to remotely execute code on a client a security risk?
You might want to ask yourself if you really need client-sided scripting at all. You might be able to make many interesting mods possible by simply making your network protocol powerful enough. Most ...
4
votes
How can I correct an unwanted fisheye effect when drawing a scene with raycasting?
It looks like you're firing out your rays at evenly spaced angular intervals.
...
4
votes
Accepted
How to properly split damage against armor?
If I've understood correctly, I'd do this as a two step process...
Calculate how much the armor absorbs, then apply the rest to the player.
Something like:
...
3
votes
Accepted
Implementation details of Command Pattern in conjunction with Entity Component System
How do I populate the execute command if there isn't any logic that
"belongs" to an entity?
But there is a mechanism for applying logic to an entity: Systems. In ECS, Systems map behavior to ...
3
votes
Performance Issues Using Lua in C++
I think part of the problem (which also caused me to misinterpret the question at first) is the lual_dofile() calls.
This sounds like all scripts are always loaded ...
3
votes
Accepted
What functions should be called in C++ gameloop from Lua Script
I would generally recommend to avoid making high volume calls into Lua. That is partly about performance but mostly about engine architecture.
To get the perf bit out of the way: the bridging code ...
3
votes
Accepted
Const returning C++ method can't be bound with LuaBridge
Sounds like a bug in LuaBridge, so you should report it.
As for fixing your project, just remove the const, it doesn't make sense anyway since you're returning a ...
3
votes
Create a game start-up menu screen with Lua/love 2d
There isn't a built-in menu system for love2d. The developers take a 'do-it-yourself' approach to a lot of such things.
Here's an example of how I ended up rigging my menu for my first time:
...
3
votes
Any advantage of having chunks with sizes by the power of two?
The main advantage of power-of-two sizes is that division by a power of 2 (on an integer) is just a bit shift, and modding is just a mask. Both of these operations are blazingly fast to do on gobs of ...
3
votes
Accepted
How to fix diagonal velocity being greater than axis-aligned?
Is there a fix for this so no matter what of the 8 I travel its the same speed?
Yes... You want to apply a total force and split it between x and y
To do this for any angle, you apply ...
3
votes
How to fix diagonal velocity being greater than axis-aligned?
You use trigonometry. Here we can just use the Pythagorean theorem:
a² + b² = c²
If the player is moving at a 45° angle, a and <...
2
votes
Accepted
HardonCollider Error: attempt to call method 'addRectangle' (a nil value)
Answering my own question here, in case somebody else encounters this issue.
Looks like i have been reading outdated documentation & samples, according to the new docs there is no such method as <...
2
votes
How do I change a LÖVE2D game executable's icon?
The steps below are also covered in a video tutorial (icon topic starts at 2:22).
Create an .ico file using GIMP, you can use the game.ico or ...
2
votes
Accepted
Dynamic force behind logical jumping on 3 axis'
So first, in the formula:
velocity.x = x - ( x + ( 10 * math.cos ( ( rz + 90 ) * math.pi / 180 ) ) );
The two 'x's cancel out each other:
...
2
votes
Accepted
Logical math behind jumping in a 3D world
It's the same as you'd do it for 2D, just with an extra axis. Use the same exact equations you do for a 2D game, something similar to the equations of motion or the kinematics equations.
For each ...
2
votes
My perlin noise height map doesn't have smooth transitions and goes directly from black to white
There is a bug in the final normalisation code, fortunately it’s easy to fix. You only need to change:
map2[x][y] = map2[x][y] * mapMultiplier
into:
...
2
votes
Got unexpected results from perlin noise. Wondering what it is doing?
You are going outside the 0..255 range. That's why you see these color bands, since you are goint the whole range of values between 0..255 for every integer.
You are multiplying by 255 twice. This ...
2
votes
Accepted
Can MoonSharp call functions from static classes?
One soulution could be creating a static callback function that in turn calls the function on the staic c# class
so for exmple
...
2
votes
Accepted
Pressed key doesn't run out of special powerups
While the player holds down the space key, the else part of your code is never reached, so the deceleration is not applied. Basically, you'd have to execute this if ...
2
votes
Accepted
Roblox script: Can't get "IntValue"?
I think your misunderstanding is based around what val == not nil means. The expression not nil evaluates to ...
2
votes
Accepted
Should I create a Lua wrapper classes for my C++ classes, or should I bind them directly?
C++ aliases seem to provide a solution to your problem.
Solution A
The main benefit here is low maintenance. The other is you can avoid method call indirection overheads by avoiding wrappers (I ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
lua × 250c++ × 51
love2d × 49
scripting × 26
roblox × 26
corona-sdk × 22
entity-system × 12
collision-detection × 11
mathematics × 11
2d × 9
physics × 7
procedural-generation × 7
c# × 6
game-design × 6
architecture × 6
ios × 6
component-based × 6
algorithm × 5
tilemap × 5
java × 4
android × 4
3d × 4
rotation × 4
box2d × 4
software-engineering × 4