I'd just like to interject for a moment. What you're referring to as Xbox, is in fact, Xbox on PC or as I've recently taken to calling it, PC plus Xbox. Xbox is not a gaming system unto itself, but rather another free component of a fully functioning PC system made useless by the PC data-extracting utilities, forced Copilot integration and bloated system components comprising a full OS as defined by Microsoft.
comments
I'm not sure which generation it was at but the last time I considered buying an Xbox console I gave up because figuring out which one was the good one was too much of a hassle.
I would be tempted to rename "result" to something more descriptive.
What the fuck is xbox pc and xbox on pc this is incomprehensible to me
Xbox PC game development
🤣🤣🤣
Oh yeah, I forgot to update the screenshot, yes. Thanks for reassuring me that it was good decision to use an enum!
Not to worry, the variable is local and the function is single-threaded.
The elif is a good idea, though - although I'll likely go with a switch statement in the end.
If status is modified in another thread you could have a race condition with method 1 because you're checking it twice. The two methods are not exactly the same code due to that.
Are 1 and 2 magic values in this case?
You could use consts or even use an enum to further improve readability:
const STATUS_ERROR := 1
const STATUS_WARNING := 2
# or alternatively:
enum Status { FINE, ERROR, WARNING }
In the latter case, you'd change status to be the new enum type Status.
edit: Wait, nevermind. I think you're already using enums in the actual code (not screenshot).
The match statement is cleaner.
With the sequential if statements, it might seem on a casual read that both if statements could pass - you'd catch both warnings and errors. Only by looking at the conditions do you realize that only up-to-1 of them will run.
With the match statement, it's very immediately obvious that only one of the commands will run.
i am rust dev so I pretty much just use match all the time
Not sure about how to do this with Godot, but a common pattern for this in other languages is creating something like a 32 bit value where the lower bits are the enum and the upper bits are the status code (assuming they are <=16bit each) and then doing a switch on the resulting packed value.
I'd personally lean towards the switch pattern
It's neat that this is possible, but I'd much rather not ruin my eyesight trying to make games on a phone.
This was fun! Our entry (chrono crank) can also be played as a regular desktop game if you don't have a headset: https://copper-tunic.itch.io/chrono-crank
I mean you could put it on fdroid....
eww, that would mean giving google your govt id and essentially being their bitch. I'd rather use literal paper and write code by hand, then do it on or for anything google related
You're welcome, my friend. :)
I didn't hat the opportunity to write on this comment yesterday, so I'll do it today.
Freaking awesome idea. Right now when I need to make some more "complex" logic for the AI, I'm using the singleton for the CombatManager to keep it with its data. But having a resource for the combat_context would solve and make it able to have more isolated, and for sure create even a replicable combat (since each turn is "predictable")... Love it. Thanks for the comment.
Hey, Shin!
You seem pretty excited about your weighted selection strategy for choosing enemy actions, and I thought I'd share with you some other cool tricks.
I'm going to hide them in a spoiler, though, in case you're like me and you really love figuring things out on your own.
Tap for spoiler
If you get your action weight from a function call, something like:
action_heal.get_weight(battle_context) => float;
You can use the information in battle_context (remaining HP, for instance) to dynamically change how likely each action is to be chosen, which seemed to be something you wanted to look into.
You can even return a weight of 0 if the battle_context would suggest the action would be useless.
For something much more complicated, you might want to look into a concept called a Behavior Tree. Even if you don't use one, you might learn a lot from how they're constructed. Video game AI, robotics, and all kinds of other stuff use them pretty often.
If you want to see an example of a what a really simple behavior tree is capable of (so simple it might be more accurately called a Decision Tree), you should look into Final Fantasy 12's Gambit system. This game actually lets players program their own party member AI to do certain things when certain conditions are met, and it ends up being a really useful if barebones model that I've based a few AI systems on. If you wanted to combine that with the weighted random-choice trick to add a little more decision variety, I'm sure there's a cool way to do that.
But that is propietary? Why are they so good it's annoying
Jetbrains being amazing as usual. Their tools are the best in the business. There are entire languages that are only usable because of their work.
I just wish they hadn't gone all-in on AI. I know it was either that or lose IDE market share, but they should at least have made the AI features opt-in.
This is good.
The asset library has needed an overhaul for a while.
Reviews and tags will help a lot, the currently existing search features... well you basically have to know the name of what you are looking for, and even still, I've run into things that literally have the exact same name, but are made by different people.
My dream is that we see an economy of "parts makers" flourish thanks to this, but this will live and/or die based on who exactly starts filling up the store - and with which assets.
