[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Why is almost every 3d game engine written in C++ and not Java?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 183
Thread images: 18

File: images (2).jpg (9KB, 288x175px) Image search: [Google]
images (2).jpg
9KB, 288x175px
Why is almost every 3d game engine written in C++ and not Java?

Sure there are Java game libraries which port C++, but that's not the same thing.
>>
Game devs are fucking retards, they're not skilled enough to write their own engines, and their naivete leads them to write hundreds of layers of garbage abstractions, but hey, at least they end up with a game at the end, the skilled programmer who enjoys programming never finishes a game.
>>
>>60892602
I've actually tried reading up on how to even begin writing my own game engine and there is next to zero information that is visible online
>>
Yeah I really wonder why they're using an unmanaged language instead of a managed language that runs significantly slower
>>
>>60892668
The reason C++ is used for real time systems is because it will perform reliably for every run of the program. The reason that minecraft would drop to 3 FPS for a second is because the GC was cleaning up.
>>
>>60892640
Download a book
>>
>>60892668
Lol Java is faster than C++

>>60892691
>I want a programming language that doesn't use garbage collection and takes up a bunch of system space in the background because it's not manageable
>I like downloading IDEs that are 7gb in size
>>
>>60892691
You're also running through JVM, which is going to be slower than c in all instances
For Java you have to compile it into Java bytecode, which is then interpreted and dispatched to some handler somewhere that knows the translation of that bytecode into assembly
It just adds layers to every call you make
>>
>>60892745
So you literally don't understand how computers work
Nice posts
>>
>>60892777
C++ is only faster on Windows
>>
>>60892805
C++ doesn't exist on other OSes, everything is written in Python and Perl
You know that the Linux kernel was written in nodejs?
>>
>>60892814
epic troll
>>
Both languages are terrible to write for

That being said C++ has better libraries as a general rule that have about 20+ years of development time behind them
I mean just use DirectX or OpenGL once and you'll learn the headache but also the reasons for the headache and why you would choose that headache instead of something else

I've written a game engine from scratch in Java
I'm going to exaggerate only a little when I say that there was almost 500 lines of code before we had a black box on the screen
Let alone the actual game

It comes down to the libraries
The industry adopting these libraries and sticking with them for so long
The speed of C++ vs Java is a lot less of an issue now days and Minecraft was poorly written, but it wasn't always like that...
Even ten years ago I remember it was a worlds difference
>>
Java is an interpreted language that runs on the JVM, making it an order of magnitude slower than a compiled C++ program. Aside from the JVM, the fact that C++ programs are compiled natively for each specific platform you want to run them on means you can do platform-specific optimization in C++.
>>
auto
>>
>>60892827
>there was almost 500 lines of code before we had a black box on the screen

I'm honestly surprised it was that few.
>>
C
>>
>>60892827
Are you implying there are other languages outside of C++ and Java that could be used to create a game engine that would be a better alternative?
>>
So much misinformation about Java. Actually read a book. The JVM is really good and can be faster than C in certain scenarios. The thing that Java has against it is that at some point, the JVM is going to stop everything and collect garbage, which is not predictable. Which makes it useless for medical equipment, low latency trading engines, planes, cars etc.

t. former C++ High Frequency Trading developer
>>
>>60892884

C#
>>
>>60892905
It literally cannot be faster
You are taking Java byte code, feeding it into the JVM, which is then interpreting one instructions worth, sending it to the processor, regaining execution, then sending the following instruction, etc as the process runs
These context switches are quick, but absolutely nowhere near the speed of actual assembly
It would be like running your code with eflags trap flag set, single stepping and giving an exception handler execution after every instruction
>>
>>60892964
this 2bh
>>
>>60892884
C#, honestly.

Allows you to directly manage your memory and avoid the GC, unlike Java.
>>
>>60892905
Please describe a scenario where Java bytecode running in JVM is faster than it's C equivalent
>>
>>60892640
That's kind of like asking how to make an operating system. There are so many layers of complexity that you can choose to put into your engine. That means there is going to be a pyramid of information available. Lots of stuff for basic stuff, but less and less for more complicated features.
>>60892841
In modern versions of the JVM it's going to be the same speed as a c++ program (keep in mind it will take a little bit longer to start and potentially warm up). The main concern about Java would be the large amount of memory it uses. If you are in 2017 you probably don't need to worry too much about ram.
>>60892905
Wouldn't low latency trading engines be bounded by the network connection to whatever trading terminal / whatever?
>>60892974
The JVM worked that way a long time ago. If I were you I would research what the JIT (just in time) compiler is.
>>
>>60892640
there's a shitton of information available. what exactly are you looking for ?
>>
>>60892983
Did you intentionally make a post that was completely non sequitur in relation to the current context?
>>
>>60893000
like basic shit

every fucking thing wants me to install hundreds of things and know the entire language, everything about the OS, and a bunch of math
>>
>>60893000
I want to know how to make my own rendering engine, the whole deal. I don't want to use any libraries like opengl or unity.
>>
>>60893008
unless you have a minimum of a bachelor of cs/software eng/math or something, you probably cant anyway
>>
>>60893008
Well... Yeah. That's what making an OS entails
>>
>>60892983
not him, but if you'd add all shit java does(checks,garbage collection, type checking, OOP shit like dynamic binding, dispatching, etc) in C the JVM would probably be faster by default default unless you spend years optimizing your C code
>>
>>60893028
nice try, elitist

I'm not falling for that rich man college abraham trickery that says because I didn't spend the school years doing the school, that I can't programming a fucking gaming engine
>>
File: hahahahahahahaahahaha.png (90KB, 179x316px) Image search: [Google]
hahahahahahahaahahaha.png
90KB, 179x316px
>>60893028
>going to school to learn programming
>racking up 50k in uncancellable debt to be a codemonkey
>>
>>60892995
For the JIT to execute at the same speed as assembly, it would require every conditional branch to be pathed, then begin execution at the start
Then it's going to execute at the same speed as c compiled assembly, and the only differences are from compiler optimization when generating the assembly
>>
>>60893017
Just use opengl. What do you want to create your own operating system with its own graphics driver with its own audio driver with your own game engine. As a developer you don't need to make everything from scratch.
>>
>>60893008
1: learn a programming language
2: look into SDL
3: think about how retarded your question is
4: come back and ask a less retarded question

>>60893017
what have you already done/learned/used ?
>>
>>60893111
>1: learn a programming language
All of it? Fuck off.

>>60893111
>2: look into SDL
Why? How much? Which parts?
>>
>>60893119
>All of it?
no, just stop after "Hello World!"
learning a programming language isn't hard and doesn't take much time.
maybe you mistake external libraries as part of the language ? they aren't

>Why? How much? Which parts?
because it's the simplest and most basic library to start with but offers everything you'll need until you actually know what you want/need
you'll notice when you've learned enough of it.
>>
>>60893100
because I want to know how it works from top to bottom
>>
>>60893252
fair point.
do you already know opengl ? how's your math knowledge ? have you done any graphics programming ? how is your C and linux knowledge ?
>>
>>60893270

what does Linux have to do with making a game engine?
>>
>>60893100
>>60893111
>>60893270

I've done 2D opengl before and a little bit of opengl 3D. I just don't like how they do things. There is too much bloat and too much restrictiveness to their code. I mostly have done C, C++ and Java.

I suck at math but so long as I'm not having to do differential equations, I think I should be fine..
>>
>>60893280
jesus fucking christ, you're either 13 or retarded
>>
This is such a complex topic it's hard to type up on my phone, but it's likely not possible for you to know without nvidia/amd hardware documentation
Writing an engine ontop of dxgi/opengl isn't too insane, it's definitely difficult, but creating your own dxgi/opengl requires you to understand how the hardware abstraction layer works, and proprietary info about the devices that you likely don't have
>>
>>60893280
nothing, it just makes things easier because if you want to look into how something is done, you'll have the source available and you can do pretty much everything you want while windows makes it unnecessary hard
>>
>>60893290
Just quick sanity check. You were doing modern opengl (like above 3.0) and not legacy stuff from back in version 1.0. The legacy stuff is easy to spot because it uses stuff like glbegin and glend. Modern opengl focuses more on using shaders.
>>
>>60893290
ok, how low do you want to go ? is libdrm low enough ? or the kernels drm module ? or do you want to do _everything_ yourself ?
>>
>>60893330
Yes, legacy stuff

>>60893349
I don't know what that other shit is, desu
>>
>>60893373
https://github.com/mirror/reactos/tree/master/reactos/dll/directx/d3d9
Have fun
>>
>>60892640
read Game Engine Architecture - Jason Gregory
>>
>>60893373
>I don't know what that other shit is, desu
ok then i'd suggest start with mesa and work your way down from there / take it apart
or go the other way round: get some microcontroller (the more memory the better) and a display, and start programming whatever you need ?
>>
>>60892580
>Java

Useless for games due to Java by design will not ever let you see hardware, thus shit perf for games.

>C++

Like C, deprecated by Rustlang. Unless you need to build on engines which has not yet been ported to Rust as of yet (unfortunately most of them). Expect C and C++ to be dead in the gaming industry within 5 years.
>>
>>60892580
Because Java is god awful.
>>
>>60893028
>>60893028
>nless you have a minimum of a bachelor of cs/software eng/math or something, you probably cant anyway

I disagree
https://en.wikipedia.org/wiki/Markus_Persson
>>
>>60892640
Grab the Quake3 sources and learn from the Master.
>>
>>60892884
C
>>
>>60893062
>2017
>Not getting a job that offers paid tuition benefits
>>
>>60893432
>muh rust
>>
>>60893493
it's 2017 gramps, nobody pays you to learn anymore, and nobody wants to pay for your schooling.
>>
>>60893506
Tell that to my employer you poorfag
>>
>>60893119
>All of it? Fuck off.
C can be learned in a week.
>>
>>60893459
yea but keep in mind
>"He began programming on his father's Commodore 128 home computer at the age of seven."
>And had a job in porgramming for several years before Minecraft

I don't think OP has had even a year of programming experience
>>
>>60893432
i wanna have whatever you just smoked boy.
>>
>>60893496
>All of the speed and precision of C an C++, but safe, secure and updated to the 21st century.
>All of this at the small price of people on /pol/ calling you a cuck

It's the deal of a lifetime
>>
>>60893017
>libraries
>opengl or unity

you clearly have no idea what you are talking about
>>
>>60893017
https://hero.handmade.network/episodes
good luck
>>
>>60893432
oh boy rusttroll is so funny, let me die
>>
>>60893290
>I suck at math but so long as I'm not having to do differential equations, I think I should be fine..
Not like you'd want physics in your game, anyway.
>>
>>60892814
>Linux kernel was written in nodejs?
I'm certain someone has tried porting it using Emscripten.
>>
>>60894641
>people genuinely recommending this scam
>>
>>60894772
http://jslinux.org/
>>
>>60892580

3D game engines are all about optimization, especially at a lower level. These kind of optimizations can't be made in Java, because you have not an access to hardware.

An god damn, rustfag, you really think that Rust is made for games ? An engine must be optimized, quick. Rust make your code secure. It's a totally different problem.
>>
>>60894791
all the episodes are free to watch. where's the scam?
>>
>>60892983

when bytecode has been JITted to instruction sets that the C++ code was not already precompiled for. That is just one instance.
>>
>>60892884
Swift and Rust
>>
>>60894865
What the fuck is this thread
>>
>>60894883
Memory safe compiled languages without a GC.
What you don't like?
>>
>GC pauses
-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode
>>
>>60894824
You're better off reading books and articles from active professionals on specific topics instead of sifting through hundreds of hours of someone's hobby project

Handmade Hero is written by an 90s game tool ex-programmer, and the guy is just milking his tiny retarded audience for patreon shekkels while writing 90s-style code in his own C++ "dialect" and filming it
>>
>>60894915
Memory safeness obviously make your engine slower.

Why use memory safeness in game engine when you can use C++ which is a lot more optimized than Swift or Rust ? It's a nonsense.
>>
File: thewitness1280jpg-19c3cd_1280w.jpg (282KB, 1280x720px) Image search: [Google]
thewitness1280jpg-19c3cd_1280w.jpg
282KB, 1280x720px
>>60894951
>You're better off reading books and articles from active professionals on specific topics instead of sifting through hundreds of hours of someone's hobby project

he is an active professional. he worked on the witness
>>
>>60894984
>Memory safeness obviously make your engine slower.
>obviously
Explain.
>>
>>60895030
even if he explains that he still needs to prove that the performance loss from memory safety isn't negligible
>>
>>60892745
>Lol Java is faster than C++
In certain handpicked trivial numeric benchmarks that don't represent reality. If you're lucky and the JIT compiler is warmed up and you're not in a collection cycle.
>>
>>60894997
Did he work on anything else in past 15-20 years? Fact that blow hired him doesn't really mean much since blow isn't afraid to burn his own money
>>
>>60892905
This, throughput matters less than latency in games.
/thread
>>
>>60895064
I think you guys missed a point I made. Those languages handle memory without garbage collector. Especially Rust does it compile-time. There is no perfomance loss because of that.
>>
>>60892580
The biggest problem with java is the garbage collection, if it takes more that a few milliseconds, you will notice it as stutter or frame drops. Therefore, GC makes it quite impossible to achieve a stable and smooth framerate.
>>
>>60895030
You can't assure memory safeness with static analysis only. Rust is very efficient for a memory safe programming language. But C++ is more efficient, period.

In the game industry, and especially for game engines, latency matters a lot, optimization too. But they have enough money to pay bugshunters and shit. They don't need memory safe language, it's not the right tool.
>>
>>60895078
he worked on a game released last year that has 500k owners on steam. it doesn't matter what else he has done or what was the reason blow hired him. ironically, Blow writes the same "90s-style code in his own C++ 'dialect'" as Muratori
>>
>>60894997
seconding this
he may be a good programmer but his method of making games is so ridiculously obtuse it would be stupid to recommend a beginner start by watching casey's videos
he's put out hundreds of videos without making a simple, playable 2D game
>>
>>60895133
meant to reply to this post >>60894951
>>
>>60895133
but I wasn't recommending his videos as a "how to make a game tutorial". the guy asked
>I want to know how to make my own rendering engine, the whole deal. I don't want to use any libraries like opengl or unity.
>>
>>60895130
>he worked on a game released last year that has 500k owners on steam
How is this related to his programming skills? Undertale has 2.5 mil owners on Steam, does it mean that Toby Fox is 5 times better programmer than Casey?

The Witness didn't even have menu for tweaking graphical settings, not sure if they've added that post release
>>
>>60895133
>>60895162
and the point wasn't even for the guy to watch all the videos and learn, but just to show him that he needs to reevaluate his objectives and rephrase his question

>>60895174
one is made in gamemaker and the other is done from scratch
>>
>>60892580
>why are game engines in C++ and not Java
>not Java
>fucking ENGINE IN JAVA
WELCOME TO /g/ TECHNOLOGY THIS MUST BE YOUR FIRST DAY HERE SORRY WE RAN OUT OF ORIENTATION GOODIE PACKS PLEASE HAVE THIS METAL ROD AND SHOVE IT UP YOUR ASS.
>>
>>60895162
if someone wnats to make a game engine and doesnt want to use opengl/directx I recommend they buy a brain first
>>
>>60895200
https://www.youtube.com/watch?v=WZ_alfF5Zt4

>>60895221
no, they just need to use the internet to learn why they're wrong
>>
>>60895248
>https://www.youtube.com/watch?v=WZ_alfF5Zt4
Out of curiosity: Any samples that involve more entities?
>>
>>60895301
>15 FPS
>>
>>60895190
>one is made in gamemaker and the other is done from scratch
That doesn't really answer my question

How does number of owners of the game he worked on correlate with his skills? Because it runs after they've spent 8 years working in an echo-chamber on a technologically mediocre engine?

Lugaru was written from scratch in an echo-chamber like that, have you seen the quality of Lugaru's code? Well the game works by the way, and has almost 200k owners on Steam

Seriously, if you want to learn something, learn it from people who work in the industry or related to it (e.g. 3D graphics) and are not out of touch with current techniques. Watching Handmade Hero videos is self-harm.
>>
>>60892580
>Java
VM, shit's slow yo.
>C++
Compiled, shits fast yo
>>
>>60895248
>fucking ENGINE IN JAVA
im not saying its impossible. It's just stupid and a waste of time and effort.
>>
>>60895361
java is compiled
>>
>>60895378
Java can be compiled, making it slower than actual VM version, but who cares, right?
>>
>>60895387
Java bytecode gets compiled on the VM

>>60895366
there are tons of people who wasted time and effort trying to write their own engine in c++ too. it doesn't have anything to do with java specifically

>>60895344
>How does number of owners of the game he worked on correlate with his skills?
I don't give a shit.
I was just responding to a claim that Muratori isn't an active professional which he obviously is because he has recently been working on a game that makes money.
>>
>>60895419
and VM is slow, amazing how you are regurgitating my original point.
>>
>>60895427
source?
>>
>>60895431
https://www.amazon.com/Java-Virtual-Machine-Troy-Downing/dp/1565921941
>>
>>60892884
Fortran
>>
>>60895463
Let me guess, you faggot picked the first link you just found. And it was even a 3-star link.
>>
>>60895419
>he obviously is because he has recently been working on a game that makes money
I've explained why it doesn't count

Being hired only once in 20 years to work on a vanity project with no real deadlines by some eccentric dude isn't the same as working in a real environment with a bunch of other professionals who won't give you leeway to write code the same way you did 90s years ago because the language was in a different state and hardware was different
>>
File: e38.jpg (40KB, 640x527px) Image search: [Google]
e38.jpg
40KB, 640x527px
>>60893062
>he doesn't have free studies in his country
What do you pay taxes for?
>>
>>60892755
??? Hotspot(A JVM) compiles JVM bytecode to assembly just-in-time
>>
>>60892580
C++ is suited to be a domain specific language.
Java is not.
Physics engines are usually written by people who understands physics and people who understand physics use math.
It is not possible to make a good math library for java, the language is not made for that.

Another thing is speed of the applications, C++ is faster.

The last thing is available libraries.
The more stuff you have available, the less work you have to put in yourself.
C++ and java is used by a lot of people so this is not a factor in C++ vs java, but it explains why you don't see a lot of the new hipsters languages being used.
>>
>>60895585
Yeah, no operator overloading sucks royally for maths.
>>
>>60892905
Also high startup costs i'm guessing, consider short-lived processes like sed, grep, printf and so on. The JVM has to either interpret or JIT-compile the code, both of which might take a significant amount of time compared to the short actual execution.
>>
>>60895677
I would categorize it as making it unusable.
Implementing something like the eigen library in java would not make it as good.
>>
>>60895585
java is good enough with math to be used in mars rovers, high frequency trading software and banking
>>
>>60895780
trading software and banking
is not the same as game physics.
You can make anything in any programming language.
My point is that it is easier to write math heavy functions in C++ and the result is easier to make faster than the java alternative.
>>
File: 1496235063750.gif (66KB, 350x350px) Image search: [Google]
1496235063750.gif
66KB, 350x350px
>>60892827
Am I the only one who likes writing in both Java and C++? Java is comfy because I don't have to think about a million pitfalls and I can just write code without having to deal with bullshit like headers or shitty build systems like cmake. C++ is fun because it allows me to do what ever the fuck I want, giving me full control over my program and providing an insane level of abstraction at near C performance. I have 5+ years experience in both.
>>
File: 1462225515545.jpg (16KB, 268x265px) Image search: [Google]
1462225515545.jpg
16KB, 268x265px
>>60895113
Java with RAII and Smart Pointers would be perfect.
>>
File: john.jpg (208KB, 530x424px) Image search: [Google]
john.jpg
208KB, 530x424px
>>60892602
>>
>>60895780
>java is good enough with math to be used in mars rovers,
Mars Rovers are programmed in C, you dolt.
>>
>>60895113
Doesn't C# also use GC? How come games written in it like Bastion or Transistor don't stutter like minecrap does? Is C# GC non blocking?
>>
Why doesn't Java just allow in the options to manually manage your garbage cleanup? This would shut up so many critics
>>
>>60895932
the GC is not a problem in minecrap at all
>>
File: 1496881313889.jpg (34KB, 657x527px) Image search: [Google]
1496881313889.jpg
34KB, 657x527px
>>60892745
>Lol Java is faster than C++

here's my calling to leave this fucking joke of a board designed to make 12 year olds feel like whizzkids.
>>
>>60895938
It is. I would imagine that every single block is an actual managed object. How else do you explain the constant micro-stutter?
>>
>>60895940
Some Java algorithms are faster than in C++. It's not a slow language.

However, it will be using 10 times the memory
>>
>>60895958
>10 times more memory

is their memory really less efficient? I think in big programs the overhead of the JVM won't make a difference.
>>
File: 1490905725279.jpg (86KB, 800x533px) Image search: [Google]
1490905725279.jpg
86KB, 800x533px
>>60895937
I thought about this for a long time. How hard would it be to fork the JVM and implement manual memory management, destructors, RAII and smart pointers?

>>60895958
The only thing Java does better than C++ is in-lining virtual calls.
>>
>>60895964
There is a joke that says that the real reason Java doesn't have a sizeof() operator is to hide how fucking bloated objects are. Every single instance contains shit like metadata and strings for reflection and other bullcrap. Java will always take more memory than a program written in C++. Always.
>>
>>60895919
and Java
https://www.cnet.com/news/java-runs-remote-controlled-mars-rover/

>>60895951
https://www.reddit.com/r/programming/comments/2jsrif/optifine_dev_minecraft_18_has_so_many_performance/
inb4 reddit
>>
>>60895951
idk anon, maybe with SHIT CODE?
http://asie.pl/Projects/Minecraft/Mods/FoamFix/
>>
>>60895937
>Changing language fundamentals in "the options"
Alternatively, people could just use a language designed for manual memory cleanup. Like for example C++.
>>
>>60895992
>cnet
>2004
Fucking moron.

>minecraft
Similar allocation strategies would work in C++ without the massive slowdown.
>>
>>60893008
>like basic shit
So you want to write something incredibly complicated which requires a fair bit of mathematics and in depth knowledge of the language you are working with, but need help with the "basics"?

That is not how it works, dude.

>>60893028
Essentially this, although you don't need to actually have the degree, but you should have the knowledge required for such a degree.
>>
>>60892745

> Lol Java is faster than C++

I thought this was a tech board, not a retard board. I'm out.
>>
>>60895531
guns mostly, quite a bit on golfing trips, and whatever's left goes to big corporations because we need to make sure theres a safety net for these big businesses to support the free-market. free college or healthcare is communist bullshit, and if you were to give citizens a safety net then that would be against the free market.
>>
>>60896027
>Fucking moron.
the source is reuters
http://edition.cnn.com/2004/TECH/space/01/16/space.mars.java.reut/index.html

also
http://www.eclipse.org/community/casestudies/NASAfinal.pdf
http://www.havelund.com/Publications/jpl-java-standard.pdf
>>
>>60894824
He's an anti-oop retard who thinks that shipping one game and some outdated tools makes him an expert, and now preaches to people that C++ and OOP are evil

At the same time every major engine developing studio that has shipped hundreds or thousands of games on their engine is using C++ and adopted OOP

It would be nice if he would keep his opinion to himself and his shitty code in the Witless
>>
>>60893017
https://github.com/ssloy/tinyrenderer/wiki
>>
>>60895979
>Every single instance contains shit like metadata and strings for reflection and other bullcrap.
This is not true. Every object has a header that is exactly 16 bytes on a 64-bit machine. Not trivially small, but hardly that much more than a malloc implementation that aligns to 16 bytes (pretty much all of them) for small objects, and for large objects, compressed OOPs actually makes Java use less memory than C/C++ on 64-bit machines.

>Java will always take more memory than a program written in C++.
The reason this is true is simply because of the overhead of having the JVM code and data sit there as well. Also the Eden-gen often takes much more space then is really necessary for some bad reason.
>>
>>60892580
It's easier to program whatever Vulkan OpenGL DirectX shit with C++ than Java.

And 3D engines may actually need the direct memory management and ultra lightweight things C++ allows.
>>
>>60895966
>How hard would it be to fork the JVM and implement manual memory management, destructors, RAII and smart pointers?
Very. Since there's no support in the language for explicitly describing the destruction of an object, you can't do much else than garbage collection when you have cyclic data structures.

>>60895937
>Why doesn't Java just allow in the options to manually manage your garbage cleanup? This would shut up so many critics
Because Java also aims to be secure. You can't manually free your memory while also ensuring no dangling pointers.
>>
>>60896517
that's not a scam. you just don't agree with his opinions on how games should be written
>>
>>60896618
>promises professional-quality code
>it's actually a hobby project
>wants you to pay money for it
>not a scam
>>
>>60896603
>You can't manually free your memory while also ensuring no dangling pointers.
>what are smart pointers
>>
>>60896660
you can pay for the game and for source code access. you can see the source code in the videos before making a decision to buy it. are you trolling me or did the word "scam" change meaning overnight?
>>
>>60896696
>what are smart pointers
Not universal. CPython also has reference-counting on object pointers to implement eager deallocation, but since they don't handle cyclic data structures it implements a complete GC as well.
>>
File: pajeet.jpg (58KB, 629x449px) Image search: [Google]
pajeet.jpg
58KB, 629x449px
>>60895958
>>
File: ss-2017-06-08-19-50-32.png (392KB, 1272x672px) Image search: [Google]
ss-2017-06-08-19-50-32.png
392KB, 1272x672px
>>60897221
>>
I'm looking at learning the SDL, any recommended books or online tutorials?
>>
>>60899249
bump
>>
>>60892580
So why do you want them written in Java? I mean, you totally could but then you are limited to any machine that runs the JVM.

>>60892640
No shit. There isn't "one formulaic way" to pop out a game engine. You have to define in your mind what you really want, break it down into sizable pieces and then code up from there.
>>
>>60892580
garbage collection pauses.
>>
>>60892580
Even in the best case Java is around half as slow as C++. And garbage collection could cause microstutter.
>>
>>60893017
>I want to be able to paint the Mona Lisa
>but I don't want paint or a paintbrush
>>
>>60895133
it isnt meant to be a "how to make a game in 2 hours" type project though. it is one guy working on all the different bits of a 3d game engine that would normally have a dozen or more people working on full time. you dont watch his videos to learn the basics of programming or even game development but to gain a solid understanding of all the different parts of a whole game engine.
>>
Performance plain and simple.

>>60892745

>Lol Java is faster than C++
Java can perform faster on tight loops using primitive types, and nothing else. The second you need anything else, the language becomes a hindrance. In C++, you can have a vector of doubles. In Java, generics are not allowed to take primitives as arguments, so if you need a resizeable container to store said floating point numbers, you need to wrap it in an object type. You're adding an additional unnecessary layer of indirection and completely destroying any opportunity for good cache utilization. In fact, Java's object model is pretty hostile to your performance, because you can't store objects on the stack, and likewise, can't store actual object data inside of another object, just a pointer to it. So if object A contains objects B, C, and D, each of which stores 3 ints, rather than object A containing the space for 9 ints, it contains the space for 3 pointers to areas elsewhere on the heap, each of which containing the ints in question. Even if we ignore Java's garbage collector in evaluating its performance, the amount of unnecessary indirection makes it terrible for complex programs. There's a reason Unity uses C# (which at least has structs) rather than Java.
>>
>>60893432

> Expect C and C++ to be dead in the gaming industry within 5 years.

No they don't.
>>
>>60892640
http://nehe.gamedev.net/

you're fucking welcome
>>
>>60892855
>going to exaggerate a little
I think he doubled the actual number.
A simple YouTube tutorial game engine using OpenGL takes less than 100 lines to show shapes in a resized window.
Might be a bad comparison but bisquit writes his god tier engine in C (again u can find on YouTube) and the whole shebang is a bit over 1000 lines and includes fucking leet shit like realistic light diffusion, next level texture mapping techniques, etc.
If you want to go full autismo with Java 8 shit like muh streams and parallelization, I'd reckon then it would be closer to that 500 mark.
>>
>>60895892
no, you have to pick one language and insult everyone who uses anything else
>>
>>60892640
This isn't like doing web dev where someone will will hold your pinky through everything. You actually have to pick up a book.
>>
>>60892580
Java is much slower. Compare the original minecraft with the microsoft's minecraft for windows 10. The win10 version is many times faster and is written in C++ while the original is in java. Java is definitely not meant for gaming. Examine the runescape too. It was (when I played it last, 10 years ago) a game that performed worse than flash games and desktop games. Also, any client needs to actually install Java on their OS while C++ is compiled for native execution (which, again, is always faster in these scenarios). Forcing players to install bloatware is retarded.
Java also needs more memory. Considering how jews who produce RAM these days have inflated the price I seriously wouldn't recommend anyone making memory demanding games or engines. It would just support the money-grabbing fags.

On a side note, there are a few game engines which let you make java games. But still, java has shit gaming performance. It's just not meant for that.
>>
File: b4a.jpg (17KB, 619x619px) Image search: [Google]
b4a.jpg
17KB, 619x619px
>>60892745
>>
>>60893432
Repeat after me, Rust is a meme.
>Rust is a meme
Good boy.
>>
>>60893062
>he didnt get grants or scholarships
>>
>>60902502

notch is an incompetent fucktard that was working on a pet project of a prototype before it blew up in popularity too quickly before a decent engine rewrite was feasible - assuming notch was even capable of writing a competent engine to begin with, literally every major feature added to the game during the alpha/beta stages were fraught with issues that plagued the game for months to years, from minecarts to redstone to the laughably broken multiplayer netcode issues

ever wonder why features basically stopped being added to the game with any frequency as soon as notch started hiring people? now you now, doing anything modders had been doing for years at that point would have taken serious design considerations due to the legacy game engine, and now you also know why mod after mod can continue to pump out hundreds of hours of content and extensive features - they have next to zero accountability if the game runs like shit with them installed

even amateur modders working for free using reverse engineered client sources were able to implement things like far superior chunk algorithms better than notch could after the point he was earning thousands per week

>Examine the runescape too.

runescape devs in 2007 were far too busy pumping out shitty fetch quests every week and trying to combat bots(badly, one might add) to give a shit about improving the performance of the game, they even went through a phase of purposely destroying the performance of the game in an attempt to stop bots

but sure keep blaming the performance of these two shitty games entirely on java rather than the incompetent devs, game engines or even libraries, whatever helps you sleep at night, but it's not like there's never been a shitty memory leaking performance hog of a c++ game before
>>
>>60902502
>Java is much slower. Compare the original minecraft with the microsoft's minecraft for windows 10. The win10 version is many times faster and is written in C++ while the original is in java.
I'm not saying that Java is faster than C++, but all this argument proves is that an implementation written under huge time pressure by a mediocre programmer (I watched his stream when he was making a Doom clone in Dart so I know this firsthand) is slower than an implementation written by Microsoft employees on a payroll.

>Also, any client needs to actually install Java on their OS
The JRE can be bundled with software (Minecraft, Bitwig and IntelliJ do that, amongst others)
>>
File: fig-runtime-arch.jpg (2MB, 3017x3973px) Image search: [Google]
fig-runtime-arch.jpg
2MB, 3017x3973px
>>60892640
u realize how much a giant task this is for one man? u wont finish it in a decade, even if you do its templeOS quality.
>>
File: Untitled.png (8KB, 308x151px) Image search: [Google]
Untitled.png
8KB, 308x151px
>>60902967
>even amateur modders working for free using reverse engineered client sources were able to implement things like far superior chunk algorithms
sure, while breaking compatibility with everything else
Also, what you said about shitty C++ performance hogs couldn't be more true, a great example is the league of legends client(the client handels chat, lobbys etc. and launches the actual game, the game itself is written in C++). It used to be bloated and shit Adobe Air(flash for desktop apps). Everyone was like wah wah adobe air is shit stop using it. Then finally the new, c++ based client got released...
>several processes
>way more of an resource hog than the old client
>probably eclipses the actual game at this point
like, fuck
That was written from scratch, so you can't even argue with shit legacy code. But i haven't even told you the best part. Several years ago, way before the C++ client 1 guy wrote his own client, pic related. It was shut down by riot games within a few dozen hours, and they hired its author. None of his code was ever seen again.
>>60903506
Yeah, a rewrite is faster shit legacy code, irregardless of language.
>>
File: c.png (312KB, 500x556px) Image search: [Google]
c.png
312KB, 500x556px
>>60892580
>Why is almost every 3d game engine written in C++ and not Java?
JVM adds a massive overhead to the performance. By massive I actually mean massive. GCs can halt programs indefinitely as well.
>>
>>60892580
Java has shit built-in graphics libraries so most people end up using LWJGL which I've used and personally don't like.
It's a massive fuck around mainly because the developers suggest you do everything like this:

public void print_maximum_texture_size(){
try(MemoryStack stack = MemoryStack.stackPush()){
int value = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, value);
System.out.println("Max texture size: " + value);
}
}



to avoid memory leaks.

In C++ you can do the same exact thing by simply typing the following:

void print_maximum_texture_size(){
int value = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
std::cout << value << std::endl;
}


The more shit you leave on the JVM heap the more time the GC has to spend cleaning it up.
You don't have to worry about that with C++ because the variable is already stack allocated and will be destroyed after the function is complete.

It actually gets worse than that in some cases, the LWJGL developers expect you to commonly use these classes called ByteBuffers to pass data from your program to the OpenGL driver and vice-versa, and sometimes you need to flip the buffers and sometimes you don't.
In C/C++, the languages OpenGL was meant to be used with, you can simply use pointers.
>>
>>60906438
Sorry I made a bit of a mistake, here's the corrected version:

public void print_maximum_texture_size(){
try(MemoryStack stack = MemoryStack.stackPush()){
IntBuffer value = stack.mallocInt(1);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, value);
System.out.println("Max texture size: " + value.get());
}
}

>>
>>60893432
Is there an OpenGL binding for Rust yet?
>>
>>60899249
They have some here:
https://wiki.libsdl.org/Tutorials
>>
File: 1419876112764.jpg (68KB, 884x800px) Image search: [Google]
1419876112764.jpg
68KB, 884x800px
>>60892602
Lol, butthurt brainlet.
>>
Because games sometimes need 2 things:
>Deterministic garbage collection
>Data locality
to get that silky smooth 27 FPS

With java you're forced to use a garbage collector and data is probably never contiguous, and you have a giant JVM anchor that you have to make everyone install. JVM is fine for enterprise backend webshit where you dont have to care about hogging memory for speed because everyone just connects via HTTP, but for games people prefer native binaries that just werk.
>>
>>60901810
This.

There's so many fucktards ITT-- including me because I opened this thread after reading OP's butt-fuck-retarded post-- I can't believe I'm on /g/.
Thread posts: 183
Thread images: 18


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.