/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

pastebin.com/9YjWTmks
git-scm.com/book/
dlang.org/spec/operatoroverloading.html
lazyfoo.net/tutorials/SDL/index.php
youtube.com/watch?v=E8I19uA-wGY
ogldev.atspace.co.uk/
learnopengl.com/
pastebin.com/GFkMHztx
youtube.com/watch?v=rX0ItVEVjHc
youtube.com/watch?v=qWJpI2adCcs
kotlinlang.org/docs/reference/operator-overloading.html
twitter.com/SFWRedditGifs

misato > ritsuko

Java newfag here, why can't I get out of this loop?

import java.util.Scanner;

public class ProgramTest
{
public static void main(String[] args)
{
String Expression = "0";

System.out.println("1 -> Add 1");
System.out.println("2 -> Multiply by 2");
System.out.println("3 -> Exit");
Scanner stdIn = new Scanner (System.in);
Expression = stdIn.nextLine();

do
{
System.out.println("Try again. Please enter either a 1, 2, or 3.");
System.out.println("1 -> Add 1");
System.out.println("2 -> Multiply by 2");
System.out.println("3 -> Exit");
System.out.println(Expression);
Expression = stdIn.nextLine();
} while (Expression != "1");

System.out.println("Out of the loop now");

}

}

Thanks for FINALLY using a non-homosexualish pic for these threads. The one with the boi that had smooth legs and short shorts and flappy hair made me wanna kill myself

C++ > java > C# > C >

google it
hint: the problem is in comparing strings in java

In Java, == compares object references rather than values. "1" == "1" does not always hold. Use the .equals method instead.

Integer.parseInt(Expression) != 1

>, == compares object references
Wow, all these years and i learned another reason why java is trash.

kill yourself shitty troll

Doesn't hold in C either, and for good reason. Learn the semantics of the language before you criticize it.

This one? Kys pedo

needing a function to check equality is absolute ass.

strcmp

Haskell doesn't have this problem

here's your (You)

Well C is also a shit language.

haskell is shit

you're a shit

Haskell has referential transparency and immutability so there's no case in which you might want to compare references instead of values.

If an operator can't check string equality, the language is shit.

I have no intention of using any shit like unity, but what about stuff like Jmonkeyengine or Ogre3d? I've written a newgrounds-tier game with JavaFX before. When you guys say make your own engine, do you mean start with absolutely nothing? I can kinda see the logic behind it because you have total control over all aspects of the game, but from a realistic perspective, you'd have to be a mega autist to write things like detecting keystrokes and mouse movements and how to draw simple geometry in your spare time for months without actually getting to the game itself and not giving up.

Take that back.

Is this correct, dpt?

So, you only like languages with operator overloading?

you a shit

>needing to overload operators

Programming is overrated and stupid. I just want to

Right click> install > category > my dream version of x

That kind of technology would be the end of all programming

Make fun of me. This is supposed to generate a password at the length of l. s is a switch and when it is true suppresses all text output.
Can't paste my code for some reason..
pastebin.com/9YjWTmks

That's what it would take.

Personally, I'm glad Java remains semantically consistent regarding reference types.

>Jmonkeyengine or Ogre3d
These are actually worse than unity. No joke.
If you are smart and a good programmer, create your own engine.
If you aren't a very good programmer, or just don't wish to invest time in fundamentals and still wish to make a game, then use unreal or unity.

reading throu git-scm.com/book/
a bit to much overhead, i feel.
also still mark lutz python (2013). my eyes are hurting from to much focusing on the monitor. any tipps against dry eyes?

Yes

>That's what it would take.
auto str = "butts";
auto str2 = "butts";
int x, y;
(str == str2).writeln;
(x == y).writeln;

Except your dream version of x is probably inconsistently specified, which makes it unimplementable even by a team of the best programmers.

What's a great toolset for making games in pure C?

Don't recommend SDL pls

is this some scripting language

Not if in the future people could implement a standard type for thoughts.

