Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Which programming language did you choose and why?

Tramboi

Prophet
Patron
Joined
May 4, 2009
Messages
1,226
Location
Paris by night
If you want to focus on making a game it's a very good idea to start like this.
If you want to become an expert programmer first, it will take many years and it will prevent you focusing on making your game :)

As a consumer, Unity has a huge overhead and doesn't make good use of a computer resources.
As a beginning indie dev, though, it will enable you to make a complete game.
 

vlzvl

Arcane
Developer
Joined
Aug 7, 2017
Messages
191
Location
Athens
I want to program my own game and have decided on learning C# so that I can then use Unity.

Choose what you like the most.
It sounds you have already did your research about C#, Unity & game design in all, yes?
No?
You may end up hating C#, Unity or whatever you have decided its good for you.
Unity is a game engine. If it does what you want & like using it, why do you care anyway.
A lot of people & studios are using it anyway, so it won't be a grave mistake.
Unity is going to speed up your product's making, but it won't make you smarter or better developer.
Many things are already there & for all platforms, either for free or as an asset & you won't see the dark side of low-level programming.
Which is a good thing for beginners. Although many users find that Unity's product tend to be slow but it's my opinion.
 

Hirato

Purse-Owner
Patron
Joined
Oct 16, 2010
Messages
3,935
Location
Australia
Codex 2012 Codex USB, 2014 Shadorwun: Hong Kong
Codex seems to loathe Unity but why?

I detest it because it's a broken pile of garbage made by people who either don't know how to program or how to test their shit.
The engine also gobbles up an insane amount of disk space, RAM, and CPU, despite delivering frankly subpar graphics and performance.

Apologists will say, 'B-But Hirato, that's just the developers using it wrong!"
Unfortunately for them, it's not just a few outliers, but every single game using specific versions of the engine.
And sure, newer editions of the engine has fixed a lot of the issues and improved things, but the old games will never be updated to use them, and so those will always remain in their broken state.


Some particular pet peeves:

Bad Resolution #1: First launch, fails to autodetect screen size,
so falls back to 1x1 and stretches this over the screen,
The game is effectively non-functional in this state, and you have to MANUALLY GO FIND THE CONFIG FILE TO SET A REAL RESOLUTION

Bad Resolution #2: Also First launch, detects the screen size, however does not discriminate between single-monitor and multi-monitor setups properly.
e.g. if you have 2 1920x1080 screens, it will use a buffer of 3840x1080.
This results in the game spawning fullscreen on the WRONG desktop, with half of the UI and play area cut off.
In some this can be fixed by navigating the menus as normal (e.g. Cities; Skylines) in others, you're fucked, and have to do the same as the other case (e,g Lord of Xulima)

Bad Resolution #3: Like the second case, it misdetects the actual resolution,
So it picks one it things is closest and stretches that across the first screen.
Fairly minor, aside from some text ending up slightly blurry or aspect ratio,
e.g. it will detect 2560x1600 for a 1920x1080 - StarCrawlers is an example of this bug.

