[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 don't more game developers program in the thinking

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: 258
Thread images: 34

File: 1502983970756.jpg (163KB, 935x799px) Image search: [Google]
1502983970756.jpg
163KB, 935x799px
Why don't more game developers program in the thinking man's language?
>>
File: 1452867656565.png (395KB, 575x429px) Image search: [Google]
1452867656565.png
395KB, 575x429px
>game developers
>capacity for thinking
>>
>>387421583
>Haskell
It will never be production ready, and you know it
>>
rank most comfort shit with you

c++ > java > c > python >c# >> ass shit >> meme web tech
>>
>>387422102
C > Lisp > Ruby > Python > C++
>>
Thread theme:
https://www.youtube.com/watch?v=2IXdEsMfVHw
>>
>>387422102

Java>C#>meme web tech>C++>>>>>structured programming meme languages like C
>>
File: 1384661766148.png (161KB, 400x300px) Image search: [Google]
1384661766148.png
161KB, 400x300px
>>387422102
>c++
>comfort
>>
File: 1397515120008.gif (745KB, 520x293px) Image search: [Google]
1397515120008.gif
745KB, 520x293px
Does this mean /v/ can start having daily programming threads now?
>>
>>387421583
The GPU is stateful, and not a monad. You would know if you could stop jerking off to endofunctors for long enough to call an opengl function.
>>
>>387422365
He's right, C++ lets me express exactly what I want in exactly the manner I want to.
>>
>>387422401
Newsflash, /vg/ has had them since before you started visting 4chan.
>>
>>387422401
Go back to /a/ and /g/
>>
>>387421583
Does it even matter that much when you're making a game? I mean most of the shit you're limited to is dependent on the engine itself
>>
>>387421583
Why don't more game developers program in COBOL?
>>
>>387422523
>Does it even matter that much when you're making a game? I mean most of the shit you're limited to is dependent on the engine itself

How do you think engines are made?
>>
File: 1417646617944.jpg (60KB, 600x569px) Image search: [Google]
1417646617944.jpg
60KB, 600x569px
>>387422484
/agdg/ does not count. That place is full of the worst memeing brainlets this site has to offer.
>>
>>387422365
i hate how i have to baby sit everything on C++, you need to explicitly assign pointers, you need to explicitly destroy objects, etc

its like breathing manually
>>
Whats the best language to learn for someone who wants to make a comfy turn-based strategy?
>>
>>387422523
What matters is making so the lowest settings can be ran on toasters so you can grab that (huge) part of the fanbase, other than that, not really.
>>
>>387422639
And then there's C when even to do simple string operations you need pointers :^)
>>
File: 1502795293512.png (160KB, 440x434px) Image search: [Google]
1502795293512.png
160KB, 440x434px
>>387422560
Why don't more game developers program in PASCAL?
>>
>>387422714
hope you allocated an extra byte for the terminating zero
>>
>>387422641
Depends. Do you want to think or do you just wanna dick about?
>>
so help me anons , i am making a simulation game in JAVA . most of shit is getting near close but currently its based on text. I want to use a graphic library , never developed a game with graphics.

where should i look ,(dont say use unity or anything)

also would be nicer if its easier to convert that later to Android

its fully based on menus and choices , so no graphics ( maybe .gifs as 2D sprite animations )

i developed a gui system for program but it was basic ass shit like using javax.swing with JFrame etc
>>
>>387422639
explicit pointers are awesome and so is scoped object lifetime
C++ might be a mess, but RAII is excellent
>>
>>387422639
If you understand what you're doing you can make smart pointers that are destroyed along with the value they were pointing at when said object goes out of scope.
>>
>>387422717
>Pascal
>Posts SU
typical
>>
>>387422820
Qt
>>
>>387422505
But anime is inherently techloligy. Also, why? /g/ is basically /v/ these days anyway.
>>
>>387422102
>>387422336
>writing mobile app in react native
>backend is meteor
>literally race against documentation changes
>long term memory visibly degenerates
>tfw you are addicted to cutting edge
>tfw your fingers are moving on their own
>tfw you are slowly becoming meme framework cumdump
>>
File: 1489947851725.jpg (43KB, 720x480px) Image search: [Google]
1489947851725.jpg
43KB, 720x480px
This is a humble reminder that learning how to develop your game from scratch (that is, not relaying in game engines such as unity and GMS) will take you closer to deploying a game and beat your competitors.

Because games and game development are so popular, and you are competing against other games for attention, it is in your interest to use more performant tools that allow you to program your game without cutting any feature or depending on closed software.

If you are interested in defeating your main oponents (those using game engines, like the ones listed in the op poster), here are some tips:

- Use efficient and performant programming languages, such as c++, rust or nim.
* cplusplus.com/doc/tutorial/
* doc.rust-lang.org/book/
* nim-by-example.github.io

- Learn algorithms:
* coursera.org/specializations/algorithms

- Learn maths and physics:
* khanacademy.org/math
* khanacademy.org/science/physics

- Learn how to get the most out of your cpu:
* dataorienteddesign.com/dodmain/
* learncpp.com/cpp-tutorial/79-the-stack-and-the-heap
* fgiesen.wordpress.com/2016/08/07/why-do-cpus-have-multiple-cache-levels/

- Learn how to do graphics:
* opengl-tutorial.org/beginners-tutorials/

Good luck.
>>
>>387422825
>Using New
>Using constructors and destructors

Someone explain it to Anon. Save him.
>>
File: file.jpg (82KB, 362x263px) Image search: [Google]
file.jpg
82KB, 362x263px
>>387422946
>/g/ is bassicly /v/ these days and anime is technology
>>
>>387423036
In modern C++ you probably shouldn't use new.
>>
File: arena.png (41KB, 890x820px) Image search: [Google]
arena.png
41KB, 890x820px
>>387422639
If your needs are simple, just allocate a large block of memory and allocate into it like a stack, and pop from it when you're done. Use assertions to make sure that you never get bad references.
>>
>>387422820
wondering same shit.
>>
File: serial_experiments_lain_02[1].png (1MB, 1520x1080px) Image search: [Google]
serial_experiments_lain_02[1].png
1MB, 1520x1080px
>>387423026
At this point you might think that nothing of this applies to you. Please, reconsider it:

- Data-Oriented Design (Or Why You Might Be Shooting Yourself in The Foot With OOP)
gamesfromwithin.com/data-oriented-design

- Pitfalls of Object Oriented Programming
.slideshare.net/EmanWebDev/pitfalls-of-object-oriented-programminggcap09

- common OOP game engine development pitfalls
bounceapp.com/116414

- Three Big Lies
cellperformance.beyond3d.com/articles/2008/03/three-big-lies.html

Think about it in this way: understanding how your computer work might not secure you success, yet it gives you a huge advantage in this race.

You might say that the latest famous indie game done in unity didn't put any effort into engineering at all, but this is only illusory. You cannot see how many hours, days and months the developers behind successful unity (and GMS) games had to put to work around its inherent limitations.

You can say to yourself "I don't need anything else, i'll relay in my luck" or think wisely and increase the likelihood of being success by expending some time learning more about computers.
Everything depends on you.
>>
>>387423026
Humble reminder that game performance barely matters, and there's no way that you as an indie are going to make games that will push the limits of your hardware anyway.
>>
File: VQeJf5V.png (668KB, 490x348px) Image search: [Google]
VQeJf5V.png
668KB, 490x348px
>>387423026
this is meanest troll post in the history of troll posts
>>
>>387423249
Explain why please... fucking meanies
>>
File: 1459165260182.jpg (108KB, 300x449px) Image search: [Google]
1459165260182.jpg
108KB, 300x449px
I'm coding a wannabe game engine in C++ using SDL. Right now I'm on Loonix, it's super smooth, but I'd like keep working on it on Windows.
Thing is, I don't really get the whole deal with .dll, and that WinMain() function remplacing main(). I already had enough trouble having git and gcc working on Windows...

Where can I read about all the intricacies related to developing for Windows? Should I just use an IDE?
>>
>>387422639
It's really time to switch to C++14 anon. If you're still manipulating raw pointers in C++, unless you're in a very specific use case, you're doing it wrong.
>>
>>387421819
They absolutely can. Just not normally.
But you run into that all the time with self-modifying code. (you don't usually reuse the old function you just alloc a new one and throw away the old)
>>387421928
The terminology is very confused.
>that's not real 3D
I think you're assuming something about raycasting you shouldn't.
Raycasting is the general idea of casting a ray into space that might intersect something.
Raytracing is most often referring to the rendering process where you simulate photons (in reverse for optimization purposes) against a scene to render a very fine image.
Raymarching (which you may also have heard of) is like raytracing against implicit geometry. See
https://youtu.be/s8nFqwOho-s (jump to 39 minutes in or something)
It's not defined by vertices or polygons of any kind its just mathematically defined geometry. Raymarching is a method of visualizing this.

That's my understand anyway. I do find a lot of literature to be using raycasting and raytracing interchangeably though.
>>387422484
Are you talking about aggydaggy? Because that's not a programming thread. And it started here on /v/.
>>
>>387423313
sdl's whole thing is platform-independence

if you're initializing your windows and subsystems through sdl then you shouldn't need any specialized code, maybe excepting some compiler built-ins if you use vc++ instead of cross-compiling with your linux tools
>>
>>387423313
why would you change from linux use mint . its literally windows but not shit.

i mean i barely open my windows if im gonna program some c# shit or play vidya (barely do these days)

linux is comfier and faster and better so on
>>
File: furry helps jensen shoot mario.jpg (58KB, 600x655px) Image search: [Google]
furry helps jensen shoot mario.jpg
58KB, 600x655px
>>387422825
>>387422873

im not saying there arent benefits, i say i hate doing it, something like Java automatically collects all the trash, it automatically assigns variables without values to null without the need of dealing with pointers, etc

and at the end of the day theres only a very negligible loss in performance if you are working on a pc made in the last decade

overall i like it better
>>
File: sdl_windows.png (12KB, 1182x257px) Image search: [Google]
sdl_windows.png
12KB, 1182x257px
>>387423313
SDL2 replaces WinMain. You just need to link to SDL2main (on MinGW at least) and include SDL2.dll in your game's executable directory.
>>
>>387423313
Handmade hero might be for you. First 40 episodes implement and explain setting up a game from scratch on windows.

Shouldn't be too difficult really. They explain the winmain and event loop well there.

But since you're using SDL just look up how to use SDL on windows.
I do recommend using visual studio for that actually its a massive resource hog but both mingw and cygwin are just not convenient to work with.
And the VS debugger isn't bad. You'll need it for Nsight when you inevitably have graphics bugs.
>>
if /g/ is so against the progress, why don't you guys have fun on commodore demo programming or something? it's finest form of fun
>>
>>387423306
Learning all that stuff won't give you a better chance at making a good game, having high IQ would.
>>
>>387423498
If you're using C++ you're concerned with efficiency. Garbage collected programs aren't as efficient as manually managed programs unless you have 5 times more memory than your heap size. C++ has good idioms for making manual memory management painless.
I don't see what the problem is.
>>
>>387423498
>and at the end of the day theres only a very negligible loss in performance
>negligible

you don't write in c/++ to get a 5% boost to the program's overall peformance
you write in c/++ to get a 200% boost to really critical pieces of the software that get utterly fucked when gcs/heap allocators/etc. start doing things you didn't tell them to do
>>
Programmers can only think in algorithms. That's why they're more often than not sperglords
>>
>>387422102
Java is shit and you should know it
>>
https://www.youtube.com/watch?v=Qk0ICis0E68
>>
>>387422761
I know what a tagged union is and it's not a tagged union. A tagged union is a datastructure that can hold values of multiple types. What I'm describing is JUST a form of polymorphism.
But this is a pointless discussion.
>>
>>387422820
help me guys

its gonna be awesome shit i promise
>>
>>387423554
In that case i still don't understand what makes Cute a class rather than a variable, other than the syntax.

>>387423487
So the difference is that a function once it runs into the Return (or anything that would terminate it) it "dies" along with anything within it that wasn't passed outside (wether from the Return or pointer fuckery), while a class sticks around, keeps running, receiving and making data available to other classes (objects?) until you tell it to "die"?
>>
File: 1502934373819.jpg (97KB, 1024x730px) Image search: [Google]
1502934373819.jpg
97KB, 1024x730px
>>387423254
>That's a good thing though.
precisely

>>387423170
>this is how structured programmers think

do i need to explain why this is a terrible idea, its better to have 100 variables neatly organized inside the objects that will actually use them rather than have em all over the code, what if a library you download has variables with the same name as yours?
>>
>>387423950
Anon saying things like this in a general programming thread just makes you seem retarded. That kind of binary thinking is ridiculous.
Difficult to believe it's bait even because it's such a poor attempt. Anyone sane would doubt the attempt.
>>
>>387423423
>>387423517
>>387423621
Thank you. From what I understand (I'm pretty new to this, honestly), I'm doing something wrong with SDL, yes? I'll read up on that.
I should've mentioned that, on Linux, I'm working with a a text editor and compiling stuff from the terminal using make. Ideally, I should be able to compile on Windows without touching anything in the code (except maybe the makefile), right?
I that fails, I'll look into Visual Studio.

>>387423446
It's just convenient. My desktop runs Windows for games, and I'm not too fond of dual booting.
>>
>>387423434
What this guy sad
>>387423554

And this one of features that make objects great - they can store all info for processing inside them. In this example class is Cute. Variables a and b are objects, instances of a class. They have similar behaviour but produce different results because of different state.
Classes and objects are used to describe a world with recognisable abstractions. In videogames almost everything us an object, some of them share similar behaviour, all vehicles are ridable, mountains climbable and all women are objects. That's why videogames are inherently sexist.
>>
>>387424034
Cute is a type. a and b have the type Cute. Every variable of type Cute has a variable-within-a-variable named kawai.
>>
>>387424087
that's a very programming thing to say
>>
>>387423865
>>387423879

like i said, i can see the benefits, i respect the language but i dont like babysiting the code
>>
>>387424096
>you're doing something wrong with SDL
You're not getting it to work on windows. That's it.
>>
>>387424171
Instead, a bloated VM is babysitting you.
>>
>>387422595
>agdg is full of 4channers
ftfy
>>
>>387424096
if you want an ide-free existence, look up mingw or cygwin - posix (i.e. unix-like, i.e. what you're used to) frameworks for windows that include gcc, make, and such

having visual studio for debugging is really good. having visual studio litter your directories with its own files is less good, but usually worth it in the long run. you don't have to write it it to debug with it
>>
File: smug primarchs.jpg (189KB, 798x445px) Image search: [Google]
smug primarchs.jpg
189KB, 798x445px
>>387424234
>portability is a bad thing
>>
>>387424171
There's very little babysitting in modern C++. The only times you need to babysit is when you would want to babysit anyway.
>>
File: 1495914558198.png (7KB, 388x140px) Image search: [Google]
1495914558198.png
7KB, 388x140px
>>
>>387424379
C and C++ are portable and don't come with 60MB of bloat.
>>
Is coding fun?
>>
>>387424389
its been like 5 years since i regularly programmed on C++, whats new?
>>
>>387424612
sometimes
>>
>>387424584
>conio.h
>>
>>387424612
not really.

but after coding achieving shit you dreamed of is good

not actual coding
>>
>>387424621
C++11 made RAII actually usable. Also lambdas are nice.
>>
>>387424128
Isn't that equivalent to saying (might be missing some pieces along the way):
a=true;
b=false;
say(a);
say(b);

and the say(bool) function contains a if-else statement and a couple of print statements (one for each case)?
>>
File: 1497773056789.png (230KB, 525x525px) Image search: [Google]
1497773056789.png
230KB, 525x525px
>>387424612
absolutely, is like solving a puzzle but you are free to come up with your own answers
>>
>>387424034
->
>>387424118

That's my standard form. Now look at this:

Class Pretty extends Cute {
bool mature

fuckIt() {
if (!this.mature)
throw 'FBI exception'

if (!this.kawai)
print ('no implementation')

eval('rm -rf /')
}
}
>>
>>387424612
AI is fun to write.
UI feels like twisting own balls, though.
>>
>>387423026
>waste time learning all those stuff
>sales not even 1/20th of games made with rpgmaker with anime tiddies
Stardew valley, undertale all looks like fucking shits and those sold gangbusters.
>it doesn't fair bros
Life isn't. Nothing is. Vidya is more than programming.
>>
>>387424621
Go watch a recent bjarne stroustrup conference talk. RAII and smart pointers for example really help with babysitting.
>>
>>387424774
it might be a good idea to dive back into C++ sometime then
>>
>>387424789
Yes. The key feature is that a Cute can contain several variables bound together, rather than just one. It's like a struct or a tuple.
>>
>>387421583
Messed with haskell for fun, it's entertaining but retarded at the same time.
>>
>>387424859
kys vermin
>>
>>387424789
Imagine that your game have thousands of Cute objects with a lot more then one internal kawai boolean. You can't maintain clear code structure with one branching function, unless you are writing a Grimwah
>>
File: K85ZWV2F_400x400.png (108KB, 400x400px) Image search: [Google]
K85ZWV2F_400x400.png
108KB, 400x400px
If you're a beginner, what's the best way to learn Java?
>>
>>387423026
>be original it will pay the bills
>hottest shit right now is made by a shitty developer that can barely use unreal 3.
Be original they said, imitation and bullshittery will get you closer to dreams then honest work, but it goes back into that old saying work smart not hard. If you can soak fucking idiots all day in terrible smelly shit then why not. PUBG proved that.

I love your spirit though.
>>
>>387424367
I'm already using mingw for gcc, git and make. Is the Visual Studio debug tool the same as in the one in Visual Studio Code?
>>
>>387425048
step 1 is to switch to c# or python
step 2 is to switch to c/++ if the stuff you make needs to go fast
>>
>>387425150
Java's simpler than C#. If you're learning then Java is better.
>>
>>387425048
i say the obtimal way of doing things is

>C
>C++
>Java

C will teach you all the basics of a modern programming language, C++ is 90% C and it introduces object oriented programming, Java is 90% C++
>>
File: 1502890136548.png (97KB, 269x300px) Image search: [Google]
1502890136548.png
97KB, 269x300px
>>387422820
>>387424018
I'd help but I'm not a real programmer. I just do shit in game maker to fill my empty days

What's the game like tho?
>>
>>387425048
download jdk and try to write programs. come on, there is gorillion of getting started tutorials online. just start making things, you'll get better with every problem you solve.
>>
>>387425048
Don't blindly jump into java. Depending on wwhat you want to do, some language will be better suited than others.
>>
>>387425176
>C++ is 90% C and it introduces object oriented programming
You don't really know C++.
>>
>>387424557
false
>>
>>387424836
So this adds on the Cute class (that is attached to "a" and "b") and:
>if !kawai and !mature it prints: Fuck you!, no implementation and throws an exception
>if !kawai and mature it prints: Fuck you!, no implementation
>if kawai and !mature it prints: Uguuuu and throws an exception
>if kawai and mature it prints: Uguuuu

And in every case it deletes everything in the current unix (level? folder? can't fucking understand (or stand) linux so idk what's the proper terminology, but i think it lacks a "*" somewhere)
>>
>>387425181
>>387425207
Which one is right?
>>
>>387425332
whichever one that tells you to not use java
>>
>>387425332
me
>>
>>387425150
>Step 3 switch back to Java, make game that banks off autism fanbases sell to Microsoft for 2 billion dollars
>Step 4 betray friends it's not enough you sold your rights, but sell them too.
>Step 5 Whine on twitter about being rich
>>
>>387424916
So is like, pardon the parallel, a "tag" you apply to variables to tell them "you can do this, this and this" like you would assign people to jobs (you file the paper, you operate the lathe, you sweep the floor AND carry the pieces to and from the lathe)?
>>
>>387425332
It literally doesn't matter, as a programmer you are expected to learn new languages/software on your own very often. Your first one is irrelevant.
>>
>>387425262
ok ill bite, tell me how C++ is not extremely similar to C
>>
>>387425262
I second this.
C++ is way worse than that.
>>
>>387425332
me

when you're beginner programmer, your choice of language has literally no significance at all. start with c, java, pascal, fucking logo, whatever
>>
File: c-baby.jpg (248KB, 808x805px) Image search: [Google]
c-baby.jpg
248KB, 808x805px
STOP ABANDONING ME
>>
>>387425469
>pascal

please dont do this, its a waste of time, you barely learn anything that simple algorithms cannot teach you
>>
>>387425435
by having roughly a billion features and facilities that do not exist in C ?
>>
>>387425412
Yeah. A class describes what variables it can store and what functions it can do with those variables.
>>
>>387425469
Well it's partially true. Choosing a language you can have use of is good though.
>>
>>387425469
How about binary?
>>
>>387425618
yeah of course, duh, but the syntax is almost exactly the same, that was my point
>>
>>387425435
ctors, dtors, exceptions, templates, lambdas, constexpr for a start.
>>
>>387425662
Binary isn't a language it's a format.
You could write code for any language in binary.
>>
>>387424612
Fun as a hobby, suicide-tier as a profession.
>>
>>387425280
fuckIt() don't call say() so no Uguuuu for you

In this example you can see usage of extension to inherit behaviour. If you want to use functions for that it would be a mess - you can store all the data in main function and call other functions that in turn call "parent" function, but you need to transfer all arguments each time. If you have ten levels inheritance and want add arguments - it would be pain the ass to modify. In case of objects you can change progenitor class and everything will be available
>>
File: binary_code.jpg (48KB, 362x356px) Image search: [Google]
binary_code.jpg
48KB, 362x356px
>>387425662
Anyone here actually efficient in manually writing binary?
>>
>>387425763
C++ is a C-like syntax language but in absolute sense C and Java share about as much as C and C++.
There's tons of languages that are similar to C in syntax when we're this lax about what similar means.
>>
File: 274306.jpg (59KB, 640x480px) Image search: [Google]
274306.jpg
59KB, 640x480px
wtf is /g/ raiding /v/?
>>
>>387425763
a lot of languages share this syntax too on a surface level, doesn't mean they're anything alike.
>>
>>387425623
I can see now why it's useful for games then. You can make a bunch of variables called "Orc", "Orc Shaman", "Red Dragon", "Green Dragon" and then slap onto them "tags" (classes) like "meleeAttack", "supportMagic", "massiveCreature", "naturalWeapon" (this one with a "struct" of sorts detailing whether to call classes relative to claws, horns, breath, etc and have them contain variables that determine attack strength and elemental properties).
Did i get it right?
>>
>>387425629
yeah, i obviously don't recommend pascal or logo. but any popular language will be one "you can have use of", no matter if it's java or cpp or python or whatever

>>387425791
i guess you can write bootloader or some other super simple program without any libraries/os integration in hex editor, that's basically writing program in binary

>>387425887
i wrote bootloader hello world, so i'm an expert on the topic
>>
>>387425921
Yes.
It won't stop until you post FizzBuzz in you're favourite language
>>
Because it's easier to write code in imperative languages and the beauty of functional programming just doesn't pay, you only get satisfaction. Crash Bandicoot was written in a variant of Lisp language, which is also functional, but that's because Andy Gavin's a really good programmer (and the rest of his coleagues in NaughtyDog). Besides, when writing a commercial game, nobody will even be able to see the beauty of the code, since it's closed source.
>>
>>387425887

why would you ever want to do that
>>
>>387425763
>but the syntax is almost exactly the same
outside of several >>387425770 counterexamples right here, the thinking that the most defining attribute of a language is its syntax is so mindbogglingly shortsighted I'm genuinely having trouble understanding it

by that logic, python is just c++ with less braces. c# is just c++ without globals. java is just c++ with a few different words.

jesus
>>
>>387425887
I can program microcontrollers and shit
>>
>>387425887
>Is anyone here visiting from the darkest layers of the internet for the split second between fits of nightmarish hallucinations of numbers that never end
No. I wouldn't think so.
>>
>>387425942
You are describing interfaces.
>>
>>387425885
>fuckIt() don't call say() so no Uguuuu for you
I thought, since it said "extends Cute" that it would require the Cute class to be "attached" to the object first (that or Pretty dragged Cute along with it automatically) and thus the "say()" would be added automatically
>>
>>387426007

fuck fizzbuzz, true men do foobarqix in SQL
>>
>>387425901
not really, you can still program structurally in C++, thats impossible in Java

>>387425937
fora new guy, similar syntax can save you a couple of headaches when you are learning a new language
>>
>>387425969
>in hex editor
You can write anything in binary. If you're talking about writing your executables without a compiler in binary that's not all that hard either. My brother did that for a raspberry pi.
But if you mean writing raw machine code I suggest you say that.
>>
>>387425921
turns out there's an overlap between basement-living neckbeards who play video games and basement-dwelling neckbeards who ineptly attempt to make them
>>
>>387426117
Fug. Back to square one.
What would be the "proper" system in the OOP case?
>>
How do you become better at solving complex problems and algorithms when you have average IQ?
>>
>>387425942
You can have one class which is an Orc. And each instance of an Orc will have variables like its HP, its MP, its inventory, what weapon it has equipped, etc. If you want, those variables can be classes of their own. So Weapon might be its own class.

With classes you can also do subtyping. So an Orc might be a subtype of an Enemy, since it has all the behavior necessary of an Enemy. Then you can use an Orc in every piece of code that expects an Enemy.
>>
>>387426237
git gud
>>
>>387426237
You train. You recognize patterns, get used to the solutions to these patterns and adapt them to suit the specific needs of the situation.
>>
>>387426147
>you can't program structurally
I think you mean in an imperative style.
You were only mentioning syntax. Not semantics.
>>387426237
You work harder than others.
>>
>>387425921
/v/ is the new home of /dpt/. Get used to it.
>>
File: SpeakAssembly.png (79KB, 651x241px) Image search: [Google]
SpeakAssembly.png
79KB, 651x241px
>>387425469
Assembly?
>>
>>387426147
>for a new guy, similar syntax can save you a couple of headaches when you are learning a new language

sure, but that's like saying french and italian are 90% the same because they're both alphabetical with verbs and conjugation
>>
>>387426237
algorithms books/classes/whatever exist so that you don't have to conjure them out of the ether yourself, only recognize where one could be useful and integrate it appropriately

you solve complex problems in programming the same way you do anywhere else, by seperating it into a sequence of smaller and more manageable problems
>>
>>387426065
>outside of several >>387425770 counterexamples right here, the thinking that the most defining attribute of a language is its syntax is so mindbogglingly shortsighted I'm genuinely having trouble understanding it


we are talking about newbies here, for them similar syntax can help, of course once you have a good level of knowledge when it comes to programming, syntax hardly matters
>>
>>387426212

Interfaces are a facility of OOP that showcases one of its main features, inheritance
You weren't wrong, he was probably just making an observation.
>>
>>387426364
>when a bait image still gets your blood boiling

fuck
>>
>>387426265
Are subtypes "expansions" of a type (ie: "Humanoid" adds the behavior to equip stuff, "Beast" does not) or not (ie: the whole behavior for equipment, natural weapons, special abilities is defined into "Enemy" meaning that "Orc" and "Red Dragon" only take what they need from it but cannot add anything "new" themselves)?
>>
File: Chris-Sawyer.gif (534KB, 1094x618px) Image search: [Google]
Chris-Sawyer.gif
534KB, 1094x618px
>>387421583
The thinking mans programming is x86 assembly
>>
>>387426325
>I think you mean in an imperative style.
>You were only mentioning syntax. Not semantics.

look, if you move from C to C++, theres a good chance your old code will run with minimal fuzz

if you move from C to Java, it literally wont work unless you rewrite a good chunk of it
>>
Ok I just finished taking a course in Python
What are some exercises I can do to practice?
>>
>>387425942
Yeah you are getting close to a third grader. All living creatures will have a base class

class Creature {
int hp = 5

damage(int d) {
this.hp -= d

if (this.hp < 1)
print ('rip')
}
}

class Undead extends Creature {
damage(int d) {
this.hp -= d

if (this.hp < 1)
print ('can't kill what is dead')
}
}

Undead skel = Undead()
skel.damage()
Creature blob = Creature()
blob.damage()

Now you can have different behaviour based on state, but you doesn't need to check each time for it
>>
>>387426470
Ah, ok.
>>
File: 1361915369945.jpg (9KB, 191x264px) Image search: [Google]
1361915369945.jpg
9KB, 191x264px
>>387426625
>x86
>not RISC-V
>>
>>387426678
fizz buzz
>>
>>387426131
It is inherited but it is not called in this example
>>
>>387422102
RUBY ON RAILS > HTML
>>
>>387426381
well it is easier to learn french of you are italian, compared to learning french if you are chinese

perhaps the "90%" comment was overblown, but thats just semantic, i was simply trying to illustrate what i believe is the path with the least amount of bumps for becoming proficient at programming in java
>>
>>387426585
>Are subtypes "expansions" of a type
Precisely. So a generic Enemy might not have the capability to equip a weapon, but an Orc can. But an Orc must have an attack ability, because all Enemy objects do.
>>
>>387426585

Every subclass inherits the behavior of all its parents and can add it's own, and can also override it's parent behavior if it wants too. For example, you could have a master class "ennemy" that has an "attack" function that by default attacks in melee range right in front of him, and everyone of its child classes would instead choose to have their own attack function that does their own thing.
>>
>>387421583
because C++ makes NENE'S GAME!
>>
File: CS.jpg (23KB, 283x197px) Image search: [Google]
CS.jpg
23KB, 283x197px
>>387426732
>>
File: roll up.jpg (921KB, 3456x1944px) Image search: [Google]
roll up.jpg
921KB, 3456x1944px
>>387426678
It's time, /v/. Show your skills.
>>
>>387426693
How do i access or send information like "you took X points of damage" or "you are at 1HP, do this thing"? I'm used to function and i don't see a clear way to send the argument that gives the value for the damage() function to run.
>>
>>387423959
I can't hear you over the sound of all this money literally thrown at me because I'm Java EE developer.

but yeah, I feel like a whore
really expensive whore
in my free time I like to relax with C++
>>
>>387426949
Enemy my_enemy;
my_enemy.doDamage(10); // does 10 HP of damage to my_enemy
>>
>>387427024
>In my free time I like to step out of the POO bubble and relax with C++

I TOLD YOU OOP WAS SHIT.
>>
>>387426949
Undead skel = Undead()
skel.damage(4)

Arguments are omitted in post you are replying to
>>
>>387426818
its not really semantic, it's arguing the truthfullness of the "90%" number. It's also misleading to newbies, so it needs to be corrected. Most of what constitutes C++ is completely absent from C, and you code very differently from one to the other. You saying that builds false expectations, which is a problem.

I'm not trying to ride your ass on this one but I don't think those kind of statements help newbies at all is all.
>>
>>387427070
*heap explodes*
>>
File: 1477903880895.jpg (17KB, 324x240px) Image search: [Google]
1477903880895.jpg
17KB, 324x240px
Listen little faggot. Have you ever written a compiler, have you ever written an interrupt routine you little faggot? Have you ever written an interrupt routine? You little faggot. No you haven't because you're a faggot, okay. Why don't you go write an interrupt routine, faggot. Haskell- you're fucking in the ocean with some nigger in the deep ocean got no clue what's underneath you. Little faggot. Why don't you go write an interrupt routine. This is an interrupt routine. I wrote my own compiler, it has an interrupt keyword. Does Haskell have an interrupt routine, can you write an interrupt routine in Haskell? With an interrupt keyword, huh? Can you write an interrupt routine in Hask- do you know what an interrupt is? Little faggot. Everything you know about Haskell is something I know about interrupt routines. How bout them apples? Huh? Everything you know about Haskell or Lisp, I know about interrupt routines. Fuck yourself nigger.
>>
>>387427212
TERRY DINDU NUFFIN. TERRY IS A GOOD BOY.
>>
>>387426813
So inheriting just means it has the ability to do stuff of the parent class but if you don't tell it to do it it won't do it even if the conditions would apply?

>>387426845
>>387426828
Ok, i thought since it was a sub-class that everything within it had to be "contained" by it's parent class (like a subset of a set in mathematics)

>>387427114
I see
>>387427060
>my_enemy.doDamage(10);
Wait, how does that link to damage(int d)?
Can you "expand" the whole thing and avoid omissions so i can piece everything together? Pretty please?
>>
File: 1463075700288.png (22KB, 300x188px) Image search: [Google]
1463075700288.png
22KB, 300x188px
>>387426909
I'm already doing #120, Danmaku Engine. First C++ and gamedev project, I'm having fun when it goes smoothly.
Give me just some time to understand how to evolve from a dumb n^2 circle-to-circle collision checking phase.
>>
>>387427132
well its not like theres a real way to quantify the percentage of similarity between two languages, i was just trying to make the point that its less challenging to move from C to C++, compared to other languages
>>
>>387427070
nah, OOP is the way to go. best way to describe any real life processes. There's a reason OOP is the most widespread paradigm.

Functional is too esoteric (only good for sci really, slowly getting better tho), procedural is dead and confusing (also usually leads to shit hard to maintain code), and everything else is just a meme.
>>
>/g/ raid
wew lad
>>
>>387427313
The definition for Enemy class might look like this.

class Enemy
{
int HP;
void dealDamage(int damage)
{
HP = HP - damage;
}
}
So an Enemy keeps track of its own HP, and also has a method that lets you deal damage to it.
>>
>>387427313
>So inheriting just means it has the ability to do stuff of the parent class but if you don't tell it to do it it won't do it even if the conditions would apply?

Inheriting means it will behave exactly like his parent class, except if you add more stuff that does more things, in which case it will behave exactly like its parent class + whatever you added to it or decided to replace.
>>
>>387427424
Not really.
/g/ hates OOP in LOO.
>>
>>387425048
Start with an easy language like python
>>
>>387427419
>There's a reason OOP is the most widespread paradigm

Because it was meme'd to hell and back when we were kids and it's too deep into the enterprise machine now to do anything about it.
>>
>>387426909
Aight, rolling
>>
>>387427483
But then why did >>387426813 say
>It is inherited but it is not called in this example
That follows
>fuckIt() don't call say() so no Uguuuu for you

If Pretty behaves like the parent class then it should write "Uguuu" when kawai==true
>>
File: 1413088971905.png (185KB, 500x500px) Image search: [Google]
1413088971905.png
185KB, 500x500px
>>387427424
Better get used to it. /dpt/ has got a new home.
>>
>>387422251
>C > Lisp
>>
>>387427687
(I'm
not ( even memeing))
>>
>>387422820
libgdx
>>
>>387426021
>Besides, when writing a commercial game, nobody will even be able to see the beauty of the code, since it's closed source.
When you work in enterprise, you quickly realise nice looking code is far more useful than faster code.
>>
>>387427313
>so inheriting just means it has the ability to do stuff of the parent class but if you don't tell it to do it it won't do it even if the conditions would apply?
Yes

You should really try to write some basic stuff yourself. It is not rocket science. You go from the most common properties of the most specific while designing your data structure and write implementation. Then you can treat your objects like direct abstractions of real life entities.
>>
>>387427538
But /g/ says it's a bad idea to start with Python.
>>
>>387427806
>>387427483
I'm getting mixed signals here
>>
>>387427634

Different poster
I assume what he meant by that is that the base class doesn't write Uguuu just by existing, you need to call say(). Fuckit() is a different function and therefore does something different.

But to be honest I didn't check the example and I'm just going off contextual clues so I might be wrong, I'm just replying to your posts when they ask details on a notion I can give an explanation of.
>>
>>387427580
Everything is a meme anon. procedural, OOP, FP, ED, everything

I know the principles of functional, which is apparently now memed to be next best thing after OOP and it's still shit.
>>
>>387427897
It's worse to sit on your ass and do nothing than to learn Python.
>>
>>387427580
>implying functional isn't being memed and is standing on its own merit

lol
>>
File: 1333816650517.jpg (19KB, 385x383px) Image search: [Google]
1333816650517.jpg
19KB, 385x383px
>Learning C without learning how a computer actually works
Why bother?
>>
>>387427997
Oh, i see, so Pretty adds the "fuckit()" function but if i don't call it then it won't do nothing.
Same with say(), is still there but unless i call it it won't work.
>>
>>387428042
I'm learning C# though.
>>
>>387428164
gotta start somewhere
>>
>>387427634
Cute dog
dog.kawai = true
dog.say() // prints Uguuu

Pretty girl
girl.kawai = true
girl.mature = true
girl.fuckIt() // your filesystem is deleted if your current user is root; no uguuu - say() is not called
girl.say() // prints uguuu

>>387427898
What do you find confusing
>>
>>387426630
So you've already forgotten your initial claim?
Dumb.
>>
>>387428225
Then keep learning C#. It's all right. It's better to learn something than nothing.
>>
>>387428238
>Gotta start with a language that has entire classes of errors that make no sense to a novice and confuse even skilled programmers
>>
>>387428201

yes
functions in a class (colloquially called "methods") are bundled behavior that is accessible whenever you have an instance of that class available (well, not true for static methods, but let's forget about that for now). Once you have an object of that class, you can use its methods to do the things they are supposed to be doing. You can visually it as a big dial with buttons.
>>
>>387427476
So it makes the dealDamage function available for other functions?
Ie: the player has the "swingSword" function, that calls for a function (or object?) that checks if the sword has collided and with what, then this functions returns the result (ie: Skelly), sends the information to another function that does the math for the damage roll and calls Skelly.dealDamage(result of damage roll)
Correct?
>>
>>387428164
>>387428238
>learning how computer works without learning how microcontrollers work
>learning how microcontrollers work without learning how transistors work
>learning how transistors work without learning basic electronics
>learning basic electronics without learning basic physics
>learning physics without learning advanced math
>learning math without going into philosophy

gotta start early anons
>>
>>387428246
>What do you find confusing
Nvm on that, i just removed some dumb out of my brain here>>387428201
>>
>>387428253
look nigga, you are making a fuzz over simple semantics, yes C++ is not LITERALLY 90% C, but it follows almost the same syntax and structure

Java isnt LITERALLY 90% C++, but it has a similar syntax and follows the same programming paradigm
>>
>>387428383
why not ? It's what I did. Gave me a lot of confidence and taught me a lot of stuff about how memory is allocated when I tried to write my own malloc or when I made a chat client in it.

You're more likely to learn interesting shit if you go for the hard stuff right away.
>>
>>387428432
or you can pass reference of target enemy to swingSword, you probably swing the sword at target anyway.


class Player {
void swingSword(Enemy target) { // you can't swing sword at nothing
int dmg = 5; // chosen by fair dice roll, guaranted to be random
target.dealDamage(dmg);
}
}
>>
how can distance be real if our eyes are'nt real
>>
>>387428432
Yep, you've got it.

The good part is that the roles are all separated. The player tells the sword what to do - the sword tells the skeleton what to do - and so on. For example, if the Skeleton is wearing armour that halves the damage taken, you can easily alter the dealDamage function to reflect that behavior.

class Skeleton
{
int HP;
dealDamage(int damage)
{
HP = HP - (damage / 2);
}
}

And none of the code outside of the Skeleton needs to change.
>>
>>387428693
>void swingSword(Enemy target) { // you can't swing sword at nothing
I see, that works for a less "real time" approach (most FF games), the one for the collision check would be for stuff like morrowind or might and magic where you actually have to connect the blow with the target.

>>387428895
Interesting.

That cleared a lot of confusion, thanks a lot!
>>
>>387423092
why not?
>>
>>387428432
Unrelated person but that's a fairly good implementation. So in abstract code...
SwingWeapon()
..if weapon.TestHitTarget( out Character wounded )
....wounded.Damage( MyDamageWith(weapon) )

That's a simple take. If your physics is handled by anything more advanced like a Context, you'd probably do like
weapon.Swing()
and then weapon has its own registered body that it polls for collisions and continues with.
>>
>>387422523
>engine
how the fuck do you think engines are made you dingus?

>>387422641
Honestly C. Structs give you more than enough OOP features for a turn based RPG.
>>
>>387422639
>its like breathing manually
fuck you
>>
>>387429221

cause it means you now have the responsability of destroying that object
>>
>>387429221
Use RAII patterns. Plain old stack objects cover most cases, unique_ptrs solve the rest and shared_ptr is an extreme corner case. Between all of these there's very little cause to ever use new/delete.
>>
What's the best language to learn if you want to slowly make an open world game for the next 20 years?
>>
File: output_demo_compr.webm (3MB, 1194x674px) Image search: [Google]
output_demo_compr.webm
3MB, 1194x674px
quick post your progress and attention whore before it's too late
>>
>>387429491

english, the asian market doesn't really care for open world
>>
>>387429369
This.
This is the perfect style of C++ when you don't care about performance. As tons of loons never do.
You question why they're not using a better language of course but just leave them be.
You do you anon. Don't bother using your brain.
>>387429491
Maybe brainfuck? But that takes more than 20 years. I can't think of anything that'd have you take that long.
>>
>>387428432
Basically an object is a thing that has methods (stuff the object can do) and attributes (infomation about the object). By defining a method you are stating something that an object can do to change its attributes. An object (Foo) can call its own methods or another object (Bar) call Foo's methods so that Bar can alter Foo's attributes.

Somewhere in your code you have to have a main method that will be the entrypoint, i.e. the very first method that is run every time. From here, an object can call methods of other objects and they can call even more objects.

Ideally, each object is small and simple and each method does a single thing. If your object or methods are too big, you should think about how to break it down into smaller parts.
>>
>>387426625
He wrote it in x86 because that was literally all he knew how to program in. Not because of some turbo autist performance bullshit.
>>
>>387422639
smart pointers say hello
>>
>>387429629
>This is the perfect style of C++ when you don't care about performance. As tons of loons never do.
Am I missing something? unique_ptr doesn't perform any worse than explicit new/delete.
>>
>>387421583
Brainlet here what would the real advantage be for using Haskell? I know it's orders of magnitude slower than C++ so speed can't be it. Would games stop having bugs? Would it allow for better technologies? Better enemy AI? What would be the advantage?
>>
>>387429491
Malbolge. Trust me anon, it will be fun.
>>
>>387429747
It'd probably be less buggy. Haskell is sort of a fringe language, only academic-types care about it.
>>
>>387425180
It's a simulation takes places in medieval.Has kind of distinct theme. Time travel is a thing but this land is kinda closed town , it has bunch of unique races in it like different cyborgs,cat based people etc. It is really big simulation game and everything literally matters.

but i have no idea how to translate to 2D menu stylied game kinda like fire emblem but without battle or shit.

its just menu based/graphic
>>
>>387429491
Probably java because
>huge corporate backing
>was relevant 20 years ago
>still relevant today
>isn't going anywhere in the next 20 years
>good tools
>top tier IDEs
>decent performance, can tweak the vm if it's not fast enough
>India the next world superpower love java
You know what to do.
>>
>>387429848
>>India the next world superpower love java
DESIGNATED
>>
>>387423026
well the primary point of making your game from scratch is the game is truly "yours" - as in you're not dependend on the engine limitations or whether the custom engine will be ever updated or not

2d games are easiest to make a custom engine for, 3d games are more tricky but then there are open source engines like Irrlicht or idTech you can borrow and enchance with whatever features you need
>>
>>387429812
that's it? So Haskell is pretty much intellectual wankery for deluded brainlets who can't deal with C++
>>
>>387430037
You've got it.

It's really nice intellectual wankery though.
>>
>>387430037
The only haskell coder i ever met was unironically wearing an actual fedora
>>
>>387422820
Not sure if you still lurk this thread, but if swing did not make the cut, maybe try LWJGL.
I've never tried both though, but I heard about both quite a bit.
>>
>>387423092
>>387429369
Been reading up on that and trying to use it on my shmup engine, but I don't quite get it...
I have a "World" object that store all "Actor" objects currently in play (say, bullets that you have to dodge). These are wrapped in a smart pointer (unique_ptr), and all these smart pointers are stored in a deque.

Now I want that, somewhere in the game, something creates an Actor and put in into play (store it in the World). The way to do so would something like :

aWorld.mActorDeque.emplace_back( new Actor() );

Right? But what if I want to manipulate the Actor before putting it in the World? Like, I want to give it a certain initial speed. I'd do something like :

Actor *anActor = new Actor();
anActor->setSpeed( //things );
aWorld.mActorDeque.emplace_back( anActor );

But then I've got a naked new, and a memory leak if for some reason it's not stored.
Is there a fancier way? Maybe make_unique() and move()?
(I could add arguments to the ctor, but I feel that would bloat it really fast...)
>>
>>387430664

auto anActor = make_unique<Actor>();
anActor->setSpeed( //things );
aWorld.mActorDeque.push_back(move(anActor))
>>
>>387426625
When Rollercoaster Tycoon was made x86 assembly was still a comparatively mainstream language. C was popular but you would still find a ton of work at the time programming in assembly. Chris Sawyer wrote almost all of his games in Assembly at the time and this dated back to when he wrote games for the ZX Spectrum.
>>
>>387430664
You could look into allocators.
>>
>>387430803
Thank you!
Yeah that's what I've been thinking. It's a bit of a mouthful I feel...
But anyway, I remembered another thing.

Say I've got a pretty complicated bullet pattern that would be painful to write only in terms of initial conditions (homing into the player, variable acceleration, whatever). The thing I've been thinking is to have a World::storeActor() function that does the storing in the World's deque, AND return a pointer to the actor thus stored so I can directly manipulate it anywhere.

Now the thing is : what should this returned pointer look like? A raw pointer sounded fine at first, but if the Actor gets deleted from the World's deque, (for instance, because the bullet goes way offscreen), the pointer would dangle, right? Is weak_ptr what I'm looking for then?

>>387430987
Haven't heard about those. I'll look into it, thanks.
>>
>>387431509
>A raw pointer sounded fine at first, but if the Actor gets deleted from the World's deque, (for instance, because the bullet goes way offscreen), the pointer would dangle, right?
That's correct.
>Is weak_ptr what I'm looking for then?
weak_ptr only works as a counterpart to a shared_ptr. I'm not sure what you could do to make this work.
>>
>>387431870
Store the World deque's actors in a shared_ptr, maybe? That sounds like an overkill though, because I'd say the World is the only thing that "owns" the actors. I don't know.
I'll do some more research. Thank you again.
>>
>>387427476
>HP = HP - damage
im a retard with no programming knowledge but isn't using something to define itself kinda illogical?
wouldn't it have to be a separate function like currenthealth = HP - damage
>>
>>387432245
You could use a shared_ptr in World, and a weak_ptr in anything that needs to use an actor. As soon as the shared_ptr is flushed from your World queue, the corresponding weak_ptr will be safely marked as invalid.
>>
>>387433224
It's not a definition, it's an assignment. You read it as "Set HP to be HP minus damege"
>>
>>387428468
>learning philosophy without realizing that the world may as well not exist
>>
>>387433224
that's implicit in the language. the actual translation to assembly/machine operations would involve several steps involving copying things around
Thread posts: 258
Thread images: 34


[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.