Thoughts are basically OOP IRL, different objects in your brain talking to each other to make different thoughts ad infinitum

You still have to tell machine what is your "dream version", retard.
Even if we have AI that can do all programming you still have to tell AI what you program.
Even if we can hook your brain in to computer that can read your thoughts you still have to think and design your "dream version".

No, but it can be used as a pearl/whatever replacement.

No, it might be relevant if it were.

dlang.org/spec/operatoroverloading.html

why is sdl out of the question
c/sdl/opengl is a pretty comfy setup for an adult male

am I a dumbass for making my website's backend run in python?

>Thoughts are basically OOP IRL
No. You are wrong. And if you thought a little about it, then you would realize that you are wrong.
We are actually getting pretty close to specifications with some functional languages, and they are not getting easier to understand, but harder.
Your dream is a shit.

my point was, i don't have to do any extra work. I know (somewhat) what happens in the background.

>what are subconscious thoughts

When your mind thinks of say a car, the subconscious has already a pre-determined perfect, personalized image of what a standard car in ones thoughts would look like.

The basic element of each thought, unconscious or conscious can be determined by the data it is associated with from sensory inputs, which when jumbled together under both subconscious and conscious versions, immediately implements what you have immidately preconceived in your mind.

glfw + some modern opengl loader that works for you.
Thats pretty much it.

>>creation engine
Are you talking about bethesda?
It's just a probably barely changed embryo.

Depends.
Python doesn't really support multithreading all too well, so it's kind of retarded actually.

...

>stuff like Jmonkeyengine or Ogre3d
too barebones, this is like making your own engine except you burden yourself with some other fag's half-assed mess of an engine

Start here if you don't want to use an engine.
lazyfoo.net/tutorials/SDL/index.php

You'll pick up a lot of the basics, and as you start running into "ok, how do I do ___?" questions, just research.

It's basically just doing a bunch of math, but I prefer it to JS

Also they are badly programmed.
Mike Acton tears Ogre3Ds animation engine a new one in one of his talks.

jmonkeyengine is full featured engine.
ogre3d is just renderer but has shit loads of extensions to make it full featured engine. You are retarded.

It's stupid because Python is slower than a donkey's ass. It's an interpreter for shitting out loud, of course it's impractical to use it as a backend

what about functional programming patterns
youtube.com/watch?v=E8I19uA-wGY

This is actually a pretty shitty series of tutorials.
ogldev.atspace.co.uk/ or learnopengl.com/
this one is a bit better.
Just reading the official documents (khronos wiki for example) is the MOST helpful though.
It's not littered with unnecessary explanations.

Are you a brainlet?

""patterns""

Not him. But you are retarded.
These "engines" are horrible pieces of shitty programming.
I have no idea how anyone could even think about programming a game in them.

"==" is an identity comparison. Testing equality for objects isn't the same as for primitives. Objects are just references. Basically "==" for objects is just testing whether it's a reference to the same location.
Read up on what the .equals() and .hashCode() methods are and why people override them.

t. unity shill

Which one? The pink haired one?

I think Kotlin has the right idea by making === compare references and == compare values (through an equals method). It makes a lot more sense than using === to hack around your own weak type system like JS or PHP.

What about COBOL?

ok sure dude i'll give you the benefit of the doubt. But why are those worse than unity? When would most of those skills be applicable unless you're working for a game dev company building the engine itself? Most companies don't even start from scratch with their engines to my knowledge, they just build off the previous. It just feels like rather unnecessary work. Like if you asked me to make a web browser or something (not the same i suppose), it would seem rather redundant to write a new kernel and OS on top of that in order to make a perfect web browser.
Maybe I'm misunderstanding what you're saying here, but to me it seems like I am a sailing student in the yacht club and I want to go to Hawaii. I don't want to just fly there, so I was thinking of maybe getting some of my friends together, renting a boat and sailing there. I feel like you're telling me to build a raft/canoe, use no gps, teach myself navigation and build my own compass. I'm sure the latter route would result in me being a fantastic sailor, but when I go to get a job as a captain of a cruise ship or whatever, the ship is definitely not a canoe and I always have gps and maps and shit like that.