Recursive mouse event generation:
Unity whenever it warps the mouse, may do so in a way that cascades into generating additional events.
This manifests in 2 ways: 1) Your movement makes a YUGE change, or 2) the game becomes frozen
Warping is a technique to calculate relative mouse movement (e.g. Aiming in 1st person shooters), by checking the cursor's position relative to a point and moving it back there (traditionally the center of the screen)
I've found that Alt-Tabbing out can make the game responsive again,
I've also *heard* that throttling your mouse's poll rate can workaround it (e.g. if it's 1000Hz, lock it to 125Hz), but I cannot confirm.
This is fixed in newer editions of the engine, but games like Expeditions: Conquistador will always be plagued by it.
Now, you might think "Why not just use the keyboard commands to rotate the camera?" - The keyboard buttons trigger the same infinite loop...

Default button mappings are wrong for standard XInput compatible controllers.
I have no idea how this even happened...
I also don't recall how messed up it got or not... I think it was expecting the LT/RT buttons to behave as they do in DirectInput (a combined axis), and not like they do in XInput (2 individual axis)
It's (thankfully) fixed in newer editions.

Spawning crazy amounts of CPU Threads:
Unity3D spawns a fucktonne of CPU threads for tasks that don't need it or are poorly parallelised.
The common side effect is that gobbling up 80-90% of your entire CPU - even if you've got some sort of ThreadRipper beast - and yet is barely capable of delivering framerates measured in FPS as opposed to SPF.
I've run into plenty of games with this issue; it's a weird one that seems to go away and then reappear again.
You can work around this one by disabling most of your CPU cores before running the game; the sweet spot seems to be around 4.
Last one I tried that had this issue was *cough*Monster*cough*Girl*cough*Island*cough*, which used a fairly new version of the engine...
My guess is that it spawns a bunch of render threads (cause that's smart), and they all fight over the same pipeline and tasks, and because of the fighting is barely able to process the game at a playable framerate...


The engine itself has a fucktonne more problems, but these are just particular pet peeves that spring to mind whenever I hear Unity3D...





As for C# as a langauge.
It's got a lot of good points, and a few uncomfortable restrictions.
But I rather like it overall, and IMO, it's a great place to start.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,289
When I was younger C was pretty much the only choice there was, so I didn't choose it like you would these days. I went really slowly from C to C++ and even today I see many people who don't write C++, they in fact write mostly procedural than object-oriented code. It's the biggest reason some people don't like OOP, they don't actually know what it is in general and in context of C++. You want to go all in with OOP and follow the concepts of it exactly. While I'm writing mostly C++ I try to learn more about programming by trying out different languages. I like C#, it's like modern, easy version of C++.
 

odrzut

Arcane
Joined
Apr 30, 2011
Messages
1,082
Location
Poland
OOP followed exactly sucks for gamedev though. That's why industry moved on to ECS and other concepts.
 

Hirato

Purse-Owner
Patron
Joined
Oct 16, 2010
Messages
3,935
Location
Australia
Codex 2012 Codex USB, 2014 Shadorwun: Hong Kong
OOP is fine for gamedev.
The main problem is that people specialise everything, so you end up in this absolute quagmire of inheritance, derivation. and polymorphism.
Whereas the sensible thing to do would be to construct a handful of fairly generic classes that are driven by data.

But that's a problem hardly unique to gamedev.
Heck, even Bethesda in their utter incompetence at least got that much right.
 

odrzut

Arcane
Joined
Apr 30, 2011
Messages
1,082
Location
Poland
That's why I said OOP followed exactly :)

But even if you don't do GreenCookieMonster extends CookieMonster extends Monster - some "good practices" advocated by OOP are counterproductive for gamedev. Like Tell Don't Ask for example.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,289
ECS is popular, because it's easy to understand. You know, can be ask more from game developers really? No. Of course not. But for the rest of us, understanding OOP simply requires that we throw away spoon-fed "memes" like "use composition over inheritance." The truth is exactly the opposite, you should always use inheritance first when it's practical which is quite often.
 

Tramboi

Prophet
Patron
Joined
May 4, 2009
Messages
1,226
Location
Paris by night
ECS is popular, because it's easy to understand. You know, can be ask more from game developers really? No. Of course not. But for the rest of us, understanding OOP simply requires that we throw away spoon-fed "memes" like "use composition over inheritance." The truth is exactly the opposite, you should always use inheritance first when it's practical which is quite often.

In which language ?
 

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
I use Nim for my hobby projects.
https://nim-lang.org/

I wholeheartedly recommend it to everybody who is considering using C/C++.

It's basically C on steroids with GC and a Python/Pascal-like syntax and a *really* good C FFI. I find it personally a joy to use. I was searching for a language that gives me the same performance and low-level control as C/C++ and produces small native executables, but I *really* didn't not want to use C/C++ for fun... So basically I had to choose between Rust, D and Nim, and Nim was the most compelling to me.

For the record, I'm a professional developer since about 2003 (and a hobby developer from much before that), mostly Java/Scala nowadays but have used C/C++, Python, C#, JavaScript and PHP commercially too.
 
Last edited:

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
When I was younger C was pretty much the only choice there was, so I didn't choose it like you would these days. I went really slowly from C to C++ and even today I see many people who don't write C++, they in fact write mostly procedural than object-oriented code. It's the biggest reason some people don't like OOP, they don't actually know what it is in general and in context of C++. You want to go all in with OOP and follow the concepts of it exactly. While I'm writing mostly C++ I try to learn more about programming by trying out different languages. I like C#, it's like modern, easy version of C++.

Not really. The biggest reason is that the further you get from hitting the hardware directly, the less obvious it becomes how all the high-level abstractions map to actual instructions that get executed on the HW. People who eschew OOP (or other high-level paradigms) in favour of procedural/functional code know exactly what they're doing (well, at least most pros). If I had to code in C++ for some reason, I would most likely do it in Orthodox C++ style (basically a very limited subset of C++ that is basically C with some extras).

Btw, nothing wrong with learning OOP, it's useful in some contexts, but it's horrible in others. It's far from the ultimate programming paradigm some people believe it to be (but then, nothing really is, it's about being familiar with a wide range of tool so you can pick the best tool for the job).
 

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
ECS is popular, because it's easy to understand. You know, can be ask more from game developers really? No. Of course not. But for the rest of us, understanding OOP simply requires that we throw away spoon-fed "memes" like "use composition over inheritance." The truth is exactly the opposite, you should always use inheritance first when it's practical which is quite often.

Interface inheritance can be useful and is fine. Inheritance as a mechanism for code reuse is considered harmful. There's lots of other problems with inheritance, one of the major ones is that it composes poorly and tree-style inheritance is often too limiting.

Hence, 99% of the cases you actually want composition in the form of mixins, for example. One case for favouring inheritance would be runtime polymorphism, but there are better ways to achieve that.

Generally, it's hard to argue against it that ECS is a big improvement over OOP style development in most cases.
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,289
There is no reason to argue about this, because most people don't understand OOP in the way it was designed. Their thinking is too procedural or even functional. In C++ it's ok, because it is a multi-paradigm language after all. However there is a lot of confusion about OOP, because it's treated in a wrong way by beginner level programmers. Which compared to me are 99% of all programmers on this planet.
 

vlzvl

Arcane
Developer
Joined
Aug 7, 2017
Messages
191
Location
Athens
but it's horrible in others. It's far from the ultimate programming paradigm some people believe it to be...

Well, it's not the ultimate horrible thing as many people believe either. It's here for many decades, it's proven.
ECS still needs to escape the library state it currently is (UnityECS, anax, entityX) before try to replace something so vastly used like OOP.
 

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
There is no reason to argue about this, because most people don't understand OOP in the way it was designed. [...] Which compared to me are 99% of all programmers on this planet.

Whatever, man... If you want to broaden your horizons though, start here:

http://harmful.cat-v.org/software/OO_programming/
https://www.yegor256.com/2016/08/15/what-is-wrong-object-oriented-programming.html
https://www.javaworld.com/article/2073649/why-extends-is-evil.html

Effective Java is also very good at explaining all the complications that stem from the use of OOP. Don't be fooled by the title, it contains generally applicable advice, it just illustrates the concepts through Java, but the message is universal.

https://www.amazon.com/Effective-Java-Joshua-Bloch/dp/0134685997
 
Last edited:

Cirtdear

Savant
Joined
Jan 22, 2020
Messages
236
I usually start with data structs. Then I might add a constructor if I'm concerned or know a default value to be proper. Then I might add functions to the struct as long as no more than 2 to 4 max.


If I find i've added data members that are confusing/dangerous to be accessed directly, I graduate to class. (if these could have been hidden in a single function, why were they in the struct?)
If I find i've made many routines that are conveinent to reference by the object with the data members, I graduate to class.
If I want to make a manager I graduate to class. (sometimes I give it a factory function even though factory functions can at othertimes be better at file scope)


Did you know all things only need 3 to 4 levels of hiearchy of categorization before further categorization is too unique to matter?

C++ offers more than C plus OOP.

The two most powerful features of C++ are the Type-System and Resource Management through destructors w/ the curl braces limiting scope and thus lifetime of an object.
Classes also allow you to bring behaviors and data together, and use them like an object( so like var). Which is kind of a superpower.
However if you have 100 supermans (because you like supermen) to do a job, you are being 99x wasteful. If you have 1 superman doing everything, you're being too reliant
on a super hero to handle crime.
 

vlzvl

Arcane
Developer
Joined
Aug 7, 2017
Messages
191
Location
Athens
Yeah, sure, it works. There's just better ways. PHP and VisualBasic "works" too :P

Topic is about what programming language did you choose and why, not which programming language or concept do you hate the most and what you can do about.
Open a new topic, name it What is wrong with OOP or whatever and unload tons of OOP love there.
 

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
Yeah, sure, it works. There's just better ways. PHP and VisualBasic "works" too :P

Topic is about what programming language did you choose and why, not which programming language or concept do you hate the most and what you can do about.
Open a new topic, name it What is wrong with OOP or whatever and unload tons of OOP love there.

Yesss, Herr General! :P Butthurt detected, but so be it...
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,289
Effective Java is also very good at explaining all the complications that stem from the use of OOP.

The only complication is the programmer, not the language itself. Languages like Java and D were designed on the idea that C++ has to be "fixed" somehow, but there is nothing to fix other than ideology of a programmer who believes in some random idea. They do work in a way that prevents mediocre programmers making bad decisions, so it removes that problem, but again it's not a problem in the language.
 

Rincewind

Magister
Patron
Joined
Feb 8, 2020
Messages
2,427
Location
down under
Codex+ Now Streaming!
The only complication is the programmer, not the language itself. Languages like Java and D were designed on the idea that C++ has to be "fixed" somehow, but there is nothing to fix other than ideology of a programmer who believes in some random idea. They do work in a way that prevents mediocre programmers making bad decisions, so it removes that problem, but again it's not a problem in the language.

Just curious, how many years have you worked in large development teams professionally? Which languages have you used professionally (not as hobby) to be so sure about your assessment of the merits of C++? Also, have you read the book or do you have any idea what's in it?
 

Tramboi

Prophet
Patron
Joined
May 4, 2009
Messages
1,226
Location
Paris by night
Just curious, how many years have you worked in large development teams professionally? Which languages have you used professionally (not as hobby) to be so sure about your assessment of the merits of C++? Also, have you read the book or do you have any idea what's in it?

20 years of professional work in videogames there, games, 3D engines, and emulators, millions of units shipped (PC and consoles).
And most of it in C++ because it's the industry standard. It's a kludge though, and I dislike what they're trying to do now.
They're trying to recover some errors from C++98 but it's a bit late IMO. It's time to move to Rust or Ada for instance :)

If I had to do an indie game myself and if I didn't have to take portability, consoles and performance into account, I'd go for a Lisp, maybe Racket.
Because you have very high expressivity, you can easily build a DSL for your game, you have lots of documentation, a good FFI and a decent performance.
 

Tramboi

Prophet
Patron
Joined
May 4, 2009
Messages
1,226
Location
Paris by night
The only complication is the programmer, not the language itself. Languages like Java and D were designed on the idea that C++ has to be "fixed" somehow, but there is nothing to fix other than ideology of a programmer who believes in some random idea. They do work in a way that prevents mediocre programmers making bad decisions, so it removes that problem, but again it's not a problem in the language.
There's lot to be fixed in C++.
That's why they keep forking new revisions.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom