I hear a lot of people claim C++ is the end-all-be-all to game dev, but plenty of other languages are used. Comments?
>>43154977
C# ya dingus
>>43154977
They're right.
>>43154987
OP here, that's what I thought, but I still hear C++ for some reason that no one can explain.
>>43154977
>gamedev intersection of masochism
Don't complain, at least things you make are fun.
Probably even socially gratifying when your friends find it fun.
Sounds about right.
>>43154977
C++ is a horrible language. Check out some of the other threads on /g/ and in the archive to find my posts about why it sucks so hard.
Oh well, at least it's not Java.
Just use C and save yourself a lot of hassle.
>>43155124
It's because people need both objects in gamedev and low-level access (mainly to make things fast).
And not many things fit that description: C++, Objective C, and D.
Most do C++, but D is probably better.
As someone intending to get into graphics and engine programming (I suspect these types are still and always will be virtually nonexistent in New Zealand, despite the gaming industry exploding), what programming language(s) should I learn?
Still C++?
>>43155434
Yes
>>43155398
COME DOWNSTAIRS DINNERS READY
Hay guys, what about Python?
>>43155124
C++ is the industry standard for AAA titles that need maximum performance due to what the other anon said. These days it is used more because the industry is so invested in it than any other reason. Solo or small-teamed indie game developers are much more likely to use something like C#.
>>43155518
Python is slower than my dick when I try to masturbate.
>>43155474
I don't understand what you're trying to say.
>>43155434
engine programming? you're gonna need more mathematics than any other language
>>43155518
Yes, but anything above 2d will require the heavy parts in C.
>>43155550
not surprising
it's past your bed time
>>43155641
>someone on the Internet thinks that a certain language is horrible
>quick, I had better call him a child
BYOND's HTML5 client is the future
C# is for Unity faggots and nobody else. Real niggers make their own engine.
>>43155361
It takes more time to make a game from scratch than it does any other software and for most games there is a 98% chance it will never even pay off.
>>43155864
>make own game engine
>spend so much time game isnt done
we have a shitty engine though thank god
>>43155883
>my job is the hardest
I don't agree.
>starving artist
try starving free software developer
>>43155932
I didn't say it was the hardest, I said it was the most time consuming.
>>43155534
how's that ED going for ya?
>>43155951
It's relative to amount of features.
There are dead-simple games (like flappy bird), and there is uber-complex system software (like linux)
>>43155534
Nothing's THAT fast.
Lua?
>>43155883
Lolno. Games aren't what takes the longest.
Try operating systems, malware, compilers, DEs, standard libraries, etc.
>>43155789
Not him, but you have no idea why you think Cpp (or Java, for that matter) is horrible. You're just parroting what you think the /g/ hivemind wants to hear.
>>43156214
Anyone mind spilling the beans on this secret while we're all hear?
>>43156214
This
>>43156207
>DEs
Good point, didn't think of that.
Needs all the skills that a single gamedev needs, but doesn't result in a game.
However, the result here is nicer to look at than other software (re: >>43155361
).
>>43156233
>while we're all hear?
>we're all hear?
>hear?
>>43154977
[qt]3.14 thong with blender.
>>43156258
> He's not hear
> 2014
> Not being hear
>>43156271
I can't here a fucking thing you're saying right now...
>>43156277
Ear, ear, it's okay
It wasn't anything important anyway.
>>43156295
It's not? I thought some faggot was going to try to explain why he hated C++ and Java?
If you say it's not important, though...
>>43156311
I think he gave up, he's not in hear anymore.
>>43156327
Now, here hear young man.
>>43156327
It's just as well, I didn't want to here any of his little kid bullshit anyway.
C++ is the best for now, you have both performance, and object-oriented.
>>43156339
>>43156344
I'm confused ear, who's who ?
>>43156311
OP here, I would like to know.
>>43156258
chinese cartoons arent you one heck of an intellectual
>>43156418
Don't you mean...
>OP ear?
>>43155398
>Thinks Java is horrible and worse than C++
>Proceeds to say C is the best language ever
This is how you identify a technology poser. Any developer with half a brain knows the only truly horrible language is JavaScript.
>>43156444
Yeah, but horrible language aside, Android might take over as the number one (consumer) OS if Windows doesn't step up its game, so Java might become good to know regardless of how horrible it is.
>>43156419
prejudices arent you one heck of an intellectual
>>43155883
Unless you are trying to make a generic game engine with as few hardcoded things as possible, then no, they can be quite fast to develop specially if it's a small indie game.
>>43156365
I'm just chiming in, I'm >>43156250.
As for C++, it sucks: It's unsafe, its syntax is bloated and has too many features.
It's old news, it's just that it is established due to C.
And while I like C (at least it knows its place), it too is all the more archaic, and the reason we're still dealing with it is actually that it's build in POSIX.
And while I use POSIX, it too is all the evenmore archaic.
And the reason why we still suffer it? Legacy, and programming operating systems is hard.
We have no cross-platform driver interface, it's just too much work.
Plus, even a brave enough team would risk developing another lisp machine that noone would use.
And how to monetize it? That's even harder.
>>43156465
Java isn't even that horrible if you don't depend on badly designed API. I agree a good portion of the standard library is cryptic as fuck, but actually the Java syntax is one of the nicest I have ever seen, even better than C's.
>>43156489
>has too many features
It hasn't.
C# has the roughly the same amount. It's just that, unlike in C++ they fit nicely together.
>>43156444
This man has seen some shit
>>43156760
More specifically, JavaScript
>>43156854
I wonder if we all just started calling JavaScript JavaShit everywhere if ECMAScript comittee and browser makers would react?
Try to peer pressure them into it: JavaShit considered harmful.
Lobby for a low-level code, and against asm.javashit.
PLEASE RID ME OF JAVASHIT!
>>43156910
>JavaScript is declared deprecated by the WWWC
>New scripting language with a nazi standard and a small standard library gets developed
>It's statically typed and actually OOP
I would masturbate so hard in that case.
>>43156963
You should rather go to confession, masturbation is clouding your understanding:
There should be no language, there should only be bytecode.
Then you could write in whatever language you want.
>>43157037
But that would make the web closed source, anon. It's still a good idea though, as it could make web programming very flexible and probably much faster.
>>43157089
It's still non-free now, it's just that you can see its source.
This way that's just going to be more apparent.
Who knows, maybe it turns out for the better, because right now, people have a hard time empathizing with rms when he says non-free JS is bad.
But yeah, user scripts would suffer on small sites. As for the big ones, APIs are a standard nowadays.
It's not ideal, but it's probably necessary to get rid of JS
>>43157166
>It's still non-free now, it's just that you can see its source.
I know, but you can still study it for personal use. You might not be able to use it, but you could learn a thing or two.
>But yeah, user scripts would suffer on small sites.
Maybe functions and variables could be named as strings in the bytecode (I think Java does that, when decompiling stuff it restores original method and field names, so they might be defined somewhere, like a header file or something) to allow easy access to them. You would still have to figure out what does said function do and replace it entirely, though.
>but it's probably necessary to get rid of JS
Completely agree. I would prefer to see a good and secure bytecode implementation with strict security policies than a shittily implemented scripting language.
>>43157313
consider the following:
LLVM IR as web bytecode format
webkit already uses LLVM as a jit format
for legacy browsers emscripten exists
there is already a good stable of languages that compile to LLVM
>>43157364
[Furious masturbation intensifies]
>>43156611
After a while I've come to appreciate the features that C++ uses, though I admit that if used wrong (and in a project with lots of contributors or workers, it WILL be used wrong), you a potential clusterfuck of a design.
PPSSPP succeeded with its emulator though, and its in C++ (for the most part). Why all the hate?
hurr hurr blender game render
>>43157906
hurr hurr gpl and undocumented shit
>>43155518
See: Mount and Blade.
>>43155518
look up PyGame
>>43156203
Löve uses Lua.
>>43155525
>C++ is the industry standard for AAA titles that need maximum performance due to what the other anon said. These days it is used more because the industry is so invested in it than any other reason. Solo or small-teamed indie game developers are much more likely to use something like C#.
Why would small teams be more inclined to use C#?
What about Bombermine.com, which is Bomberman in HTML5 iirc? =X
>>43160675
>Why would small teams be more inclined to use C#?
Easier to use and still fast enough.
>>43154977
>C++ is the end-all-be-all to game de
Sort of. Game ENGINES are mostly written in C++, but the actual content is almost always scripted, usually with Lua.
C++ is deprecated in favor of D, even Carmack speaks highly of D and uses C++ only because he can't transition all his tooling and all the other devs. If you're starting from the bottom then have the decency of giving your game the D.
>>43160725
>Carmack
deprecated
>>43160752
Why? Because AMD drivers were shit when Rage wad released?
We're talking about the guy who single handedly removed the latency killing VR with his time warp
>>43160781
>time warp
that was Dr Frank'n'furter.
>>43156444
>there is only one horrible language
>>43156214
>>43156242
How do you know that?
I have my reasons for disliking C++ and Java.
Why do you lie on the Internet?
>>43160857
Because most everytime someone posts something like this >>43155398 it always turns out that they either never managed to learn the language / were told it was bad by people who'se opinion they happen to value / don't understand the design decisions of the languages.
It works everytime, they always end being proven wrong or silly and up moving the goalpost until it's just shitposting in arguments.
You're statistically wrong.
>>43160889
>they always end being proven wrong or silly
>You're statistically wrong.
Not him but this made me laugh
>>43156214
>You're just parroting what you think the /g/ hivemind wants to hear.
Rather, it seems that it's not what the hivemind wants to hear. Around a year ago, /g/ didn't have any of these C++ fuckers, and it seemed everyone liked C.
Now (especially during this summer; coincidence?) there are lots of C++ people.
I hate C++, and I hope to stop new programmers from using it and to stop people interested in it from exploring it.
My reasons are:
>It's a huge language
>It takes a very long time to learn, and even seasoned C++ programmers admit they don't know the whole language
>It's incresingly used by people who only know Java or the C++ paradigms, and nothing of the original object oriented design or how to use function pointers/structs in C
>Java-style object oriented language, which has no real productivity gains, and rather just encourages bad layout in code
>The namespaces are a horrible mess and tricky to deal with
>RAII
>With each release they add more features instead of simplifying what's already there - developers are forced to put up with these new additions
>It was designed for one purpose, and now it's being used for a purpose it wasn't intended for; the original purpose (superset of C) isn't 100% true either.
>Existing compilers are slow and inefficient
>The grammar isn't entirely context-free
>only choices for libs is shit like Boost
>Taught as an introductory language just because it's popular - it's one of the hardest languages in current use today.
>Designed and maintained by a committee, not anyone trying to solve a real life problem
>There are contemporary alternatives like Go, or just C99.
>It teaches programmers to be lazy by giving them a language with everything in which only does half of what they want. Rather than learn how to write bespoke solutions, they use things such as Vector to solve problems in a "meh, it's good enough" way.
>>43160996
>hating C++ for RAII
b8/10
>>43161013
Please explain why you think so; what evidence is there that it's bait?
>>43160996
I am trying to create my own C and C++ implemetation (compiler and standard library), I finished the C standard library in a few days and the C compiler took me about one week but I was not able to finish the C++ implemetation, there are so much stuff in there that makes it impossible for someone to implement it form the start. I would even had to change my parsing technique complitely to parse it effectively
>>43161020
>makes it impossible for someone to implement it form the start
And yet gcc and clang exist.
>>43160996
>Go
http://yager.io/programming/go.html
http://cowlark.com/2009-11-15-go/
https://blog.habets.se/2013/10/Why-Go-is-not-my-favourite-language
>>43161020
>I finished the C standard library in a few days
post sauce
SDL or SFML ?
>>43161031
Go isn't as good as C, I know this.
It's better than C++ though.
If the only argument is "no generics", chances are that if you need generics and you can't think of a better way to design your program, you're not much of a programmer.
>>43161020
I am aware that C++ can be very difficult to implement. Godspeed.
>>43161044
>chances are that if you need generics and you can't think of a better way to design your program, you're not much of a programmer.
top bait
>>43160996
>C++
>object oriented language
le_trash.tiff
>>43160996
>summer
I really want to stop reading there, but I'll humor you
>I hate XXX
Why are you so strongly against it ? Did C++ kill your entire familly ?
>>It's a huge language
That's just your opinion, not an argument against the language. That's also objectively not true.
I don't like potatoes because they are round therefore potatoes are bad and everyone should stop eating them.
I don't like C++ because it's big therefore C++ bad and everyone should stop using it.
>>It takes a very long time to learn, and even seasoned C++ programmers admit they don't know the whole language
True for most "modern" languages. The grammar is easy to learn except for those couple of edge cases, but the libraries are huge.
>It's incresingly used by people who only know Java or the C++ paradigms, and nothing of the original object oriented design or how to use function pointers/structs in C
Hating a language because of it's userbase makes no sense to me. You have everything you could want from the userbase, a good compiler, a good doc, active participation. Why'd you care if beginners make mistakes ?
>Java-style object oriented language, which has no real productivity gains, and rather just encourages bad layout in code
Opinions. In my experience, it's the contrary. C++ gives you freedom and is multiparadigm, your job to write good code with that freedom.
>The namespaces are a horrible mess and tricky to deal with
Opinion. The namespaces are easy to use and practical if not abused.
>RAII
Opinion. Widely seen as a wonderful thing and strong argument for using C++
And I'll just stop there because of char limit and tiredness.
>>43161044
Instead of working around language failures like lack of generics, I prefer to use better languages.
>It's better than C++ though
Nah.
>>43161057
>C++ gives you freedom
Does it respect my four freedoms though?
>>43161038
Let me polish it and I will post it on the DPT in a few days
>>43161029
and?
>>43161067
Yes. The GANOO COMPLER COLLICTION guys made sure of that.
>>43161057
>The grammar is easy to learn
Not true for C++
>>43161046
>le bait maymay
I'm not going to assume that you don't have an argument, but if you do, why didn't you post it?
Why did you say "top bait" instead of countering the point?
>>43161051
This is what I was trying to say. There is no better way for me to phrase it than "modern object oriented".
>>43161057
Not just my opinion, it really is a large language in comparison to its contemporaries.
>long time to learn
Go, Python or C doesn't take nearly as long to learn as C++.
>good doc
I disagree. The compilers aren't good, either. Beginners will be the ones writing the C++ code of the future, so it's important for how they learn if I will want to use the libraries they have written.
I also don't think it's morally correct to teach people C++.
>namespaces
They are abused frequently, though. The :: is also horrible.
>>43161059
I guess it's my opinion against yours. "Better" doesn't mean anything. Go is small, and helps bridge the gap between interpreted languages and systems programming languages. This is the reason why I like it. It's less complex than C++ and one can use pointers without worrying about GC. Those are my reasons. It's just opinion.
>>43161100
>I also don't think it's morally correct to teach people C++.
SJW plz go
>>43161119
Only SJW use C++ in the first place, teaching people to be SJW is not morally correct
>>43161119
>thinks that something is morally wrong
>therefore SJW
It's funny because I disagree so much with the SJW shit.
I'm anything but a SJW, and "social justice" is subjective. I don't try to push my morals on other people. Fuck SJWs.
>>43161127
Only SJW make posts like this. Not killing yourself is not morally correct.
>>43161100
>he thinks C++ is an OO language
laughinggirls.jpg
>>43161147
I don't know what to call it then; do you have a better name?
I know it's not OO by the original sense of the word.
>>43161135
Nice bate
>>43161158
Nigger oriended
>>43161158
>Multi-paradigm:[1] procedural, functional, object-oriented, generic
>>43161172
ur mom
>not using C/C++
enjoy your 20 fps
>>43161187
I only consider "object oriented" as what Alan Kay defined it to be. If I'm correct, he invented the term and [one of] the first object oriented languages, Smalltalk.
C++ is not oriented around objects.
>>43161187
Nice! You know how to use the wikipedia
>>43161205
>C/C++
>Error: language not found
>>43161205
>implying 20fps isn't plenty for my solitaire game
>tfw no qt pi gf to play poker with
>>43161205
Objectively the two best programming languages.
>>43161262
>C++
>Best
>Even good
>>43161262
>objectively
>best
objectively a contradiction in terms
>>43161100
>I guess it's my opinion against yours.
It's not an opinion that Go lacks generics.
>Go is small
So is lisp and assembly. Small doesn't mean anything when the language is shit. Small does not mean simple.
>systems programming languages
Go fails at this too.
>can use pointers without worrying about GC
Except interior pointers rape the GC and null pointers rape the type system.
>>43161297
>and assembly
Not x86 assembly, that shit is bloated
Use a real RISC instead
>>43161297
>opinion
I was referring to how you said "Nah" to Go being better than C++. This really is just an opinion.
>small
Lisp is a good language. Too small isn't good. In my opinion, assembly languages are too minimal for one to use to do practical things. Go and C are not.
>systems programming
It doesn't fail, it's just not the best. Use C.
>Interior pointers
I didn't know this; I guess you're right. I don't have the time right now to read into it.
>>43161294
no way?
About to start working on my own game/engine/dicking around project.
Think I'm gonna roll with C++, OGRE and Bullet.
Anything else?
>>43161343
>Too small isn't good
Small is bad metric for judging a language. Small doesn't mean simple or better. Lisp is smaller than C and Go but good. Assembly and C are smaller than Go but they're all shit.
>it doesn't fail, it's just not the best. Use C.
It's worse than Real Time Java at systems programming. Go is only a "systems" programming language by Rob Pike's retarded definition that includes application software. C is another pile of garbage made by the same group of people, by no coincidence.
I have to give the Go team some credit, it takes some ingenuity to create a language as bad as C. C and Go are manifestations of atavism in the programming world. C and Go fanboys are dullards who worship regression and have brain damaged notions of what "simplicity" means.
>>43161590
>>43161590
I second >>43161610
>>43161653
It'll take a while to sink in. One day you'll realize C and Go are shit and stop associating "small" with simple.
>>43161673
>implying i ever said small == simple
>implying you're a faggot
>>43154977
Well if you're making little games then sure, you could use pretty much any language. But if you want to make modern, high performance games, then C++ is the only option.
>>43155518
I want muh game to run, not to walk.
>>43161698
So have you implemented them in Python and they were too slow?
>>43161697
>modern, high performance games
Buzzwords
>>43161716
>If I say "buzzwords" I get to stick my head in the sand and ignore the truth
I hate C elitists as much as the next guy, but you're dumb as fuck if you think you're going to get better memory management anywhere else. Let me know when they port a high performance game to Java or Python and I'll eat my hat.
>>43161745
>http://en.wikipedia.org/wiki/Jake2
>Jake2 is a Java port of the GPL release of the Quake II game engine
Bon appetit.
>>43161692
He did not imply it but he is
>>43161785
>Quake II
>high performance
>in 2014
Wow okay, so your head is still stuck in the 90s?
>>43160705
This is pretty much the best way to do any king of modern dev.
Performance code in C/C++
Glue/scripting in Lua/Python/Ruby/etc.
>>43161745
There are lots of languages with manual memory management
>>43161785
Java: Now fast enough to run a game from 1998!
>>43154977
The latest consoles are powerful enough to handle medium intensity indie games written in Java, Python and C#.
C++ will still continue to be used for high performance game engine components.
>>43161785
>implying modern
>implying high performance
it's neither. old graphics, old gameplay, frame rate drops during explosions.
>>43156444
Confirmed for seasoned veteran. Every symbol typed in JavaScript is another slap in the face for me.
>>43160675
C# is simpler, you don't have to worry about low level stuff, also runs with unity. Seriously, if you learn the languages you will understand why big games need C++ and small games are great for C#
>>43161810
>>43161899
>>43161937
all dat damage control
>>43161590
Are you seriously telling me that C isn't a simple language?
Smaller languages are generally simpler. Nobody said "small therefore simple" or "simple therefore small". It's just a rule of thumb.
C and Go work with that rule.
Please learn before you shitpost on imageboards.
Why do you think C is a pile of garbage? What do you think should be used instead for the same task? Please don't humor me by saying C++.
I think C was a good language for its time and it's a good language for our time.
Fuck off with your python javascript bro bullshit.
>>43162197
u mad?
It's getting tiring for me to constantly remind everyone that the language and tools used in any project are absolutely arbitrary.
The only thing that matters is cost. If a cost benefit analysis came to the conclusion that NVIDIA's next high performance lighting engine would be cheaper to write in VBA they'd be hiring VBA dev's the next day.
>>43162197
>I think C was a good language for its time and it's a good language for our time.
>>43162197
>it's a good language for our time
Daily reminder that C is the language of Heartbleed.
>>43162289
>absolutely arbitrary
>The only thing that matters is cost
So what is it? Arbitrary or guided by costs?
>>43162290
>le laughing girls means that you're wrong!
>>43162320
Bad programming is also the language of Heartbleed. What's your point?
>>43162208
I don't even get mad anymore. I've realized that I'm on the Internet, and the things I say don't really have an affect. I'm just your next Anon. If I fuck up then I can just continue posting.
There's no reason to be mad about programming languages, of all things. Who fucking cares? It's shit you type into a computer.
>>43162351
>bad programming is also the language
Please ignore this, I meant to say:
>bad programming is also a cause
>>43162330
The language and tools are guided by cost analysis. In this way they are arbitrary.
The reason why C++ is so enduring in game development is because large studios will have tens of gigabytes of libraries and frameworks accumulated over years. Moving all of these libraries to other languages would be extremely expensive.
>>43162374
Such a shame C++ was the language which made it.
>>43162351
Would Heartbleed exist in a language with bounds checking by default?
Just use whatever has sdl binding.
>>43162394
Its a bigger shame that JavaScript made it.
>>43162374
>large studios will have tens of gigabytes of libraries and frameworks
not really
>>43162435
There's this really cool thing called programming that you should try sometime if you want to contribute to conversations on /g/.
>>43162401
openssl wouldn't exist at all because forced bounds checking would be to slow.
>>43162401
This has to do with the implemetation having automatical bounds checking or not
Some implemetations have this
>>43162480
Only it wouldn't.
>>43162496
Only it would.
>>43162480
Do you have benchmarks to back up your claim?
>>43162401
I don't know about the specifics of the bug. You are probably right.
Most features of any language, if used in a certain way, can be considered "bugs". Bounds checking isn't in C, and it was a mistake that people didn't check the code properly.
This doesn't really say anything about C, just about people not being as careful as they should be with a language which doesn't have bounds checking.
>>43162434
I would rather have nothing instead of Javascript in browsers. In my opinion it's a stupid idea to have a function where you execute some unknown code (that is, it's downloaded and run by default for the great majority of people) inside a web browser.
Pages would be much snappier and responsive without Javascript, too - simply because the programmers of such websites have no way to put in something which slows the browser down (Javascript/some scripting language).
I heard people are trying to bring other languages which run on top of JS onto the web. Now that's a shame.
>>43162520
I have my ass if that's what you want.
>>43162558
Then your opinion is as good as useless. You must have pulled it out of your ass like your post suggests.
>>43162545
The web needs an entirely new language to replace HTML, CSS and JavaScript.
They were never fit for purpose and never will be.
>>43162520
Try it yourself.
>>43162585
This is why I'm making an alternative to the web. I posted extensively about it in a thread yesterday and a few days ago I made a thread about it. You may be interested, or not. I don't know.
The thread from yesterday: https://rbt.asia/g/thread/S43140501#p43141954
My thread from a few days ago: https://rbt.asia/g/thread/S43087314 (this is also linked to in the above thread)
I'm on holiday right now so not much work is being done at the moment. I may create a /g/ thread in the future.
>>43155911
People make engines because it is fun.
Just like how other people make video games because its fun to.
Deal with it.
>>43162669
>>43162545
It says a lot about C. It says C doesn't have do bounds checking on arrays, which says it's inherently less secure than a language that does bounds checking. Being more careful is not a solution. People are careful and still make mistakes because no one is perfect. It only takes one mistake to create a security hole. The only reliable solution is to guarantee bounds checking at the language level.
>>43162669
Why aren't you on the irc faggot?
>>43154977
>but plenty of other languages are used. Comments?
in the basement.
>>43161042
SDL2.
SFML is C++ garbage.
>>43162682
Actually, the whole point is that it doesn't replace the web. If it did, or if it attracted the same kind of people, I would consider it a failure and leave it to its own devices.
Thankfully I'm a pessimist and I'm sure it won't become popular at all.
>>43162707
Which IRC? I'd go there if I knew where.
>>43162669
You don't need a HTTP replacement, you need a GNU version of Dart that comes as an easily implemented module and compiles to asm.js
>>43162669
holiday where?
>>43162755
Japan.
>>43162750
>You don't need a HTTP replacement
But http sucks, so why not replace it?
>>43161489
Don't forget OpenG..
>OGRE
Why.
>>43162762
check your email
>>43162766
As much as I would like to see one, it would take decades for it to become popular.
>>43162766
I had exactly the same thought.
There's also no obligation to stick with HTTP for a web replacement, so it's fun to experiment and maybe think of some better ideas; even if HTTP isn't bad.
>>43162781
This is the first time I'm posting my email on 4chan. Please send.
>>43162787
Doing things for fun doesn't require what you're doing to become popular, just that you and some others can enjoy it.
>>43162766
Just use SPDY. It's made by Google, so it's guaranteed to be ad-free.
>>43162829
Original HTTP (aka 0.9) isn't bad at all.$ nc foo.bar 80
GET optional.domain.tld/address
... reply goes here ...
connection terminated
Very simple interface for fetching documents from a server. And the specification fits neatly on a sheet of paper.
http://www.w3.org/Protocols/HTTP/AsImplemented.html
Is opengl C++ only, or can I use it to make a simple 2d C graphics engine
>>43162787
This is true, we must find a way to make it popular
>>43162940
Seems better than the current http actually, but it could be better imo
>>43162940
I like this; I'll check it out.
Thanks. If you're interested of what comes of this "project", check /g/ over the next few weeks. If you're not, ignore me please.
>>43162977
OpenGL is a language-agnostic API
>inb4 tips fedora because agnostic
>>43162977
OpenGL is specified in terms of C functions.
>>43163011
It really isn't.
>>43163011
>OpenGL is a language-agnostic API
That's why the specification is in C, right?
>>43162829
I send you a email
>>43162991
I have no idea what project this is. I just saw HTTP and thought I'd take us all back to a time when the protocol made sense.
>>43163046
>That's why the specification is in C, right?
But it isn't?
>>43163049
Sorry, the "project" I'm thinking about is an alternative to the web, which may or may not be on the HTTP protocol. This is what I was debating with myself and a few others in past /g/ threads.
I hate what the web has become, and I don't think there's much of a solution other than closing one's gates on the web (which is a big barrier for entry, and sacrifices anonymity) or starting afresh, which is what I'm trying to do in the hope that it doesn't become popular.
Sorry for the confusion, anon.
>>43162774
Because it was recommended to me (by the lead programmer of Ronimo among others) to get an idea for engine architecture design. Best way to learn is to try a few existing ones out and he really liked OGRE. They made The Blob with it.
And I imagine it would be nice to have some structure in place already and build around that, instead of having to design everything from the ground up.
But yeah, otherwise I'd just go with OpenGL.
>>43163057
Here.
http://www.opengl.org/registry/doc/glspec44.core.pdf
>>43163073
>lead programmer recommends own engine
D'uh. Ogre3D has a really mediocre design because of an over-reliance on singletons.
>>43163060
Maybe you'd be interested in the 9p protocol. Not for the "web" but as a study of how to write a simple protocol to get one thing done well.
>Description: http://man.cat-v.org/plan_9/5/intro
>Implementation: http://plan9.bell-labs.com/sources/plan9/sys/src/lib9p/
It really does put modern protocols into perspective
>>43163086
It merely uses C syntax.
>>43163102
That's what it means for spec to be in C.
>>43163123
Oh. The API is still language-agnostic though.
>>43163129
It's not. It just is not. If you want to implement OpenGL in java, what package name do you use according to spec?
>>43154977
>math = computer science (low level)
>masochism = time (not that much)
>art = visual effects (shitty ones)
>>43163089
Well what's a good graphics engine then?
I highly doubt I would be able to come up with anything better myself.
>>43163147
That's the same question as to how function names are mangled in C: Not part of the OpenGL Spec, but of the specific implementation.
>>43160996
>c99
>not gnu11
>>43163186
OpenGL spec has everything you need to unambiguously implement it in C, and none for other languages. It's not language agnostic.
>>43163194
>>c99
Not a context-free grammer either.
>>43163194
>GNU
harmful
>>43163194gcc-4.9 -fdiagnostics-color=always -g -gdwarf-4 -Og -Wall -Wextra --std=c11 -Wpedantic -Wno-unused-parameter -fno-diagnostics-show-caret -fsanitize=undefined -fsanitize=address -fno-omit-frame-pointer -Wno-unused-function -fcilkplus -pthread -lpthread -D_XOPEN_SOURCE=700
>>43163234
>-fsanitize=undefined -fsanitize=address
good man/woman/kid
>>43163249
Is this bad?
>>43163258
On the contrary, it's very good as it provides a detection mechanism for bugs that easily happen in C/C++. And contrary to using valgrind it doesn't slow your game down to a crawl.
>Seeing logically sound recommendations
>shitposters
>trolls
>shills
This thread is the daily dose of /g/ second only to the one with OP and his autistic kid
>>43163286
Clang wiki says typical slowdown is 2x, so it's not quite useful in production.
>>43155525
>AAA titles
>maximum performance
>>43156444
Whats wrong with javascript?
Lua + Löve
what language do those super meat boy indie developers use?
those games always seem to run well
>>43163595
Originally Flash, then C++
>>43163595
>makes an observation about a game running well
>therefore it must be the language
You can get the type of performance with that sort of game even with Lua or some shit.
For something more advanced you'll want C, or if you're retarded C++.
>>43163488
>>43163286
(noob question, feel free to insult my lack of real knowledge) but isn't is possible to debug using those tools and run the debug version on a really beefed computer (to compensate the slowdown) and then strip these tools from the final version ?
>>43163644
>you'll want C, or if you're retarded C++
b8/10
>>43163658
Of course it is. Just compile your final version without those switches. It's what I do actually.
>>43163672
Ok. And wouldn't using stuff like smart pointers actually lessens the problem of memory leaks ?
Or building a homebrew garbage collector to get rid of the hardest leaks ?
>>43163734
>And wouldn't using stuff like smart pointers actually lessens the problem of memory leaks ?
It would. But it's not only about memory leaks but also buffer overflows and other undefined behavior-
>>43163734
mfw fresh Java devs going into c++ don't even know about gc
>>43163766
Didn't think of that.
>>43163771
What ?
Second year of CS here... not really an expert yet. Never worked on large projects.
>>43154977
>tfw want make graphics engine in C++
>last Hurdles
>textures aren't loading correctly because fucking DEVIL
>iluGLloadimage function works perfectly fine
>it only works for square textures and formats the rest fucking up the UVs
>make function...#Loading func...
glActiveTexture(GL_TEXTURE0);
ILuint imageID;
ilGenImages(1, &imageID);
ilBindImage(imageID);
ILboolean isload=ilLoadImage((char *)nPath.c_str());
if (isload)printf("\nItloaded\n\n"); else{ printf("\n\nNOOOOOOOOOOOO\n\n"); }
ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE, ilGetData());
...temptexindex[0] = textureID;
....temptexesindex.push_back(temptexindex);
>you will never properly texture your waifu
>>43163852
No AA/10, but looking good.
glhf
>>43160996
I learned C++ over the summer, shit isn't hard.
Once you get used to the syntax its fucking butter.
>>43163852
>C++
there's your problem
>>43163999
When did /g/ stop liking C++?
What is the better alternative?
>inb4 someone recommends the next letter with only 5 libraries
>>43163852
What the fuck is "il"?
Some wrapper around GL?
http://benchmarksgame.alioth.debian.org/u32/benchmark.php?test=nbody&lang=all&data=u32
>everyone hating on C++
I'll just leave this over here
>i wonder what language would best be used to create a vast number of objects in a dynamic environment
Unless you want to create a game in Fortran.
>>43164034
/g/ never liked C++. The hivemind seems to have intensified though. Probably because Uriel killed himself and the weekly catv spam.
>>43164034
>When did /g/ stop liking C++?
/g/ never liked C++
>What is the better alternative?
C
>>43163996
Yet you don't know C++
>>43164034
/g/ never liked C++ because it is complex and requires care and skill to use properly, as well as longer term discipline to keep those skills sharp.
/g/ creams over C# and obscure things they know they'll never learn but won't be shamed for not learning because nobody else knows them either.
>>43164070
Its an image loading library that is deprecated, not that there is much else to be developed.
It has wrapper functions that pretty much load the image into a texture completely in a header called "ilut.h" although the texture has to be 128x128 512x512 anything^2 or it will warp it.
Or you can construct your own, which I'm attempting to do correctly
>>43164155
>>43164158
I thought the new thing was D?
>>43164155
I like this guy.
>>43164116
You cherrypicked a benchmark in which C++ would look good over C or similar languages. By your logic, we should use Fortran to write games.
>>43161031
You just got beat by your own link
>So Go is not my favourite language. It comes in second after C++. And for many if not most projects I prefer to use Go.
>>43164180
D and Rust are horrible.
Erland and C are nice.
Go isn't really suited for games, but meh.
Scheme is fun to make text-based adventure games in.
C++ is complex and full of features, most of which one doesn't need. Each release adds more features which more people don't need.
This is my personal experience.
If there was "C++ lite", I'd use it - but I guess that's C and I already use it. C++ is too complex and enterprise-y for my tastes, although you may like it (why, though, is beyond my feeble mind).
>>43164180
Right, C# is just the ultra lazy tier introductory language (that isn't python or ruby cause those are for faggots). D is one of those obscure things that nobody will call them on.
Why should D exist when C++ exists? Of course the language only goes as fast as you allow it to, so benchmarks don't always apply anyway. It's really really easy to slow your programs down to shit when you're fumbling about like a tard.
>>43164182
>I enjoy coding C++ more
>>43164202
Why should C++ exist when C exists?
>implying one can help fumbling like a tard when using C++
>>43164213
>but I won't ever use it for my projects
glad he doesn't enjoy C++ to the point of delusion!
>>43164201
>D and Rust are horrible.
Why? And how is C nicer?
>>43164216
But C++ is a variant of C! To get the additions of C++, one simply has to create C++ from C.
To be fair, C++11 is fucking amazing. If you could just.... forget the last 30 years ever happened and just learn C++11... everything would be fine.
>>43160996
I'll bite, since nobody else has (completely).
>huge language
Good.
>long time to learn
First 2 years at uni.
>increasingly used by people [who are terrible programmers]
This is true for literally every language, especially C.
>Java-style
This could not be further from the truth. Java and C++ are completely different.
>namespaces are a horrible mess
Only if used incorrectly.
>RAII
You prefer memset() and resource leaks?
>add more features instead of simplifying
The new features are what allows the language to become simpler.
>designed for one purpose
The purpose was to bring high-level features into C without affecting the low-level features.
>compilers are slow and inefficient
On my system, my last-year-top-tier SSD drive is the bottleneck of compilation. My game engine (100+ files, heavily templated) takes 8 seconds to compile from the SSD, 5 seconds from ramdisk, 2 of which are from linking (which is basically the same in C and C++).
>isn't entirely context-free
What? Neither is C. Not that it matters anyway.
>shit like Boost
False; I've gotten away with never using Boost. There are many alternatives.
>introductory language just because it's popular
No, the reason is because it's multi-paradigm. There exists no programming technique that cannot be taught in C++.
>maintained by a committee, not anyone trying to solve a real life problem
Many people involved are real-world professionals who volunteer their time to develop C++, because they use it in their profession to solve real problems.
>alternatives like Go
Don't make me laugh. At least you could have said D or Rust.
>teaches programmers to be lazy
Why would I waste my time implementing a data structure when there's one available in the standard library that does what I want?
Also what the fuck is wrong with vector? It's just a freaking heap array, how would it even be done differently? (inb4 linked lists are better)
Anybody here knows why SDL is slow as shit for rendering?
I have framerate issue while displaying a simple tilemap with background and foreground.
Should I go for opengl?
>>43164181
behind C, C++ is pretty dominant in the benchmarks listed.
I chose that one because of its nature.
>simulating large amounts of dynamic objects and applying gravitational physics
>nothing similar to simulating large amounts of moving players/AI in a game environment and applying physics/rules
>>43164182
>second after C++
Ouch, that's pretty low. Go confirmed for shit.
Don't understand the C++ hate.
Is it a problem with the OO-Paradigm that C++ haters have?
In my opinion, OO has improved structure, readability and reusability dramatically.
>>43164225
NO BLOAT
NO RAII
NO COMPLEXITY
DENNIS RITCHIE
>>43164234
>This could not be further from the truth. Java and C++ are completely different.
LaughingMcCarthy.jpg
>>43164324
>RAII
I keep seeing this term but I don't quite understand it yet.
Can anyone explain it to me?
>>43164316
C++ isn't all about the OO Paradigm, bro.
It's probably to do with the rest of the bells and whistles, templates n metaprogramming n shit, nub-catching multi-inheritance snafus, etc.
You have to understand that /g/ is petty consumer-whore baby. They don't like hard work or clever work, especially if it's awesome.
>>43164316
>In my opinion, OO has improved structure, readability and reusability dramatically.
Computers exist in fairyland?
>>43164234
>>alternatives like Go
>Don't make me laugh. At least you could have said D or Rust.
Yes, but he chose a good language instead
>>43164234
I'm not that guy.
You can't do declarative programming in C++ (or C for that matter).
Java-style as in not Alan Kay style. Call it C++ style if you want, it's still not really "object oriented".
>first 2 years at Uni
that's not enough time to learn C++ aside from how to use it basically - unless you did intensive work outside of classes.
>committee
They probably don't even enjoy using it, but they're afraid to admit that it's of their own doing.
>The new features are what allows the language to become simpler.
Are you high?
Please give an example (I honestly have no idea).
>RAII
I prefer nothing; just plain malloc, realloc and free.
>huge language is good
Why?
>>43164232
C++ isn't a variant of C. It's something which functions the same way as C at a basic level, but has a pile of crap heaped on top.
Forgetting the 30 years would mean I would instantly loose the joy of programming. I'd rather take up another hobby than deal with fucking C++ any version. Good god!
>>43164354
>Go
>good
See >>43161031
>>43164345
Resource Allocation Is Initialization
It refers to the idea of constructors and destructors. It has the immediate benefit of reducing the amount of management and cleanup you need to do manually while simultaneously in languages like C++ giving rise to much more serious problems like aborting on failure.
>>43164353
Templating is fucking awesome.
Metaprogramming - I have no fucking idea what that is.
Multiple Inheritance, in my opinion, implies bad software design. JUST DON'T USE IT.
>>43164360
If you want the things that C++ offers but which C does NOT offer... you basically have to write them in a way that becomes C++.
Personally, I really like how C++ does things big-picture-wise... but when you have to keep up with all the backwards compatibility it looks like a huge pile of shit, yes.
>>43164384
Can you give an example?
>>43164345
Automatic allocation and release of resources through constructor/destructor.
>>43164400
An opened file automatically closes when it goes out of scope.
A unique_ptr deallocates its data when it goes out of scope.
>>43164395
>in a way that becomes C++
I only want some of the things offered by C++, so I've written them and I regularly use them.
The things that C++ offers, coupled with having to use that makes me feel bad. C++ is badly designed and it's just too much. Most of what they added to C was shit.
I wouldn't have as big a problem and I wouldn't whine as much - if only C++ weren't based on C or started with the premise of some holy superset which makes your life easier. It doesn't.
>>43164201
Thisthisthis
>>huge language
>Good.
I am too lazy to read the rest but holy shit
>>43164360
>I prefer nothing; just plain malloc, realloc and free.
Then you must be retarded.
RAII is a zero cost abstraction with nice benefits - it's something every non-GC language should have.
>>43164386
>Templating is fucking awesome.
If you think that you haven't used a language with real implict type polymorphism
>>43164447
It's something GC languages should have too, but in the words of Our Lord Bjarne "If you want to stop leaking memory... stop leaking memory."
>>43156203
Lua would be a scripting language used on top of an "engine", no? I could be wrong.
>>43164447
>you must be retarded because you don't think that a certain thing is necessary
Sure
>>43164454
And how would that be type safe at all?
C has something that C++ will never have
It can be implemented by one person in a very short time
>>43164477
I bet you also think functions are necessary.
>>43154977
There are C# libraries that offer access to lowest level DirectX and OpenGL that couldn't be thinner.
The overhead through C# is minimal (claims go from 1% to 5% performance loss).
DirectX
http://sharpdx.org/
OpenGL
http://www.opentk.com/
Magical multiplatform
https://monogame.codeplex.com/
Bastion, Fez, and Transistor were made with it!
>>43164490
They aren't.
Although I think they are more useful and desirable than RAII.
>>43164479
You would know if you had read a book about theoritial CS, most of these things are implemented in functional programming languages like haskell (a language with a much better type system than C++, implict polymorphism and implict static typing)
What is wrong withstruct Object{
Object(params);
~Object(){
cleanup
};
}
Object::Object(params):variable(param){do initial stuff here}What is wrong with C++ cleanup and construction?
Especially if everything is kept in scope..
>>43164477
You are retarded for prefering an objectively inferior way, yes.
It's like preferring manual register allocation when it's pretty much a solved problem - compilers can allocate them optimally these days.
Similarly emitting automatic calls to malloc/fopen/create_mutex paired with free/fclose/destroy_mutex is dead simple with zero overhead for a compiler - also more robust since the compiler can easily know all exit paths and guarantee that free call is always made.
>>43164454
What the fuck did you just fucking say about me, you little bitch? I’ll have you know I graduated top of my class in Computer Science, and has been involved in numerous projects for multi-national corporations, and have made over 300 confirmed applications. I am trained in real implict type polymorphism and I’m the top programmer in the entire US. You are nothing to me but just another code-monkey. I will hack you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of developers across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your superior languages. You’re fucking dead, kid. I can program anywhere, anytime, and I can type in over seven hundred languages, and that’s just with my bare hands. Not only am I extensively trained in C++, but I have access to the entire Library of Boost and I will use it to its full extent to program your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little “clever” comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn’t, you didn’t, and now you’re paying the price, you goddamn idiot. I will shit fury all C and it will drown in it. You’re fucking dead, kiddo.
>>43164525
Not him
>malloc
Why not use a language with implicit memory managment then?
>fopen
RC can be used to auto-fclose it
>create_mutex
Use a message passing library
>>43164525
Okay, you got me. You were a little mean, but I understand.
RAII can be a good idea - but are the existing implementations reliable? More reliable than I could be with free?
>>43164555
Yes, and easy.
>>43164542
>I graduated top of my class in Computer Science
>and has been involved in numerous projects for multi-national corporations
>just another code-monkey
>am I extensively trained in C++, but I have access to the entire Library of Boost
Parts that made me laugh
>>43164571
and slower
>>43164553
>Why not use a language with implicit memory managment then?
Because you want efficiency.
RAII alleviates most of the problems with manual resource management but keeps the same efficiency and level of control (deterministic cleanup)
>RC can be used to auto-fclose it
Which would be a form of RAII.
>Use a message passing library
Someone has to implement that library using OS level primitives.
>>43164591
No, not measurably. It's all compiler optimizations now, the actual machine code isn't any different.
>>43164604
RAII is slow and bloated. Manual malloc and free is better.
>>43164591
How are they slower?
>>43164625
>RAII is slow and bloated.
Nope, it's no overhead at all.
>>43164604
>Because you want efficiency.
Implicit memory managment can be just as efficient, especially if you are using modern technics like compile-time GC
>Someone has to implement that library using OS level primitives.
Messages are primitives in non-shit OSes. Even linux and windows have them
>>43164386
Multiple inheritance is fine as long as you do it like Java, where you would only have one "main" thing to inherit from, and the other things are classes with pure virtual functions or whatever it's called (interface keyword in Java).
>>43164626
>>43164641
The C++ standard does not force a compiler to make a optimisation, it depends on the implemetation.
Saying that RAII is no overhead is like saying that everything in a language is not overhead
Is RAII just reference counting?
>>43164668
C++ doesn't have interfaces per se.
Its "interfaces" are inherited like normal classes.
>>43164625
NO BLOAT
NO SLOW
ALL HAIL DENNIS RITCHIE
>>43164706
Pretty much, but it's all under the hood stuff. Implicit calls to constructors and destructors, smart pointer tracking, etc. You don't have to think about it, just werks.
>>43164360
First year at my uni taught me:
>basic syntax, data types, and functions, templates
>structs, arrays, pointers, and memory management
>linked lists
>multi-file project management
Second year taught:
>higher data structures, trees, heaps, hash tables, graphs
>algorithms, sorting, searching, graph algorithms
>STL, sets, maps, streams, algorithms, utilities, time
>inheritance and polymorphism, type erasure (aka interfaces)
I think that's all. I haven't learned anything outside of uni yet, been out for a while.
Of course they didn't (couldn't) teach any C++11 stuff, or libraries like Boost, so we didn't get things like smart pointers or lambdas.
>>43164753
Lambdas in C++ are not real lambdas, they are abominations
>>43164715
Uh, yeah that's what I am saying...
Maybe I didn't explain it right. If you use multiple inheritance as in you only have one main "base class" that you inherit from, and treat the rest of the inherited classes as Java keyword "interfaces", then Multiple inheritance isn't bad.
>>43164386
>Multiple inheritance
What is wrong with
Vehicle->Car->Model
Player->Human->Police Officer->Rank
Wherein inherited classes can be assigned extra features such as an ability to use a gun/lead etc.
>>43164753
>smart pointers
How is the counting for these implemented?
Is the counter/map/whatever initiated as a static global variable or singleton or something?
>>43164742
OPTIMIZED VROOM VROOM
>>43164665
>Implicit memory managment can be just as efficient
No it can't.
We're not just talking about overhead - extra indirections or memory wasted - determinism actually matters a lot for efficiency - you don't want cleanup code kicking in in certain places.
>Messages are primitives in non-shit OSes.
But they still have to be resource managed, and message passing isn't an alternative to mutexes anyway.
This is all irrelevant though, it was just an example of a resource that needs to be managed.
Lots of other things that aren't just memory that a GC cant manage: threads, handles, texture/vertex/buffer objects, sockets, processes, etc.
>>43164780
>Player->Human->Police Officer->Rank
What that doesn't even make sense. A police officer would HAVE (aggregate) a rank, a Rank is not a police officer.
>>43164806
>No it can't.
Sure thing buddy
>>43164706
You can use RAII to implement reference counted objects, but you don't have to use ref counts.
If you don't need shared ownership then a basic wrapper around alloc/acquire in the constructor and free/release in the destructor is enough.
>all this niggers telling the million dollars makers how to make millions
>>43164691
>it depends on the implemetation.
Then you can't say for sure that manual malloc/free will be faster either.
>>43164826
A Sergeant is a Police Officer is a Human is a Player, etc.
>>43164806
>that a GC cant manage
If it is a RC-GC it actually can (but it may need special handling in the lower level)
>>43164826
True
I was thinking more along the lines of a title such as "Sheriff" although that could be better implemented waaay fucking better, the
Player->Human->Police Officer still makes sense though
>>43164863
Okay, that isn't multiple inheritance...
>>43164858
You can't be sure for anything but by design it has more possibility that it will be faster.
>>43164899
>but by design it has more possibility that it will be faster.
Nope.
Templated smart pointers knows the size and type of the object you're trying to allocate, this opens up the possibility of more fine grained alignment and allocation control per type via template specialization.
malloc() has to assume biggest alignment possible so you will inevitable waste some memory when allocating certain things.
>>43164984
>malloc() has to assume biggest alignment possible so you will inevitable waste some memory when allocating certain things.
source on this?
>>43164785
shared_ptr typically stores a ref count together with some other data in a block together with the actual data pointer.
unique_ptr has no ref count.
>>43165007
malloc() has no type information, malloc() has to be able to allocate data suitable for any C data type, put those together and you are left with the only choice of always choosing the largest alignment.
>>43164872
Inheritance, probably polymorphism but you're right not multiple. Probably if he divided it into Organism, Characteristics, and then he derived the Human part from it.
>>43164984
>not having a system where the size of any "native" type is 1 byte
anyway, ISO/IEC 9899:2011 added aligned_alloc and functions like this were supported in POSIX and other systems long ago
>>43164872
Yeah, if you added a control interface for NPCs/PCs within it could be though
>>43164806
> threads
Userspace threads are indeed managed by the GC, and then you may even map them onto OS threads managed by the RTS. If you're not using userspace threads then you ought to try it. They're awesome.
> handles
Disregard Windows, acquire peace.
> texture/vertex/buffer objects
Since we're clearly in graphics land now, these are integers, just like file descriptors
> sockets
File descriptor. If you cannot manage these easily in your code, you're doing it off the charts wrong.
> processes
Those are async like OS threads and require interaction through things like SIGCHLD. How on earth would you manage them with RAII?
>>43165303
>Userspace threads are indeed managed by the GC, and then you may even map them onto OS threads managed by the RTS. If you're not using userspace threads then you ought to try it. They're awesome.
Based R.. dissagrees! https://stackoverflow.com/questions/14368391/which-green-threads-libraries-are-available-for-c-that-can-match-the-performance/14369632#14369632
>SIGCHLD
Signals are cancer, rob pike agrees
Not him btw
>>43165336
Damn, meant to quote only the
>If you're not using userspace threads then you ought to try it. They're awesome.
>>43165164
Even better example is
Aircraft::Plane
Plane::HumanControlsforPlane
Plane::AutopilotandAIControls("AIcontroltemplate.txt")
Plane::Model
Model::Physicsrepresentation
Model::Renderingrepresentation
Model::Armament for dynamically changing payloads etc with rendered object generation etc.
>>43165336
Also
https://stackoverflow.com/questions/3126154/multithreading-what-is-the-point-of-more-threads-than-cores/3126974#3126974
>>43165336
I tried using OS threads but it turned out they weren't green after all. I could only make about 32000 of them on linux before the I hit the PID limit (yes, PID limit) and was unable to spawn any more processes in any of my shells. At around 32k threads I also learned that linux had allocated ~600MB of memory (not counting silently overcommitted memory here) despite me only having asked for 32272*2kB worth of stack.
OS threads suck ass on linux at least and considering that I'm just using fenv and setjmp to switch between tasks requiring exactly 0 syscalls and I malloc my stack which only requires syscalls when there's not enough heap, they're much much lighter than OS threads apparently.
And yes, signals are cancer.
>>43161707
Depends on what you want. Typically you can get 30 FPS out of a pygame game, but if you optimize the code (i.e. make it confusing and unreadable), you can squeeze 50 out of it.It's just more meant for android games and the like, which it can do beautifully. There's even a pygame package that's specifically for implementing python games in Android
>>43165303
>Disregard Windows, acquire peace.
Or actually solve the problem elegantly on all platforms.
>File descriptor. If you cannot manage these easily in your code, you're doing it off the charts wrong.
Memory. If you cannot manage this easily in your code, you're doing it off the charts wrong.
>>43165303
>Userspace threads are indeed managed by the GC
Again, who implements the GC and the user threads?
>Disregard Windows, acquire peace.
Meant as a generic term, your custom objects or whatever.
>Since we're clearly in graphics land now, these are integers
>File descriptor.
Yes?
> If you cannot manage these easily in your code, you're doing it off the charts wrong.
Reality shows that most people can't, as evident by all these memory and resource leaks everywhere.
But that's not the point, RAII is still easier at no cost, you'd have to be brain dead not to use it.
>Those are async like OS threads and require interaction through things like SIGCHLD.
Signals considered harmful.
>>43165452
It's impossible to be zen when you have to WaitForMultipleObjects.
>>43165303
>these are integers, just like file descriptors
I hope you don't seriously think that if you forget to close() a file descriptor all you're leaking is an integer.
>>43165602
Maybe I should try close()ing a descriptor I get from GL. Would be fun to see what happens. Joking aside, of course not, it just means that they're absolutely trivial to pass around unlike if you were to wrap it in a C++ class and reference count it and that if it's not immediately obvious when and how you call whatever close function is necessary then you need to rethink your program and not the way you handle resources.
>>43165653
I think you don't understand what resource management is about...
Most resource classes will effectively just be a pointer - how 'easy' those are to pass around is not the point.
What matters is establishing ownership ans if you intend to pass it around you need to sort out how long should it live, who cleans up, etc.
Doing this automatically through code enforced through an interface has massive gains for reliability and code correctness purposes, and C++ happens to strike a pretty much perfect balance in terms of efficiency/control and ease of use.
It's definitely one of C++'s biggest strengths.
>>43165653
And? How is manually closing a file descriptor better than guaranteeing that all open file descriptors are closed? If it's trivial and can be mechanically done by the compiler, I shouldn't have to waste my time doing it.
>>43165715
NOW it does, it used to be horrible unless you hacked together your own resource handling that differed from everyone else's own hacked together implementation.
Honestly, C++11(+) is such a new creature it shoulda got a new name.
>>43165745
>NOW it does
No, it always did.
RAII has been possible pretty much since C++'s inception, the only feature required are constructors/destructors and templates for making it generic.
>>43165715
I'm sorry butstd::mutex lock(mtx);
do stuff
is decidedly more confusing thanlock(mtx);
do stuff
unlock(mtx);
for the very simple reason that the second one gives you better insight into what the hell you're doing. Especially when you get into situations where you don't want a recursive mutex but you call your function recursively.
>>43165741
If you want to be pedantic about it you can just exit(whatever) and the OS will close all your fds. This is about doing it at runtime and frankly using a structure like this completely nullifies the need for a Xbox-sized resource management class.struct iothread { int fd; ... };
void iothread(void *arg)
{
struct iothread *t = arg;
char buf[8192];
ssize_t r, i = 0;
while ((r = read(t->fd, buf+i, sizeof(buf)-i)) > 0) {
i += r;
do stuff
}
close(t->fd);
free(t);
}
void mainthread(void *arg)
{
(void *)arg;
int fd, lfd = announce("tcp!*!80");
while ((fd = accept(lfd, NULL, NULL)) >= 0) {
alloc and start new thread
}
}
>>43165838
>is decidedly more confusing than
Well that's your opinion, and I doubt many share it.
>for the very simple reason that the second one gives you better insight into what the hell you're doing.
What insight?
With RAII:
Allocation is done at initialization.
Release is done at scope end.
That's it, no more magical than that.
>Especially when you get into situations where you don't want a recursive mutex but you call your function recursively.
RAII handles that perfectly, it's for manual calls it gets really confusing because now you have multiple paths of exit that needs to be accounted for.
>>43163541
its syntax and typing. easy to pick up but quickly get convoluted for bigger projects.
also the language name itself.
>>43155864
post your game appstore/playstore link, anon
we may actually pay for it.
>>43165838
That's like saying unique_ptr is confusing because you don't see the delete call. It's only confusing because you are not used to it.
I don't want to exit my program everytime I close a file.
>OS will close
I don't think this is standard. RAII close works on every OS without fail.
>>43165838
>This is about doing it at runtime and frankly using a structure like this completely nullifies the need for a Xbox-sized resource management class.
Who said anything about an 'Xbox-sized resource management class'?
This is what unique_ptr compiles down to:struct ptr {
void *p;
ptr(size_t n) { p=malloc(n); }
~ptr() { free(p); }
};
The constructor and destructor call are inlined, the emitted machine code is just the malloc and free call.
Simple but very effective.while ((r = read(t->fd, buf+i, sizeof(buf)-i)) > 0) {
i += r;
do stuff
}
And when read() returns an error?
What if 'do stuff' fails?
Yes, when you write useless, contrived code most abstractions may seem 'useless', but that's not the case for real world code.
>>43165972
You claim to write real world code but you think thread-per-connection is contrived and useless. I'm confused. Has the meaning "real world" changed in the last couple of years? The whole point of thread-per-connection is that it's incredibly simple, powerful, and in fact quite a bit faster than event based IO at the cost of memory.
>>43164472
It's a pretty popular choice for making game mods (Look at gmod for example) however Love2d (look it up) allows you to make a full game with lua.
>>43166040
I think he means your example is useless and doesn't show anything.
It's funny how this conversation went from "RAII is not needed" to "RAII is useful in some cases" to "hurr RAII is confusing"
C programmers are truly cancerous luddites. The type of morons who think it's better to write code by hand that a compiler could generate for you to eliminate resources leaks. You are retarded beyond words.
>>43166040
>You claim to write real world code but you think thread-per-connection is contrived and useless.
Your particular example is contrived.
There's no error checking, there's no non-trivial workload or resource sharing.