No, I am a "take your time, and program your own goddamn engine, or else you are a faggot" shill.

dumb sepples poster

Given this program as a sample of my programming skills, what should I focus on improving?

pastebin.com/GFkMHztx

C#.

come on even unity is better than literally who engines

I too love never knowing whether == will compare identity or equality.

t. paid unity shill

struct test{
int array[50];
};
int main(){

test* t=new test;
t->array[20] = 5;
int *i = &t->array[20];
delete t;
std::cout

Maybe you should add a few comments to explain what those nested for loops / if statements mean

youtube.com/watch?v=rX0ItVEVjHc
youtube.com/watch?v=qWJpI2adCcs

If you want to be a game programmer, at least take some time to watch these interesting videos by mike acton, lead engine programmer of insomniac games.

>But why are those worse than unity?
I don't know "why" they are worse. Maybe because they are created by incompetent people? I don't know why.
The thing is, that they are not well programmed.
If you'd start reading their code, you would realize this, just like mike acton did in the first link.

Making your own engine has benefits that you don't realize right now.
Sure recreating the generalized mess that is Unity is a waste of time, but YOU aren't recreating Unity, you are creating a game, which means you have full control over everything when you are writing it.
This in turn can making the game, and creating its content easier in the end.
You don't need everything Unity has to offer.
Your game has to do a few things extremely well, which is why focusing on these parts, is so important.

The memory is simply not zero'd so unless overriden it still contains that value there.

I'm not familiar with Kotlin at all, can you still override == in your classes?

Using a stale pointer doesn't necessarily segfault. You might still get the old value or a value from the object that is now living there.

kotlinlang.org/docs/reference/operator-overloading.html
Kotlin aims to interoperate with Java, so == is just sugar for .equals

Oh nevermind it just translates to a call to equals() without having to write equals()

I respectfully disagree.

Why are you using this language for this task?

>am I a dumbass for making my website's backend run in python?
Not necessarily, but you might be for other reasons.

>The == operation is special: it is translated to a complex expression that screens for null's. null == null is always true, and x == null for a non-null x is always false and won't invoke x.equals().

I need to start using Kotlin

>Why are you using this language for this task
simplicity and it's just what I know so far.

t. jetbrains shill

Thank you, friends.

But user, syntactic sugar is cool and Java has always been really ugly.

t. jetbrains shill

Syntax sugar is sin. Java's only strength is that it's clear, and that's because its so boilerplatey and explicit.

javascript is bretty damn difficult to git gud at tbqh

native libraries with C API or just target jvm?

native libraries

ah thanks man, I appreciate it. I was worried you were just fucking with me or something. Here's what I was thinking: Start using something like Unity just so I don't give up immediately due to the very high learning curve. At least for the first couple months of development, maybe less. See if Games Development really is right for me or if I should just stick to playing them. That way I don't end up 3-4 months from now down the road with a non-functioning engine and shit grades from obsessing over how to fix my non-functioning engine, and having no desire anymore in making games.
After that, I'll have a better idea of what maybe is wrong with unity and what I'd change for my engine. And have something to show my friends to try to convince them to help me a bit (if needed), that way it's not just words floating around. Does that sound feasible? Or are there gaping holes in my idea?

Just had to reinvent the type for my C11 game engine. Fuck, maybe I should have used Go or something.

>Fuck, maybe I should have used C++.
FTFY

but there's no libraries when everything is written in fucking sepples
with jvm you could just use any class because the classes are defined in the vm level

Why not just use C++ at that point? You could literally have written everything the way you already do in C except have access to the vector class.

you probably fucked it up or made a worse version

literally under 100 lines of to implement generic vector with macros
You could also have used any of the million libraries that already have that