Good day!
I will focus on CPU vs GPU part of the question.
CPU only:
The method you're currently using is CPU-intensive because you're manually iterating over every pixel to set its color, and then you're drawing each pixel as a rectangle. This is all being done on the CPU, which isn't designed to efficiently handle such per-pixel operations at high speeds. Well, there are some examples of pretty impressive realtime rendering purely on CPU on something like threadripper, but that involves mandatory multi-threading and preferrable use of SIMD instructions, which is difficult, and Love2d is not suited for that at all, because it basically use only 1 thread (1 CPU core) to draw things.
GPU only:
There are methods to draw things using GPU only. As I can see from your example, you have some background in math, so maybe you will enjoy the methods like raymarching, that is why I mention this. In raymarching you use a shader to calculate pixel colors based on virtual rays cast into a scene. It can be used in 2D, 3D, 4D... no big difference. These calculations are done on the GPU, which can handle thousands of these operations in parallel, greatly improving performance. It surely can be used to make a Doom-like style game. The main work here is in writing shaders, and the game engine works just like an entry point. Love2d can be used for that purpose easily, because it has good GLSL shader support.
To start understanding how to write basic shaders in Love2d you can read this:
https://blogs.love2d.org/content/beginn ... de-shaders
The basic shader examples are somewhat about only 10 lines of code, so pretty simple.
About the raymarching. This guy is awesome at both explaining the basics and in generating impressive complicated content:
https://iquilezles.org/
https://www.youtube.com/c/InigoQuilez
Just look at his youtube channel for the start.
There is this website, that provides you a way to develop shaders without even use any game engine, just in a browser:
https://www.shadertoy.com/
It's the same GLSL, and shaders written there could be relatively easily inserted into Love2d game.
The GLSL (openGL Shader Language) itself is very math-friendly and pleasurable to use. Much more then Lua or C++ or any other general-purpose language. For example here you can find all it's functions:
https://shaderific.com/glsl/common_functions.html
https://shaderific.com/glsl/trigonometr ... tions.html
https://shaderific.com/glsl/geometric_functions.html
Relatively short list, but extremely powerful.
Combined CPU & GPU:
The most common approach in modern games is to use a combination of CPU and GPU rendering, known as rasterization. Like 99% of games do exactly that. In this method, the CPU is responsible for setting up the scene, managing game logic, and sending instructions to the GPU. The GPU then takes over to draw the graphics. Most game engines (Love2d included) are designed with this pipeline in mind. Love2d has built-in functions for drawing textures and polygons. In this method, instead of counting pixels it is reasonable to count draw calls, it is good when draw calls count is less then 1000, it is bad, when draw calls count more then 10'000. In your example, when each "pixel" results in separate draw call (rectangle draw call), the amount of 129'600 draw calls is indeed to much for old CPUs to handle. Using this you can draw single wall segment with 1 draw call, which will result in a lot of pixels managed by the GPU. Or even draw the whole scene with just 1 draw call, depends on data structure and code organization.
While Love2d (oh, sorry, it is called LÖVE
) is not designed for 3d games generally, it relatively easily can be used for that purpose.
Here are some libraries / demos / extensions:
https://love2d.org/wiki/Love3D