/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 43371300_p0.jpg (1024x1446, 462K)

Other urls found in this thread:

devblogs.microsoft.com/commandline/windows-terminal-microsoft-store-preview-release/
youtube.com/watch?v=9DS-8faXmqk
twitter.com/AnonBabble

First for 0.1 + 0.2

Why aren't you using Windows Terminal, /dpt/?

Attached: summer-terminal.jpg (4032x3024, 2.06M)

devblogs.microsoft.com/commandline/windows-terminal-microsoft-store-preview-release/

Because my Linux build environment is comfier?

>Windows
Sorry, but I'm not into cuckoldry.

Attached: 1559388983692.jpg (646x741, 63K)

what's a "build environment"

Making an Asteroids clone in Haskell and SFML.

Really annoying to have to rebuild a VertexArray just to move it.

Terminal + build utilities/build pipeline

is that what linux users call a compiler?

It takes more than just a compiler to build most software. A compiler is one of the tools, and arguably the most important, but there is certainly more than just that.

I've been programming for 25 years and all I've needed is a compiler and a debugger, what are you guys doing

preprocessor+compiler+assembler+linker+bullet vibe+microwave oven

and maybe post build scripts to invoke tests so whatever your testing process consists of

>compare and swap

Attached: Numales7.jpg (1024x672, 237K)

of course >implying anyone here writes tests

Do you compile all of your software "by hand" on the command line?
Real software uses build systems, whether that's something like Make or Ninja, or something that will generate those (Cmake, Meson, etc.)
And real software has dependencies, and you're going to want to use pkg-config to find those.
Some software will generate its source code from something else. Maybe that'll be written in python or another language like that, so you'll need an interpreter.
The compiler isn't even a single tool, and includes shit like a linker.
In fact, even if you're using the compiler manually, the command line itself (/bin/sh or whatever) is still considered part of the environment.

Attached: 1558828626337.jpg (480x639, 32K)

>Le single greentext line with onions-related image
Fuck off.

Awww did I trigger you little baby?
M-muh atomic instructions. LOL pathetic

Imagine thinking you need to do all this shit to compile a program
I don't know what's worse, people using antiquated shit from the 70s or webdevs with their monolithic dependency stack

You don't have a build system? Are you retarded?

I literally just type make.

I'm a C programmer that exclusively writes things for Unix-like systems.
It has worked that way for a very long time.

Attached: 1557279904231.jpg (900x882, 217K)

I do these:
youtube.com/watch?v=9DS-8faXmqk

Ive been passively working on a version that would do Jow Forums threads. I don't really know yet how I will handle replies, especially multi replies.

Attached: Screenshot at 2019-06-21 20-51-05.png (770x144, 38K)

I could call you grandpa but you're probably younger than me

How do I get over the fact that I'll never get into Jane Street?

Attached: 2gsjgna1uruv7GrdEamVQxnPXcTaQ2W7wRKbmZzygziMio7TK6LPTyzf3PuqpKzyRhGVoy6PUToCaPZ4MiGBih3GutHURFVj9Xd4 (640x373, 83K)

Can a base class not call protected/private constructors of derived classes in C++? How do I work around this?

Example (irrelevant code removed):
template
class Component {
public:
static T &addComponent(int entityId) {
return *new T(entityId);
}
}

class Position : public Component {
public:
int x, y;

protected:
Position(int id) : Component(id) {}
};


I get "Position::Positon(int) is protected within this context."

is that Jane Street? looks like absolute hell

What am I looking at? Command line document viewer? Jow Forums has a nice json api you should look in to. just append .json to any thread url

I'm 23. C and GNU/Linux is the most comfy type of programming.

Attached: 1557660740589.jpg (800x600, 80K)

yeah I know you're the guy who won't shut up about his wayland compositor

What are you trying to do exactly?

anyone got the second edition of elixir in action?

What's the best language for programming old 8 bit style video games?

BASIC

C or Assembly

I rolled on the Programming Challenges meme and I got the password manager. Making the password generator right now.

t. vs run button babby that can't do anything without ms holding their hand

I dont use VS but nice try

If you've never used make then you never wrote anything of value or complexity in C

At least he made something instead of just shitposting.

I'm writing an ECS and this probably isn't a great way to do it but I'm sacrificing space complexity by having each component type keep a vector of entities it's attached to. I don't want their constructors to be able to be called outside of addComponent. That's all this class is doing.

