Jump in the discussion.

No email address required.

shipping is a feature and the eternal refactorcel will never amount to anything

Jump in the discussion.

No email address required.

Wasn't this compiled from an editor of some sort?

Jump in the discussion.

No email address required.

Before any one of you tries to be smart and post some code, consider that Undertale was written under Game Maker 8 in GML, a language that barely supported user-defined functions back then

Jump in the discussion.

No email address required.

codecels would rather rewrite it in C to get better performance on embedded systems and iranian centrifuge controllers (projected release date Q4 2030). codechads just ship it and make a couple of millions :marseyshrug:

Jump in the discussion.

No email address required.

All I can say is that during my "career" as a hobbyist gamedev, the only games I managed to complete and publish were the ones I made in Game Maker

Jump in the discussion.

No email address required.

Is this why Deltarune Chapter 3 still isn't finished?

Jump in the discussion.

No email address required.

learn2hashmap neighbors

Map<Integer, String> map = new HashMap<>();

map.put(1, "Bussy");

map.put(2, "Marsey");

System.out.println(map.get(2));

Output: :marseyex#cited:

That will be $10k for the consultation sirs :#marseytunaktunak:


https://i.postimg.cc/dVgyQgj2/image.png https://i.postimg.cc/d3Whbf0T/image.png

Jump in the discussion.

No email address required.

That's fairly standard for visual novels tho afaik

Why bother with more clever solutions when this works

Jump in the discussion.

No email address required.

VN's basically are like that where you shove a bunch of text into a file / line thing, use something else to reference it. Otherwise you end up writing the dialogue in script based on where it'd occur and that's r-slurred in something like Renpy unless you're making all the dialogue in specific .py files for characters / situations. But hey /g/strags are so much smarter so they can totally code some C program that has to compile everytime it runs just to change small things in 50 different files while they continue ricing their install

Jump in the discussion.

No email address required.

at the VERY least, the integer literals should probably be constants so they have actual names

Jump in the discussion.

No email address required.

It probably is pre-compile :marseyshrug:


:#marsey:

Jump in the discussion.

No email address required.

If your game loop is a wrapper around a giant switch statement, the arms should be moved into a lookup table for the switched-over variable.

After you do this, you can even break out cases into separate modules and compose them!

Jump in the discussion.

No email address required.

Oh yeah tables exist for this case exactly don't they lmao

Jump in the discussion.

No email address required.

:#marseyagree:

You can get a lot of mileage out of them, they're the first step away from jeet coding and also the last step before fart huffing ivory tower bullshit

Jump in the discussion.

No email address required.

I think this is actually fairly standard for most game devs with no programming background, they just write really shit code and it works out because all game libs/engines expect this to be the case anyway, like that one jew who made a game by just stacking a bunch of unity templates on top of one another until he made what he wanted

Jump in the discussion.

No email address required.

I mean that's literally what gamemaker is lol, it's basically the equivalent of a learning tool. We used GM8 in highschool and I still have a copy of it I made onto my USB

Jump in the discussion.

No email address required.

Fair. In this case the shit code wouldnt cause any real performance issues so w/e

What's the correct solution for a dialog tree like this?

Jump in the discussion.

No email address required.

Bootleg answer for something like Undertale:

  • Model a dialogue tree as a sequence of messages
  • For each message add options for associated voices, icons, actions, and i18n references
  • Load your i18n hashmap (i.e. "player.conversation.ch1.somenpc.1" -> "Hello") at runtime or when the player changes the language
  • Make a linter to look for missing i18n strings, dangling references, etc.

Example .json:

[
    {
        "name": "act1.somenpc.greeting",
        "events": [
            {
                "message": "player.conversation.ch1.somenpc.1",
                "icon": "somenpc.smile",
                "actions": [
                    "dialogue.vibrate",
                    "player.exclamationmark_short"
                ],
                "voice": "somenpc"
            },
            {
                "message": "player.convesation.ch1.somenpc.2",
                "icon": "somenpc.question",
                "actions": [ "choice" ],
                "voice": "somenpc",
                "choices": [
                    {
                        "text": "player.convesation.ch1.somenpc.choice1",
                        "goto": "act1.somenpc.buystuff"
                    },
                    {
                        "text": "player.convesation.ch1.somenpc.choice2",
                        "goto": "act1.somenpc.bye"
                    }
                ]
            }
        ]
    },
    {
        "name": "act1.somenpc.bye",
        "events" : [
            {
                "message": "player.convesation.ch1.somenpc.bye",
                "icon": "somenpc.waving",
                "actions": [ "exit-after" ],
                "voice": "somenpc"
            }
        ]
    }
]

Not great, but you'd want to tinker with it for what you need anyway. At least it's better than wrangling something like switch statements.

Jump in the discussion.

No email address required.

hashtable

Jump in the discussion.

No email address required.

This might be an r-slured answer but couldn't you just have the part that listens for a response run on its own thread or run asynchronously so it doesn't block anything in the loop?

Pretty sure it depends on what engine you're using or if you're using a library like Raylib or something

Jump in the discussion.

No email address required.

kinda orthogonal to having a big switch statement. you could have a separate thread and do this asynchronously and still have it be a switch statement.

Jump in the discussion.

No email address required.

What's the point, the game does not progress until you answer the dialog

Jump in the discussion.

No email address required.

I presume you might want to have a game where a monster may perhaps chase you even during a chat dialog with someone. Of course if it's a VN or whatever I don't think this matters as much but you know.

Jump in the discussion.

No email address required.

I would just do what everyone else used to do and separate combat from dialog encounters

Jump in the discussion.

No email address required.

But where's the fun in that? Nowadays G*mers YEARN for Immersive sims chock full of funny hidden interactions, silly fruits, and emergent gameplay. If you just close those avenues up, you're Hurting G*mers.

Jump in the discussion.

No email address required.

Treat g*mers like junkies. Give them what they want for money and abuse them.

Jump in the discussion.

No email address required.

First step:

ACTIONS = {
  idle: (ctx) => ...
}

nextTick(state, ctx) {
  action = ACTIONS[state]
  action(ctx)
}

Makes it easier to skim the game loop and get an broad idea of what happens every tick and what is state-dependent

Also helps you write tests that isolate each case

Jump in the discussion.

No email address required.

lol is that C++? Wait are you binding that with Python?! Imagine using those over Rust. As a proud Rustacean and Ferris the Crab adorer, I regret to inform you that your taste in languages sucks. This is sad. You can do better. You know how easy package and dependancy management is with Cargo? Not to mention you don't even need a Makefile. It's great. Dynamically typed languages need to die. There's no other option. They just do. If you like dynamic typing, you need some help. Seriously. By using a dynamically typed and interpreted language (which means its @#*!&!@ slow!!!), you are committing genocide and harming the environment more than gas cars. Rust is fast and uses clean, renewable energy through the magic of being a language compiled with LLVM. Tired of memory bugs? You should be. Shame on you for still having them when Rust exists. Tired of being bad? Time to go to Rust. Tired of being slow because you're not smart and your friends laugh at you? Rust is quite speedy indeed (all thanks to the big brain of the compiler). Tired of not getting off the normal way? Match statements, loops, and the compiler for Rust give the best orgasms 10/10 (completely legit). Not to mention the superiority you get to feel when you show off your superior Rust code to your inferior “friends” still using some other language. Want to get rid of malware? Rust is safe, therefore malware is noware (also completely legit). You quite honestly will forget about any other language (including English because it's slow and unsafe). You even get to add the Rust Book and its brothers to your Bible collection alongside the Arch and Gentoo Wikis. All hail Rust. TempleOS pales in religious comparison to the faith of Rustaceans. Graydon Hoare is Jesus. Amen.

Snapshots:

https://boards.4chan.org/g/thread/100157238:

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.