game dev thread
Game dev thread
Not mobile friendly kmage
Gotta admire people so fired up with creativity that they have to work on their game instead of finishing Programming 101.
as someone who has never made a video game and is still learning the basics of programming, I'd like to hear how other game devs would handle a better way of dealing with dialogue.
I imagine the recommendation would be switch statements as well as not using string comparisons, but it's fun to ask anons about optimization so let's hear it Yas Forumsros
spreadsheet or other external file with lines of dialogue that have references, both of which can be passed onto the function handling your in-game text printing
holy kek
xml/similar files with references to text in the game
you can programatically reference them without using strings and if/else statements and makes it easy to do localization
All else and no if makes devs create dull games
what is the issue and how to solve it
this. even a case statement would be a lot less work than what the "game dev" is attempting to do
I'd love to see examples of this sort of thing, as I don't know the first thing about optimization.
How would one go about this for Game Maker?
Using endless if statements is bad form as it encourages bad programming in other parts of the code and is unsustainable for when projects get big.
These "optimization" tricks you learn when learning how to code software in general, and can be applied to programming games. So it's a good idea to learn general programming before jumping straight into video games
put it in a txt/xml and tell the game to look it up from there.
please stop. i can't look away, but don't want to see anymore. can you imagine trying to troubleshoot this fucking rubbish?
i'm not your Yas Forumsro faggot
Else if chaining is messy and less performant then a simple dictionary/map construct.
>Ever using an else statement
Imagine trying to localize this.
You're the badass programming wizard, so why not just write a bot to do it for you?
no, imagine if there was someone else writing the dialogue as well. she would have to know coding and every time she wanted to change something specific to this dialogue she would have to find the file in question and find this part of the code.
it needs to be in a different file, any format will do as long as it's human readable and editable.
the real problem her code has is the whichstring though, how do you know which case is number 0051 without looking it up somewhere? at least use enums if you do it this way
you could but that would be a massive fucking waste of time when you could have just programmed it better in the first place
If you're using Unity like she is, just create a DialogeManager script with a public string to represent a line of dialogue, and attach the script to every NPC object in your game editor. That way you can set the string value in the editor for every NPC and not have to hard-code it. I have no idea why someone would do it any other way.
I recommend looking at gamefiles. Best way to learn is through example.
aaand what if i fucking hate the ecs
the what
>talkscript.talk (0023);
AAAAAAAAAAH
AAAAAAAH
AAAAAAAAAA
FUCK NIGGERS
AAAAAAAAH
BLOOOOAT BLOOOOOOAAAT
yeah, but is absolutely right. instead of trying to fix the problem later, do it right the first time and don't be such a faggot
the entity competent system
Yo /prog/ have you seen this?
Making something passionately but shittily is okay when you're young, but not when you're an adult and you also want to sell what you make to other people. Shit like this is pitiful at best and insulting at worst.
>diagnostico bueno
If it's just you or some partner developing and writing for the game that's probably fine, but wouldn't that be a problem if you want to hire a writer or translator who has no idea how unity works?
This shit makes me feel better about what I do at work
You hold an array of dialogue. You hold the current index. Done.
why do you need to check difficulty breathing AND everything else
then check everything else separately
for the same if statement
why
not sure how C# compiler handles multiple if-else but something like this would be best by being searched in a hashmap or literally just any array given its checking numbers. other than that the issue is more of a convenience one since if someone wants to change dialogue they would have to modify that piece of code, rather than the code search a different file that has identifiers for the dialogue which a writer can easily modify and at any point without needing to change the main code itself
Yeah you're right. Something I would never consider because why would I want someone else to write my game and I'm probably not ever going to have my game translated.
a switch statement is more elegant in C#. Its discussed in chapter 1 or 2 of any C# lesson.
Mine has gotten pretty Lovecraftian, as it uses string compare to resolve various dialogue-related actions.
you don't have to avoid nesting this hard kek
where are people learning to code like this?
poorly edited youtube videos and udemy courses
Doesn't GM have a dialogue tree system?
OR || OR || OR || OR || OR || OR ||OR || OR
coding bootcamps, and youtube tutorials
At least it's obviously shit and easily fixable.
You know you're in deep shit when some genius starts comparing types.
You mentioned the problem in your question. People are learning "how to code" in shitty silicon valley bootcamps that train people to be HTML codemonkeys without actually teaching anyone how to program anything worth a damn. These people then go on to make games, thinking they're hot shit because they spent two days writing CSS.
i dont know GM script but if "goto node" is a command for traversing the dialogue tree and that parameter has a mix of different commands, wouldnt it be better to split it into two parameters, one with a command enum and the other with a pointer for whatever data is relevant?
Not that I know of, but I suspect I'll have to use one, sooner or later.
Similar method but not in an if/else statement. Can even be a spreadsheet like dialogue_en.csv
Just give them recognizable keys like: Act1.Scene1.Bob.SpeechBlock1.Line1
Important thing is to allow it to be copied for other languages, like dialogue_ita.csv so all the strings inside can be translated effortlessly without changing the keys
i mean, it's good that people are trying to be proactive and learn shit, but youtube and whatnot have so many rubbish tutorials that we end up with a bunch of fucking ELSE IF statements shitting up the place. remember, just because you CAN do something, doesn't mean you SHOULD.
Actually, I already have an answer for this. Instead of using a string to represent the dialogue I would just use an int to represent the dialogue ID number, which corresponds to a text file containing lines of dialogue matched to a unique ID. That way the translator can just edit each line.
If I wanted to hire a writer to write the script for me, I would probably have to put that writing into the game myself anyways no matter what I do, so this would still work.
>dothething()
How do I learn to code properly? I want to learn but have no idea where to start.
>thinking they're hot shit because they spent two days writing CSS.
holy kek, this. dunning-kruger in effect.
Didn't the undertale dev made like 2000 if comparisons in a row? He still made millions. You can code however you want as long as it's stable and perform well enough
>Comp Sci in Uni
Have to find the fastest possible algorithm
>Programming job
Find the fastest to implement algorithm. Doesn't really matter how fast it is
Of course there are exceptions but if you make a video game dialogue system it doesn't fucking matter
How?
Where do I start to learn? And how long before I can make something decent as a prototype? I only have a small amount of time free on the weekends to study as I'm learning web dev when I get home from work to try and get a job there, but I'm really passionate about actual applications.
I don't know about Undertale but VVVVVV is like that.
Or I would stick with using a string for the ID and make the ID something recognizable like "sewer_level_npc1" or "city_level_newspaper1"
I don't know anything about C# naming conventions but I'm fairly positive a few uppercases and underscores wouldn't do no harm there
You can get away with it
Just don't let anyone see it
The programming part? An afternoon to get a 2d game running. Maybe a few days for a decent doom style fps shooter. At least in Godot, but other engines should be similar.
The most time intensive parts is not coding but creating all the assets imo, but I guess that depends on the game you make
I don't follow any of the C# naming conventions. I don't even know what properly documented C# methods look like, I just use
/*
*
*/
format. Works for me lol
>Where do I start to learn?
College. Or grab a X Programming For Dummies book and get going.
>And how long before I can make something decent as a prototype?
Less than a day if all you are trying to make is a simple clock program or some shit.
If you want to make usable software, start by trying to make something that already exists. Make a word processing program, or a calculator. If you want to make videogames, start with something simple like a Snake game or Solitare.
meaning when people learn something new, or especially start out in a field, they get a little bit of knowledge under their belts then think they fucking know everything. it's the dunning-kruger effect.
double negative got me, meant would do no harm
definitely, stuff like if/else chaining is baggage for you and your dev crew, not your users. makes the development time that much longer etc
So what’s the proper progression? What do you take after programming 101?
You can get something done after you got as far as learning what a function is in any basic guide.
That's how far I went until I just stopped and I infrequently mess around with that much information.
Not to act like an obsessed eurogoblino but I feel bad for aspiring American devs. Their two learning options are shaky bootcamps and overpriced colleges.
I got my computer science masters for a combined total of less that €2500 and had a job before I even graduated.
Explain to me why this is bad? I don't know programming so you need to clarify why
I tried doing it with enums, but couldn't find a way to combine data from multiple enums, like you're suggesting. The rest of the actions can definitely be enumerated, though.
Oh shit, I'm sorry. I misread your post. I thought you accused of suffering from Dunnig-Kruger.
Sounds good, thanks!
I actually am signed up for classes this summer, but with the whole Covid thing and people self studying I'm not sure it it'll be worth it with competitive it'll be in two and a half years when I get out.
because it's just about the worst way possible to do what OP presented
>€2500
Germany?
For webdev, I found that initially having some structure and spoonfeeding really helps. For that reason, freecodecamp was a solid introduction. It's a bit handholdy when you start off, but once your reach frameworks, you are expected to figure out a lot of stuff on your own.
Once your are done with it, your are ready to build your own stuff, your could refer to udemy courses for real life practices and guidance.
if it works it works
doesnt make it not shit though
What's so bad about == true? Is it just because she (he?) could just do
if (something)
--function()
Instead of if (something == true)
Because she doesnt understand logic
Undertale didn't get big because of its amazing engine and impressive framework, it got big due to the artistic merits behind the game, like the characters, plot, and music. Not everybody can make a story as appealing as Toby Fox, and not every game has to be a story. Sometimes you just want to play a fun game with nice visuals and tight controls. If you want that, you need a good programmer.
The code is hard to reason about, hard to maintain, hard to reuse and most importantly, has extremely simple ways of being written better.
LOL
>just adopt this antipattern bruh
It's really not that bleak. All the information you will ever need is available for free, but no one wants to read through official docs or textbooks. So they end up going to youtube tutorials because they think it's easier, but those often include bad practices or don't explain why they do certain things so the viewer doesn't fully understand why they do what they do.
it's all good mate. i probably just fucked up the wording.
>Be European
>Free college
>Spend like 7 years in college because lazy as fuck
>Government pays thousands of dollars for me
>Finally about to get job and get taxes for the government
>Decided to move to another country
I think I cost the government like 50.000 and didn't made them any money at all lol
God bless you user
France.
Work with someone.
Junior dev positions often have pajeet tier requirements. Just make sure someone does code reviews of your shit.
i think more than anything it just shows a lack of understanding how programming works. you can fill your car up with gas using paper cups, but it's a shitty way of doing it.
Seems tedious
Here guy, I need you to write dialogue for my game. All you have to do is open up Visual Studio and recompile the entire fucking thing every time you make a change.
Dialogue should be in some external resource file, not in code. Preferably in some format that even the most retarded of writers can figure out how to use.
Yes, actually. Redundant syntax makes code harder to parse mentally and harder to maintain as a result.
>download unity and blender and all the other shit
>get through 1 tutorial on how to make an object
>2nd tutorial is starting to program
>give up after 30 seconds