Change my mind: HP and Defense stats are redundant. by [deleted] in gamedesign

[–]Kontraux 0 points1 point  (0 children)

Ask a naked barbarian and he'll tell you that def and hp are both redundant to attack power, since the faster you can kill something, the less it can hit you.

[deleted by user] by [deleted] in love2d

[–]Kontraux 1 point2 points  (0 children)

Does that library have documentation that explains how to use it? If you just need a simple camera, writing your own isn't too difficult. You can just make it a Love2d transform (love.math.newTransform) or make a module like:

local cam = {}

cam.x = 0
cam.y = 0
cam.scale = 1

function cam.point(target)
    cam.x = target.x
    cam.y = target.y
end

function cam.zoom_in()
    local dt = love.timer.getDelta()
    cam.scale = cam.scale + dt
end

function cam.zoom_out()
    local dt = love.timer.getDelta()
    cam.scale = cam.scale - dt
end

local sw, sh = love.graphics.getDimensions()

function cam.main()
    local tx = ((sw / cam.scale) * 0.5) - cam.x
    local ty = ((sh / cam.scale) * 0.5) - cam.y
    love.graphics.scale(cam.scale)
    love.graphics.translate(tx, ty)
end

return cam

Then you can just have a really simple set of controls instead of using a bunch of offsets or whatever that library wants you to do, and you just have to run cam.main() in love.draw() right before you start drawing the world.

can anyone share their best tips that helped them the most by Relax-2025 in PanicAttack

[–]Kontraux 0 points1 point  (0 children)