template
class Component {
public:
static T &addComponent(int entityId) {
return *new T(entityId);
}

static void removeComponent(int entityId) {
if (components[entityId] == nullptr) return;
delete components[entityId];
components[entityId] = nullptr;
}


static T *getComponent(int entityId) {
if (!isAttached(entityId)) return nullptr;
return static_cast(components[entityId]);
}

static bool isAttached(int entityId) {
return (int)components.size() > entityId && components[entityId] != nullptr;
}

protected:
Component(int entityId) : entityId(entityId) {
if ((int)components.size()

I don't bring it up that often; I don't have much to say about it most of the time. It's probably as infrequent as once a month at this point.
If I'm apparently so recognisable, I may as well be using a tripcode.

Attached: 1554335430730.jpg (1854x1500, 831K)

>I'm sacrificing space complexity by having each component type keep a vector of entities it's attached to
you mean each entity has a vector of components that's attached to it?

You post so much and you always post with anime girls so it's pretty obvious

>If I'm apparently so recognisable, I may as well be using a tripcode.
You may as well go to redddit where you belong.

I'm 25 and also write in C and for Linux exclusively. You're not alone.

No, entities don't know what components they have. They just hold an id and an add/get/removeComponent convenience. method that redirects the call to the static methods in Component.

There might be a better way but right now I just want to know if I can deal with this constructor issue. I don't want to make it public because I don't want other classes to call them.

You know the whole ECS meme is about flat hierarchies and no OOP overhead so why are you implementing it with OOP
just make a sane game engine with entites that include their components

Someone has to. It helps to drive off some of the less desirable posters.
It's slightly satisfying when you see a post about somewhat complaining about it getting deleted.

I was just stating my disappointment in being identified for what should've been an unrelated post, as if I was a tripfag. I don't actually want to be a tripfag.

The whole point of ECS is to make it data driven, ie: cache performant. By making entity hold their own components you just lost that entire benefit.
Like components are supposed to be arranged together flat in memory and operated on at the same time, thus you're getting as many cache hits as possible.

But that's what I said I'm doing though? I said "entities don't know what components they have".

e.g. my Position components for all entities are all stored in a single vector.

>By making entity hold their own components you just lost that entire benefit.
unrelated to the discussion but ABCABC is just as cache performant as AABBCC (unless you want to stretch things really far and start talking about instruction cache)

The ECS cargo cult strikes again.

If that were true ECS would be a meme and no one would use it and in a real "game" It's a lot more than just ABC. Filling the cache with irrelevant garbage is a waste of time.

It is true, fucking use your brain and think about it for a second instead of listening to the cargo cult, and ECS IS a meme
AABBCC does have some benefits in regards to making some things easier to multithread but as far as data cache performance goes, it's just the same as interleaving

happens every few threads, its just as boring as every other cult-driven development

Are they? This is really confusing because your components vector is a vector of pointers to Component and yet you call new T in addComponent and Component doesn't actually have a T member. And since pointers in vectors aren't stable, I can only assume you have this shit randomly all over the heap.

we dont live in the 90s anymore. Between L1/L2/L3 cache you have 20MB

user from earlier thread here. I finally got it working rendering in separate thread from event handling in main thread. It renders well apart from occasional flickering between black and red screen when resizing, though I have better things to work on. Now is there a way to notify messages between threads with a callback function when a specific thread is notified? I used mutex in my code but thought there has to be a better way.

>We have more resources
>Now we can squander them even more!
People like you are everything that is wrong with the computing industry.

Attached: 1492831891533.png (556x561, 341K)

Oh, right. I thought you were talking about how I was storing a vector in each entity that held their own components.

But anyway, I still want to know how to deal with this constructor thing without making it public or having some friend-class-macro thingy.

I'd take inefficient programmers over cargo-cultists any day

You're still wrong. Your assumptions is that every entity will have the same components which is not true. Furthermore if I have a physics updater that only looks at a 32 byte struct worth of data per entity that contains it there is absolutely no benefit whatsoever to instead have to load ever component that entity contains into memory when I only a single 32 byte one. All you're doing is filling it with garbage and causing more fetches in the long run as the number of components and entities grow.

>game dev autism

>called out
>throws a fit
typical

efficient OOP > data driven.

I'm not him u dumb cunt

>Your assumptions is that every entity will have the same components
False. My only assumption is that each component is iterated over is being updated, which is a reasonable thing to assume. You update an object, you update the ai component, then the physics, then the animator, then move onto the next component and do the same thing. That's how a typical game works, and you're not screwing with the cache by iterating over useless information

>efficient OOP
That is an oxymoron.

t. pajeet

OOP abstractions are pretty low overhead all things considered. Inheritance costs the same as composition.

first off, that should be
>t. pajeet
not
t. pajeet

second, pajeets are very fond of bloated OOP languages like jva

This. Using a sane inheritance model and a memory pool for object allocations is a better fit for 90% of games than some convoluted data driven nonsense.

Those pajeets probably write better java code than your ECS cult shit.

i only know sepples

of course you do

got something to say? why are you being passive aggressive on an anonymous korean fingerpainting forum?

>people in here are defending modern OOP
More proof this board is shit.

yeah old OOP was so much better

Who cares? No one but you is going to use this anyway(I hope), just make the constructors public.

I have three class methods creating dictionaries for the class.

Should the functions operate on already defined class dicts or should they be created in the function scope and assigned to class variables when returned?

You learned wrong.

yeah I better shut down my software business and go back to school

Fluent Terminal is prettier, it's buggy af tho

I would say so considering the original OOP was about concurrency and message passing at its core.

any complaints people have with OOP right now would be doubly valid for the original concept

On Windows 7 so I'm using ConEmu. At least they finally started releasing the latest versions of Pwsh on Win7. Iirc they were only for 10 for awhile. Although I all I use a Windows terminal for is running scripts and the occasional trivial task in a Python repl.

printf("debug\n");

i do it all the time
idgaf

if rust is a compiled language, why do people say its written in C? is it compiled to byte-code or something?

What languages do you guys use?

>efficient OOP

>why do people say its written in C?
It's not in any sense, and whoever said that is wrong and retarded.

im working with C++ and Lua right now

C++ Inheritance is just as good as composition models.

>pretty low overhead
OOP is inherently deoptimized on modern CPU architectures:
- State isolation creates cache misses, hinders vectorization and introduces data dependency that hinders optimization on modern superscalar architectures.
- Inheritance creates structs with bad padding, increasing cache space usage and therefore increasing cache misses
- Getters/setters used to maintain the isolation meme produce extra copy operations.

does this cute girl like C++ programmers!?

>why do people say its written in C
Nobody says that.

she likes whatever you want her to like, user, shes not real