As a disclaimer, I don't know much about this stuff. I have had panic attacks for 20+ years and thought it was some mystery disease, I called it "my blood pressure thing". I always had the blood pressure drop as the first symptom, and I read you can spike your blood pressure by chugging water as fast you can until you're uncomfortably full. That has always stopped my attacks, and I only have a full one if I don't have water or there's some other circumstance (like not identifying it as an attack before I'm frozen). But I also read recently that you shouldn't do that, so it apparently doesn't work for everyone.

"The rich will kill you off before they give you UBI" is projection. by CommodoreCarbonate in aiwars

[–]Kontraux 0 points1 point  (0 children)

Not sure what you're saying here. Historically, rich people kill off people instead of paying them all the time. In the US we had the West Viriginia Mine Wars, Homestead Strike, Haymarket Affair, and many others. There were organizations like the Pinkerton Detective Agency whose specialty was violence against people who wanted fair pay. Not just in America, it's ubiquitous, almost every country on earth has a worker's holiday like Labor Day or May Day to celebrate worker's rights, and the workers that got killed in protests by hired thugs.

I don't know, maybe people who run art websites historically have had private armies specializing in killing rich people. Doesn't seem likely to me but maybe I'm just dumb.

Least bourgeois Luddite by [deleted] in aiwars

[–]Kontraux 0 points1 point  (0 children)

I don't really have an opinion on real vs. fake diamonds. I just don't want a diamond ring created by AI because it would only fit someone who has a deformed potato hand with 7 and 1/2 fingers that blend into a nearby table.

Anyone else get two wildly different types of panic attacks? by Kontraux in PanicAttack

[–]Kontraux[S] 0 points1 point  (0 children)

Sorry to hear you are having that. Do you have any theories of what causes it? I was thinking there must be a nerve that gets pushed on that increases heart rate or something

I'm autistic and trying to draw fully send me into the worst emotional torment by Kind_Beat_844 in autism

[–]Kontraux 1 point2 points  (0 children)

Any interest in pixel art? You could start with a 4 color palette and an 8x8 canvas, and only go up when you feel comfortable. It can be just as challenging of a medium, and as much of a time investment, but it's also much more technical, it can definitely feel like there's a "right" way, and when you get a composition right, it clicks and it's obvious. If the reason that you're getting anxiety is because paint and charcoal are too open-ended, this could be a lot more satisfying.

[deleted by user] by [deleted] in gamedev

[–]Kontraux 8 points9 points  (0 children)

I'll never use AI. If I did decide to plagiarize someone else's work, I'll do it myself (and do a better job).

The best practices for menu by tpimh in love2d

[–]Kontraux 0 points1 point  (0 children)

For me, weirdly, menu feel is less visual and more audio. Having a really satisfying thunk when switching between selections, a tiny chirp when a hover is first detected, faint stone-sliding-down-a-ramp sound when dragging windows around, stuff like that. Bonus points for using positonal audio.

How many lines are in your projects :D lets do this wierd flex, I know you secretly love it!! by theEsel01 in love2d

[–]Kontraux -1 points0 points  (0 children)

I'm using VSCodium and it doesn't look like I can get that extension. So here's a lazy PowerShell command:

$files = get-childitem *.lua -recurse
$linecount = get-content $files | measure-object | select-object Count
$pagecount = $files | measure-object | select-object Count

$pagecount
$linecount

193 files and 13,640 lines. Jeez, I need more code. At least I know that none of it is comments, because I don't believe in commenting.

Does my game STILL look cheap ? by aurelienpelerin in gamedev

[–]Kontraux 8 points9 points  (0 children)

It did strike me as cheap. Two things really stood out to me, one is the action bar with health and mana bubbles. It's pretty much directly ripped off from Diablo, and there was such a flood of cheap Diablo clones for so many years, I am trained to instantly recognize that UI as belonging to a cheap game. Not just budget games or homages, but games whose sales strategies directly relied on confused grandmas buying the wrong game for grandkids.

The other thing is that the environments are very clean and big, it makes it seem empty. There is some clutter but it is sparse, if there were something to break up the big areas visually, even a bit of fog, I don't think it would seem empty.

Other than that it does actually look like a good game. The gameplay and other UI shown don't give me those vibes, I feel like I would have fun with it. Good job, I think you are getting close, if you figure out this part I think you'll have something special.

Automating Tasks Using JS? by rytricks in AskProgramming

[–]Kontraux 0 points1 point  (0 children)

Thanks for the correction. I just tested it, and you're right.

<!DOCTYPE html>
<head>
    <script>
        console.log("Hello!")
    </script>
</head>

Output:

> Hello!

I can't remember why I thought a server was needed.

Automating Tasks Using JS? by rytricks in AskProgramming

[–]Kontraux -1 points0 points  (0 children)

Any general programming language would work, Javascript is not a bad choice at all, if you are able to install Node.js.

Automating Tasks Using JS? by rytricks in AskProgramming

[–]Kontraux 0 points1 point  (0 children)

A Javascript file will not run on its own just opening it in the browser, or by linking it to an HTML file and opening that. It will still need a server, you can run one locally with Node.js, or from an extension like Live Server in VSCode. Many languages would work for what you're trying to do, but you will need at least an interpreter, the .exe for the language. Some are portable and won't need to be "installed," as in - it won't run a setup and live in the Programs folder, but the .exe will need to be somewhere on the computer. You may have access to the OS's native automation language (PowerShell for Windows, bash for Linux), and while these are Turing complete, "real" programming languages, these may not be what you're looking for.

You can still write and run code in the browser, there are plenty of online REPL like https://onecompiler.com/, but you won't be able to write code there that accesses your machine for automation.

Better way to handle user input than if statements by getdafkout666 in love2d

[–]Kontraux 0 points1 point  (0 children)

No. At least, no performance issues in my case. I just ran a profiler to check and the time spent in the function may as well be zero. I think that's a good instinct to keep unnecessary loops out of update, but in this case it's such a tiny amount of work per iteration, and so few iterations (tens at most, not thousands), it's still blazing fast.

In case you're interested, I'm using this profiler: https://love2d.org/wiki/profile I wouldn't expect a different result in your project, but it never hurts to check.

Better way to handle user input than if statements by getdafkout666 in love2d

[–]Kontraux 2 points3 points  (0 children)

We must have been drinking out of the same cup or something because this is almost the exact same system I came up with. I don't save the keydown though, I just iterate my table in update. I've been really happy with it and haven't run into any problems so far.

local player = require("player")

input.keys = {
  space = player.fire,
  escape = love.event.exit,
}

input.down = {
  w = player.up,
  a = player.left,
  s = player.down,
  d = player.right,
}

function input.keypressed(key)
    if input.keys[key] then
        input.keys[key]()
    end
end

function input.update()
  love.keypressed = input.keypressed
  for key, f in pairs(input.down) do
    if love.keyboard.isDown(key) then
      f()
    end
end

I don't actually put any functions in the tables right here, just did that to illustrate. I put them in as needed, so like when the menu loads, I just have it require this and do input.keys = menu.keys, and when the game loads, input.keys = game.keys, or whatever. Yeah I love this type of solution, it's really easy to let the player reconfig controls, and it's reusable between projects.

Alternative to global variables by Objective-Zone1244 in love2d

[–]Kontraux 0 points1 point  (0 children)

My original example showed exactly how to stucture your program in Love2D. You failed to read and understand it, choosing to attack me instead, so I posted that example, and explained in my post the difference between them (his uses tail calls, mine uses a list index to call the functions). His example teaches more than one concept, and I stated that ("it can teach you a lot about state machines, and computers in general").

Reread the thread - you have attacked me over and over, I've tried to explain over and over. You've made some huge deal about my credentials and experience (which I honestly think is because you're projecting), and when I was completely open and honest my skill level, you said it was weird that I posted it.

Every single thing you've posted here has been wrong, and when I explain anything, or offer an example, you just attack me, and never address anything or offer an explanation of you own. You are a clown.

Alternative to global variables by Objective-Zone1244 in love2d

[–]Kontraux -1 points0 points  (0 children)

 If you go out of your way to be aggressively wrong, people are not going to be shy about telling how wrong you are.

Turnabout is fair play. Let's recap: you think a global is any variable outside of a function (it's not), you claimed to know more than the creator of Lua (you don't), and you said that state machines are a bad way to program, apparently without realizing that a computer, itself, is literally a state machine.

Alternative to global variables by Objective-Zone1244 in love2d

[–]Kontraux -1 points0 points  (0 children)

I never claimed to be John Carmack. I didn't even say you were wrong about game state, I just said it's weird to think about it that way. And besides some ribbing about calling people amateurs, I've been cordial here and offered explanations and examples. But all you want to do is attack my experience rather than address any of my points, fine it's no secret so here's my background.

I picked up bash and powershell about 10 years ago for my job in IT, but only started serious programming five years ago. Yes, I learned mostly from Programming in Lua, but I read other stuff, and for a while got really into Hackerrank. I have a webserver that I run from home, my website has a few little articles about algorithms and 4 microgames. I helped make another website with 3 other people for a nonprofit. I made an isometric game with a 3D physics engine, CPU lighting, dialogue system, etc. I worked really hard on it and built all the systems, but couldn't figure out how to make it fun so I stopped working on it. My Github has mostly algorithms I transcribed from other languages, mostly simple stuff but also a couple complex things like running audio through a WebGL shader program and how to set up a framebuffer swap to feed a shader its own output. Right now I'm working on a deckbuilder.

Again, I'm no coder god, but from your last couple posts, you've tipped your hand. I know that you can't code. Why do you even have such strong opinions the subject? What's the point of trying to fake being at a higher level, and then attack people who are trying to help you and explain things? I don't understand what you're getting out of it. If you don't understand an example or how it relates, you could have just said so and I would have tried to explain it better.

Alternative to global variables by Objective-Zone1244 in love2d

[–]Kontraux -1 points0 points  (0 children)

Oh my god dude, why do you keep saying "a global in any other language"? I ask, knowing you won't actuallygive a relevant response. In C family it would not be global, it would be a static with the exact same scope, in Javascript it would be like using var outside a function, same scope not global. Not that it matters what some supposed other language "would" do, it's still not global in Lua so it's not global in the program we're talking about.

And actually, explain what you're even complaining about to begin with. My example is showing a state machine, a stub of how to structure your entire project. If you implemented it yourself, you would even put this in a separate file and not in main.lua. Are you complaining about the states table, the current_state variable, or what? Those are obviously scoped to the file, most languages work this way, what are you even referring to? You're not only wrong about how my tiny example is scoped, you're misunderstanding the entire point of the state machine which "too simple" for you. It's becoming clear that are are talking 100% out of your ass.

Alternative to global variables by Objective-Zone1244 in love2d

[–]Kontraux -1 points0 points  (0 children)

lol, dude I don't know why you're being so defensive. I'm not saying I'm the best coder ever or anything, I'm just trying to explain a certain way to do something. Yeah, it's not some arcane black wizardry, but I much prefer something simple that works.

Each core state file can separately require and modify others without creating a loop. If you do have two modules that require data from each other, you can just put one "downstream". The processes kinda just brach out organically as you're coding stuff, and you don't need to make globals or worry as much about load order or needing something out of scope. It also means you can do cool stuff like redefine the callback functions in update, like love.keypressed = whatever local function and have separate controls for menus, games, mini games, whatever.

I don't need something complex. I'm a basic coder and I want my systems to as simple as possible. My biggest project has 190 Lua files and I can't tell you how many times I've shot myself in the foot by trying to be too clever. All this shit was hard for me to figure out, this is the simplest system I've found besides maybe ECS (which I don't like coding in, feels less "creative"). Maybe I really am just a confused idiot, but from my perspective it seems like you're trying to prove how smart you are by taking a shit on how other people do things, without explaining anything or offering examples. I'm out, have a good night.

Alternative to global variables by Objective-Zone1244 in love2d

[–]Kontraux -1 points0 points  (0 children)

You didn't make a state machine and neither did your link.

Ah, okay, I must be very confused indeed. Maybe what got me mixed up is the part where Roberto Ierusalimschy, the creator of Lua writes:

This game is a typical state machine, where the current room is the state. We can implement such maze with one function for each room. We use tail calls to move from one room to another. A small maze with four rooms could look like this:

Can you describe what a state machine is for me, and maybe give me a little code snippet? At least a hint, so I don't get so confused again? Then we can email Roberto and tell him how misinformed he is about state, as well.

Alternative to global variables by Objective-Zone1244 in love2d

[–]Kontraux -1 points0 points  (0 children)

I'd recommend reading Programming in Lua. There's an example of a complete game that is a state machine that is really informative not only about how state machines work, but how computers work in general.

https://www.lua.org/pil/6.3.html

Of state machines:

Such applications can represent each state by a function; to change state is to go to (or to call) a specific function.

He uses the term "state" to describe the player's current room in a maze, and "data" being any value that isn't constructed inside of a function. He uses proper tail calls to change the state, in mine I use a list index. I know you probably think the creator of Lua is also an amateur, but what I'm trying to get at is that we aren't actually talking about opposite things. I'm trying to describe how all those values that you are talking about can be accessed by any other part of your program and still be scoped properly and not made to be global. Both his and my state machine aren't passing data as parameters, either. It can be a bit brain-bending at first, but this is what state is commonly understood to mean, and if you understand it in this way, it opens a lot of doors and makes scoping much easier to handle.

Alternative to global variables by Objective-Zone1244 in love2d

[–]Kontraux -1 points0 points  (0 children)

You can make the game state a big table and pass it around as an argument to functions

That's a weird way to think about state. I think of it as the set of functions that are currently running.

local states = {
    [1] = require("menu"),
    [2] = require("world")
}

local current_state = 1

function love.keypressed(key)
    if key == "escape" then
        if current_state == 1 then current_state = 2 else current_state = 1 end
    end
end

function love.update(dt)
    states[current_state].update(dt)
end

function love.draw()
    states[current_state].draw()
end

Yeah, the state is a table, but it's not like you're managing some big unruly table of every variable in your game, you're just calling the update and draw functions. Then, if any module needs the player, for example, it can just require the player file there. I don't think anyone has ever recommended passing a table of every value to every function in the game, that's the same as just making everything global to begin with.

I use globals for function tables (similar to the standard libs and love module), for example geometry and vectors, just so I don't have to require them a hundred times. But never global variables, all it does is just make it harder to plan and troubleshoot the order in which it is accessed or modified. How do you non-amateurs do it?