[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 30
File: DPTChristmas1.png (332 KB, 588x390) Image search: [Google]
DPTChristmas1.png
332 KB, 588x390
Old thread: >>51710874

What are you working on, /g/?
>>
File: xmas.png (2 KB, 640x416) Image search: [Google]
xmas.png
2 KB, 640x416
Christmas-themed challenges: http://adventofcode.com

Mirrored below if you don't care about leaderboards:

Day 1: https://paste.installgentoo.com/view/raw/770a1225
Day 1 input: https://paste.installgentoo.com/view/raw/ae0e09d8

Day 2: https://paste.installgentoo.com/view/raw/a1d7af1c
Day 2 input: https://paste.installgentoo.com/view/raw/75f7f51f

Day 3: https://paste.installgentoo.com/view/raw/0eb17a9e
Day 3 input: https://paste.installgentoo.com/view/raw/5dbccc12

Day 4: https://paste.installgentoo.com/view/raw/e1e9f76c
Day 4 input: https://paste.installgentoo.com/view/raw/ca32e94d

Day 5: https://paste.installgentoo.com/view/raw/70bcb8ec
Day 5 input: https://paste.installgentoo.com/view/raw/9af42714

Day 6: https://paste.installgentoo.com/view/raw/9f864447
Day 6 input: https://paste.installgentoo.com/view/raw/1b9aadb7

Answers: https://paste.installgentoo.com/view/raw/62c04f07
>>
D!
>>
File: catfight.webm (2 MB, 720x404) Image search: [Google]
catfight.webm
2 MB, 720x404
Ask your beloved programming literate anything.
>>
Why the fuck does Visual studio need loads of GB across all fucking drives??????

Anyone else got a better IDE for C++? The 12gb extension wont fit in my ssd ffs
>>
>>51718199
I agree
>>
>>51718199
Emacs
>>
>>51718199
What features do you need?
>>
Made my first calculator in C that figures out when someone will retire. It's pretty shit, but I'm currently trying to find ways that are more salient to me than the objectives in the C Programming Language book that /g/ recommended.

C is by far the most picky language I've dealt with thus far without notifying me of an error when I compile it.
>>
>>51718225
>without notifying me of an error when I compile it
like?
did you try -Wall?
>>
>>51718220
I dont really know what i want exactly. I want to get into videogame programming, so c++ seems like a decent idea. Unity looks gay as fuck as it seems so drop-n-drag heavy. I want something more code heavy to make games.

I'm only familiar with VS and C# (WinForms) so thats that.

>>51718209
will look into. thx
>>
>>51718146
>What are you working on, /g/?
http://www.nask.co

>>51713936
>>51713951
>>51713970
>>51713999
>>51714043
>>51714053
>>51714053
hey guys, I'm glad you like it

>>51714043
>found a bug though: if the length of text is above the allowed amount, the error doesn't get handled for the user
well, the browser itself should restrict the input. I actually am generating errors on purpose, because I'm not sure what I should do in these cases. plus, the more text, the more space wasted in the server, and while a cut message would waste space in the server, the user won't lose their input and still can edit it.

>>51714053
>could do with a progress indicator too
what do you mean? progress indicator for the processing of the inputs, or for the # of chars entered?
in any case, I'll add these to my TODO list. it would be awesome if the site had progress indicator for the processing, but I'm not sure how to do it. an indicator for the # of chars is simpler.
>>
>>51718266
Use C instead.
>>
http://www.nask.co/hear/SAa0TIlyv3
>>
>>51718310
What do you use to make speeches?
>>
File: ;D.png (57 KB, 800x334) Image search: [Google]
;D.png
57 KB, 800x334
>>51718208
>scala
>not d
>>
>>51718336
http://nask.co/hear/hgXOGIJZH8
>>
http://www.nask.co/hear/ArtD2h5qsr
>>
>>51718326
picotts and espeak
>>
>>51718199
You probably installed everything, which now includes files for various emulators. I only install the VC++ compiler, aside from the IDE itself, and my installation is 5GB max across all folders.
>>
>>51718266
No one will stag you (outside of g) for using unity. Grab it, use it, learn it, and when you know better how do develop and what you need, move on to those. Also head over to /v/ and read their agdg threads (amateur game dev general)
>>
>>51718272
Why are you trusting client side validation?
>>
nah, you are right, unity is drop-n-drag. do decent
>>
so I used this function to print my lua stack
static void stackDump (lua_State *L) {
int i;
int top = lua_gettop(L);
for (i = 1; i <= top; i++) { /* repeat for each level */
int t = lua_type(L, i);
switch (t) {

case LUA_TSTRING: /* strings */
printf("`%s'", lua_tostring(L, i));
break;

case LUA_TBOOLEAN: /* booleans */
printf(lua_toboolean(L, i) ? "true" : "false");
break;

case LUA_TNUMBER: /* numbers */
printf("%g", lua_tonumber(L, i));
break;

default: /* other values */
printf("%s", lua_typename(L, t));
break;

}
printf(" "); /* put a separator */
}
printf("\n"); /* end the listing */
}


where I am at right now in my testing program

int main ( int argc, char *argv[] )
{
LS = luaL_newstate();
luaL_openlibs(LS);
if( luaL_loadfile( LS, "./main.lua" ) )
exit(0);
if( lua_pcall( LS, 0, 0, 0 ) )
exit(0);

loadEntityPrototype( LS, 0, "./objTest.lua" );

g_ENT_add ( 0 );
g_ENT_add ( 0 );
g_ENT_add ( 0 );

stackDump(LS);

g_ENT_updateall();

..stuff

return 0;
}


what gets printed is three instances of "userdata" (g_ENT_add adds those)

so something isn't working correctly somewhere. if I put a print function before or after the table in the objTest file, it prints. I have been unable to see a print if I put it into one of the functions in the table.

any ideas?
>>
http://nask.co/see/8Is9gmuwnx

>>51718418
I'm not, I do both client side and server side validation.
>>
>>51717844
show us your input
>>
http://nask.co/hear/xoYypZvO4k
http://nask.co/hear/yfS0JGwj6L
>>
>>51718446
Man you've been at it for months and you've still no idea what you're doing, maybe it's time to actually learn the subjects instead of throwing stuff together until it works?
>>
>>51718481
>months

it's only been a couple weeks
>>
>>51718500
At least since September 25th, I'd count it as a few months.
>>
D J A N G O
J
A
N
G
O
>>
>>51718683
N I G G E R
I
G
G
E
R
>>
File: error.png (3 KB, 472x38) Image search: [Google]
error.png
3 KB, 472x38
https://ideone.com/j37cT3

When I want to enter another family's details, it mushes the first two lines together as seen in pic related, any help?
>>
>>51718683
Django

>>51718698
the nigger.

Problem solved.
>>
>>51718716
use println, not print
>>
>>51718683
>>51718698
>Abuse of the code tag may result in a ban.
>>
>>51718726
But it wont let me input an answer for the first question regardless
>>
add input
>>
>>51718750
it works for the first loop, but the second loop it doesnt work and it does the problem as seen in the picture
>>
>>51718698
le edgy meme poster

>>51718735
where in the rules is this?

>>51718804
delete your post and wrap it properly
>>
>>51718387
>>51718455
>>51718490
>>51718576
pls help i keep missing the new thread
>>
Not having a good day...

>>51712201
Well I did it when I got up this morning.

from itertools import islice, cycle, count, compress, product
from collections import Counter

def primes():
#http://rosettacode.org/wiki/Prime_decomposition#Python
for p in (2, 3, 5):
yield p
roots = {} # Map d**2 -> d.
primeroots = frozenset((1, 7, 11, 13, 17, 19, 23, 29))
selectors = (1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0)
for q in compress(
# Iterate over prime candidates 7, 9, 11, 13, ...
islice(count(7), 0, None, 2),
# Mask out those that can't possibly be prime.
cycle(selectors)
):
# Using dict membership testing instead of pop gives a
# 5-10% speedup over the first three million primes.
if q in roots:
p = roots[q]
if p == 3 or p == 5:
count35 += 1
del roots[q]
x = q + 2*p
while x in roots or (x % 30) not in primeroots:
x += 2*p
roots[x] = p
else:
roots[q*q] = q
yield q

def decompose(n):
for p in primes():
if p*p > n: break
while n % p == 0:
yield p
n //=p
if n > 1:
yield n

def divisors(n):
# get prime factorization of n and make parallel list of divisors and powers of the respective divisors
divisors = []
powers = []
for (k, v) in Counter(decompose(n)).items():
divisors.append(k)
powers.append(v)
# permute all the powers, apply the powers to their respective divisors, yield the total product
for perm_of_powers in product(*map(lambda p: range(p+1), powers)):
total = 1
for divisor, power in zip(divisors, perm_of_powers):
total *= divisor**power
yield total

Tis stupid quick.
>>
>cucumber JVM is a Java virtual machine developed in ruby
>there are actually people who use this
I honestly cannot comprehend the reason for this
>>
Just install an older version, they're a fraction of the size and do 99% of what you're likely to want
>>
How do you calculate how many triangles you need to get a smooth looking circle, is there a formula or just set it to something high like 128?
>>
Is it worth learning Erlang? I mainly want to know Elixir because it seems cool.

What uses does Erlang/Elixer excel at in the modern day?
>>
>>51718929
Being a dank functional meme
>>
>>51718904
Make a java based ruby interpreter for cucumber JVM.
>>
>>51718939
I know its dank

but other being meme, is there any point to it?

I want to write a highly available microservice API in Elixir. Worth it?
>>
>>51718904
What the fuck? Why? It must be as slow as christmas...
>>
>>51718950
As far as I know, if you like functional programming and want your program to have huge uptimes and/or be distributed erlang is one of your best bets.
>>51718987
Exactly. Ruby is one of, if not the, slowest languages in popular use today.
>>
>>51718929
Yes
>>
File: 1429979339334.png (16 KB, 211x197) Image search: [Google]
1429979339334.png
16 KB, 211x197
>>51718826
Sticky. I know Anon, reading comprehension is hard.
>>
>>51718929
facebook ditched erlang for c++.
>>
>>51718925
It's subjective (what you mean by 'smooth') and depends on the resolution.
You need to visually try it out.
>>
>>51719146
>reading the sticky
>in any board
>>
>>51719165
Facebook operates on hundreds of terrabytes of data a day.
>>
>>51719224
that's a lot of worthless information
>>
>>51719193
Whatever. Your loss.
>>
File: 1426-061215.png (851 KB, 4000x2560) Image search: [Google]
1426-061215.png
851 KB, 4000x2560
Finishing of this keygen of which has been laying around incomplete for months.

Got valid serials working (well I don't think the symbols ones will work with activation code, but they are valid initially), need to work reverse engineering the generation of valid activation codes now.
>>
>>51718929
http://lfe.io/
>>
>>51719277
nice job. You going to release it or just for fun
>>
>>51719277
Cool. Please put some dank midi tunes in it.

BTW, I'm just getting into reverse engineering. Is the free version of IDA enough?
>>
>>51719252
So was pointing out facebook switching to c++
>>
In C#, how do I create an instance of a class at runtime with a name that I'll get at runtime too
>>
>>51719388
dont do that
>>
>>51719397
why?
>>
>>51719388
just generate each object with an ID of some kind. Do md5 on the current timestamp or something and assign it an id field.
Unless I misunderstand what you want to do.
>>
I got a job so I'm gonna take a break for once
>>
>>51719388
Have the class contain a Name field and put it in that, or depending upon what you want to do a hash map might work {"name" => Object()}
>>
>>51719411
Reflection is bad.

Something like this is okay, I guess, but you'll need a common superclass that you can actually use.
Base Construct(string type) {
switch(type) {
case "A":
return new DerivedA();
case "B":
return new DerivedB();
default:
return null;
}
}
>>
File: shot-20151206-1874-1jbezwi.jpg (144 KB, 1280x1466) Image search: [Google]
shot-20151206-1874-1jbezwi.jpg
144 KB, 1280x1466
>>51719300
neat
>>
>>51718925
After extensive testing 64:1 with a lower limit of 16 seems to be a good ratio.

That's number of vertices:radius to clarify.
>>
>>51718603
maybe someone else but not me
>>
File: 1443225682058.jpg (33 KB, 600x360) Image search: [Google]
1443225682058.jpg
33 KB, 600x360
>>51719508
>Hipster Appeal
>>
>>51719367
nevermind the joke went over your head
>>
>>51719432
>>51719466
>>51719480
this is kind of confusing

say I have a person class, at runtime I get a bunch of names and I want to make objects out of them, so like person Mike = new person(), person Kike = new person(), etc
>>
>>51719542
I got the joke, it was just bad.
>>
>>51719552
What the fuck dude. How are you this clueless?
>>
>>51718925
It depends upon how smooth you want it.

One common approach is to choose the number of steps such that the maximum distance between the polygon and the circle is less than half a pixel, which means that the number of steps should be
steps >= pi/arcsin(sqrt(4*r-1)/(2*r)))

where r is the radius in pixels.

A sufficient approximation is obtained using 4*r-1 ~= 4*r so sqrt(4*r-1)/(2*r) ~= 1/sqrt(r), and asin(x) ~= x, giving
steps >= pi*sqrt(r)
>>
>>51718929
https://blog.wearewizards.io/a-lot-of-websockets-in-haskell

Learn Hasklel instead
>>
>>51719508
>Lisp!
garbagebin.svg
>>
New to C, trying to get input from terminal and store in char[]

 scanf("%s", str1); 
is just grabbing characters from seemingly nowhere most of the time, which the terminal sometimes usually can't display properly. Sometimes I will get to press a single key and then the program moves forwards

Is there some better function for what I'm trying to do? Or am I doing something wrong here?
>>
>>51719568
for you
>>
>>51719588
yeah, you r a funny guy.
>>
>>51719552
those are just variable names. You can't generate those on the fly(not normally anyway). If you want a person to have the persistent name george you need
class Person{
public name;
public Person(string name){
self.name = name;
}
}
>>
>>51719573
I've been out of the programming loop for a while and I'm trying to pick things back up again

>>51719615
ah I see, thanks a lot
>>
With opengl c++, do you need to specify the glfoat constructor i.e
GLfloat xPos = GLfloat(0);

or is it fine to just

GLfloat xPos = 0;
>>
>>51719508
why do people keep shilling for erlang/elixir instead of Go? Go has mostly the same features in terms of the applications it generates, plus better performance.

also, >>51719541
>>
>>51719666
No.
>>
>>51719666
Both are equivalent. I'd generally recommend against using GL wrappers, though.
>>
File: error.png (1 KB, 268x39) Image search: [Google]
error.png
1 KB, 268x39
https://ideone.com/j37cT3

When I want to enter another family's details, it skips the first quesion and scanner as seen in pic related, any help? It works on the first runthrough but after that it doesnt allow for an input.
>>
I need to have a timer, which ticks every second. How do I make it tick even when waiting for user input?
>>
>>51719694
>Both are equivalent. I'd generally recommend against using GL wrappers, though.
Why is that?
>>
>>51719652
I forgot a piece
Person george = new Person("george");

if you want to create it.
Printing the name, for example, is simply:
Console.writeline(george.name);
>>
>>51719706
GLfloat is literally the same as float.
>>
>>51719706
Probably just personal preference for the most part, but I prefer to interact with libraries in the intended way, in case the wrapper has some added logic that isn't necessarily appropriate.
>>
>>51719388
Reflection.
>>
>>51719338
If your starting out, yeah IDA free is enough.

Haha some scene music..
>>
>>51719695
http://www.catb.org/esr/faqs/smart-questions.html
>>
>>51718737
I found that you can do an empty println before. For some reason that worked.
>>
>>51718446
I didn't see the code from last time but maybe you aren't actually storing the prototype?

Sorry, but I hardcode all the objects into my games.
>>
File: 1447978232399.gif (2 MB, 370x319) Image search: [Google]
1447978232399.gif
2 MB, 370x319
>>51718146
freeglut or GLFW?
>>
>>51719840
glfw
>>
>>51719840
GLFW. Glut is deprecated.
>>
Unity is for 10 year old kids
>>
how to into private members for JavaScript?
>>
>>51719906
Don't let /v/ dev general hear you say that. The thread will immediately devolve into
>S-STOP REINVENTING DA WHEL FAGGOT, CHECK OUT MY COOL 2D PIXEL PLATFORMER
>>
>>51719678
>Go has mostly the same features in terms of the applications it generates, plus better performance.
no. erlang is about fault-tolerant distributed computing with asynchronous operations relying on the actor model. Setting up a cluster in erlang is really easy

http://learnyousomeerlang.com/distribunomicon#setting-up-an-erlang-cluster
>>
>>51719790
Didnt work unfortunately
>>
>>51719929
>comparing making a game to making a game engine
There's plenty of distinctive, unique ways you can make your 2d platformer, or you could be making it for practice.
Unless you're making your engine for the purpose of how to make an engine, it's a waste of time and resources and makes you far, far less likely to finish your brainchild.

This is true in all parts of low level programming. If you get upset by people saying not to reinvent the wheel then the only valid course of action is to make your own systems programming language, with which you develop your own operating system, graphics library and engine.
>>
>>51719754
https://www.youtube.com/watch?v=c17k4LfLkaE
>>
How to detect if a line intersects a cuboid.

How to detect if a cuboid intersects a cuboid.
>>
>>51718146
is that a shoop? that'd be awesome if that was a real pic
>>
>>51720019
man those days were fucking awesome
>>
>>51720015
That is the dumbest logic. "Stop reinventing the wheel" roughly translates to "stop doing more work than more".
>>
>>51720025
>what is dot product
>what is sat
>what is gjk
>>
>>51719666
The GLfloat, GLint etc types are guaranteed to be primitive arithmetic types. On any mainstream system' they'll be the same as the similarly-named primitive type. The main exception is that architectures with a 64-bit "int" may have a 32-bit "GLint". If you don't use the constructor, the worst that will happen is that you'll get a compile-time warning for an implicit narrowing conversion on such systems (if you ever find one).
>>
>>51720067
Than me*
>>
>>51720067
No, it translates to "don't waste your time on low level details unless you are interested in the low level details" you moron.
>>
>>51720113
No it actually doesn't and you are earnestly retarded for thinking that. The lower you go the more control you have.
>>
>>51720019
>>51719754
Recently found the soundtrack to this game in a pirated game installer. Was pretty happy to listen to it.
Then again, the name of website it was on also has some nostalgic roots.

https://www.youtube.com/watch?v=Lhm4IhBSeFw
>>
>>51719920
> how to into private members for JavaScript?
You can't. You can do a bunch of stuff using Object.defineProperty(), but you can't actually make properties private. At best, you can make certain things awkward.
>>
>>51719794
well if you figure it out

I can give you 1 rare pepe
>>
>>51720176
The second song, to be specific.
>>
>>51720131
Create an engine with Unities/UE4 performance, stability and lighting capabilities by yourself in less than 5 years. Go on.
>The lower you go the more control you have.
So you agree that the only valid course of action is your own engine, built on your own graphics library, running on your own os, all created with your own language and compiled with your own compiler.

There's a reason companies don't make their own engines on a whim, and when they do it's often with the purpose of licensing them to other large game companies or at least sibling companies.
If it takes ID or Activision or Crytek or Epic 5 years+ with hundreds of employees to reach a licensable version of their engines why the fuck would you tell an indie game developer to do the same thing.
I honestly cannot comprehend how stupid you are.
>>
>>51719946
>Setting up a cluster in erlang is really easy
so, RPC... is there any language that cannot do this? granted, it does look easy, but Go's way doesn't seem to be too hard, at all: https://golang.org/pkg/net/rpc/
>>
>>51720176
pretty dank desu
>>
>>51719840
> freeglut or GLFW?
For what purpose? GLUT is fairly limited (it was originally designed for writing example programs, not applications). But GLFW isn't much better in that regard. Personally, I use GLUT for the cases where it's sufficient, and either SDL or Qt when it isn't.

>>51719874
> Glut is deprecated.
By who? FreeGLUT is still being maintained and developed.
>>
>>51720247
Not the guy replied to, but I don't see any sort of client authentication on that page.
>>
File: 1406281616972.gif (97 KB, 346x360) Image search: [Google]
1406281616972.gif
97 KB, 346x360
>>51720209
John Riccitiello detected. No Unity isn't good fuck off kike. The initial case was people shitting on people that do want to make their own engine in a misguided effort to justify their decision to not learn how to code.
>>
>>51720131
>i want to make a game
>THEN MAKE YOUR OWN GAME ENGINE!

>i want to make a website
>THEN MAKE YOUR OWN SERVER

>i want to make a desktop app
>THEN MAKE YOUR OWN OS
thats how you sound
>>
>>51719985
Try adding Keyboard.nextLine() after every instance of Keyboard.next().

You probably have a newline '\n' left in the input stream left that fucks up your input.
>>
>>51720304
I think the point is that people who want to make their own engine, server, or OS shouldn't be demonized.
>>
>>51720313
^this
>>
>>51720304
No it isn't. In fact it is the opposite of what you said. It's people that want to code getting shat on by people that don't.
>>
>>51719704
> I need to have a timer, which ticks every second. How do I make it tick even when waiting for user input?
By polling for user input rather than waiting for it.

The details depend upon which API you're using for input. If you're just reading from stdin, the Unix approach is to use select() or poll() with a timeout on descriptor zero. Not sure about Windows; maybe WaitForSingleObject().
>>
>>51719840
use a full GUI windowing toolkit with OpenGL so you can make professional and full featured window apps with file menus. most crossplatform gui toolkits like qt and wxwidgets have a graphics canvas that will support OpenGL
>>
>>51720313
You're a carpenter making a fucking table? Tables have been made for thousands of years, stop reinventing the wheel and buy one.
>>
>>51720290
>The initial case was people shitting on people that do want to make their own engine in a misguided effort to justify their decision to not learn how to code.
Yet when the argument is extended beyond the game engine you say that's stupid.
Seems to me like you're just a retard.

>>51720313
But they aren't. They're just told it's a waste of time unless they're more interested in the enginedev than the game. Because it is. Just like making a custom server for every client is a waste of time when you're a web developer or making your own OS when you want to make a word processor is a waste of time when your a software developer. Unless of course that;s what they're most interested in doing. Which is fine.

>>51720331
Yes, it's actually exactly what you sound like.
> It's people that want to code getting shat on by people that don't.
Well that's funny, since you're shitting on people who just want to code their game without worrying about implementation. To quote
>Unity is for 10 year old kids
Or your response to it (though I suspect you're samefagging), apparantly summarising everyone who says "don't reinvent the wheel" regardless of context:
>S-STOP REINVENTING DA WHEL FAGGOT, CHECK OUT MY COOL 2D PIXEL PLATFORMER

So again, you're a moron, and a hypocrite. But mostly a moron.
>>
>>51719840
https://www.youtube.com/watch?v=qVPA3YET4oU
>>
>>51720389
>But they aren't. They're just told it's a waste of time unless they're more interested in the enginedev than the game. Because it is.
You're right that it's a waste of time if you just want to get a finished product, but you're wrong about how "enginedevs" are treated.
>>
>>51720389
he's not samefagging
>>
>>51720389
Literally the post that started all this mentioned /v/ dev general. They absolutely are demonized. It is impossible to even hint that you are making a game without a prebuilt engine without swarms of nodevs descending upon you and screeching "STOP REINVENTING DA WHEEL, MAKE UR OWN LANGUAGE IF UR SO GOOD LOL"
>>
>codeeval rank is 611
>go to bed
>wake up
>codeeval rank is 604
I wonder how many people make an account, fail the first fizzbuzz challenge and then never come back?
>>
>>51720415
It's not a waste of time though because literally every prebuilt engine has limitations stemming from the fact they are designed to be one size fits all.
>>
File: 5831445740_65f781a47a_z.jpg (151 KB, 434x640) Image search: [Google]
5831445740_65f781a47a_z.jpg
151 KB, 434x640
>>51720442
I still have yet to get 100% on that and I don't know what I'm doing wrong.
>>
>>51720473
Usually, the people who are only concerned with finishing a game and joining the "yesdev" ranks or putting it on Steam or whatever don't care. And as an enginedev, I don't think you're giving Unity or UE4 enough credit.

It's ostensibly true that they aren't silver bullets, but they're good enough for most.
>>
>>51720209
If your goal is to create an actual game you obviously wont write an engine like UE4 since that is a somewhat general purpose and licensable engine.
When you're writing your own engine from scratch that is tailored to a specific game you have much more focused goals and will only implement the features your game actually makes use of.
There's absolutely no reason to implement a really realistic physically based rendering system if you aren't even capable of making/getting that kind of content (textures, models, mo-cap animations, etc) for example, so you can probably get away with simple lighting models based on some hacky solution tried in older games.
>>
>>51720415
>>51720435

I frequently lurk agdg, there's been plenty of engine devs their get their due respect. The people who don't are the ones like you, who insult anyone who isn't an engine dev (which is just a juicy cut of irony given your victim complex) as being kids, or inferior.

The closest thing to what your describing is the "engine devs are nodevs" meme which is about as non malicious as can fucking be.

>hurr durr ur just a salty gamedev
Before you go there, I do not do game or engine dev. I lurk their because I like to see what people are doing.

You sound like those fucking twitter feminists who think the whole world is out to get them because someone spread their legs on the train
>>
>>51720516
>The people who don't are the ones like you, who insult anyone who isn't an engine dev
Nice accusations.
>>
>>51720473
This there's been so many games and devs who used engines like Unity who wish they had not.
>>
>>51720505
You're probably outputting trailing spaces in your output.
The output has to match the reference output exactly.
>>
>>51720510
Except the vastly overwhelming majority of games have no, and have no intention of, implementing features that wouldn't be easier and better performing with a premade engine and custom script.
>>51720527
>Nice accusations.
>Unity is for 10 year old kids
>S-STOP REINVENTING DA WHEL FAGGOT, CHECK OUT MY COOL 2D PIXEL PLATFORMER

You fucking idiot. Whichever one, or both of them, that you posted. you literally and demonstrably did that.
>>
>>51720572
I didn't post either. There is more than one person on 4chan who disagrees with you.
>>
>>51720572
I posted 5 words and got this flame war
>>
File: muhgamefromscratch.webm (2 MB, 640x360) Image search: [Google]
muhgamefromscratch.webm
2 MB, 640x360
C and SDL2
>>
>>51720572
>Except the vastly overwhelming majority of games have no, and have no intention of, implementing features that wouldn't be easier and better performing with a premade engine and custom script.
[citation needed]
>>
any idea why it's acting like only 2 of the 4 zeros are there at the beginning? i'm going to post a drawing of what it's doing soon

Node* treeFromBinary(BFILE* filename)
{
if(readBit(filename)==1)
{
Node* leaf = new Node(readByte(filename));
return leaf;
}
else if(readBit(filename)==0)
{
Node *left = treeFromBinary(filename);
Node *right = treeFromBinary(filename);
Node *nonleaf = new Node(left, right);
return nonleaf;
}
else
{
printf("end of file\n");
return NULL;
}
}


this is the code for the functions used inside.

struct BFILE
{
FILE* file;

BFILE(FILE* f)
{
file = f;
}
};

/***********************************************
* readBit *
***********************************************
* Read one bit from file f and return it (0 *
* or 1). At end of file, return EOF. *
***********************************************/

int readBit(BFILE* f)
{
int c = getc(f->file);
if(c == EOF) return EOF;
else return c - '0';
}

/***********************************************
* readByte *
***********************************************
* Read one byte from file f and return it. *
* At end of file, return EOF. *
***********************************************/

int readByte(BFILE* f)
{
int r = 0;
int b;

for(int i = 0; i < 8; i++)
{
b = readBit(f);
if(b == EOF) return EOF;
r = (r << 1) | b;
}
return r;
}

>>
>>51720622
neat
>>
File: 1423277746248.gif (437 KB, 245x118) Image search: [Google]
1423277746248.gif
437 KB, 245x118
>>51720572
>Enginedevs aren't demonized
>Proceeds to go on a tirade about how stupid engine devs are calling everyone in the thread morons and idiots
>>
>>51720641
thanks chump
spent a couple months on it so I post it to feel like I didn't waste time
>>
>>51720656
My thoughts exactly.
>>
>>51720603
Then you're an even bigger moron than he is.
>I'll just jump into a conversation, call something targeted at a specific person a lie, then say "i'm an innocent victim in all this" when the issues being discussed are quoted

>>51720628
Name 10 features in popular (for simplicity lets say 2d) games that would have been better implemented had the engine been built from scratch.
There's a case to be made for gamemaker being limiting, but there's plenty of more advanced 2d engines.

>>51720656
>call a moron a moron
>say that engine devs who's interest is actual engine deving should be respected for it, but stop trying to accuse non engine devs of being kids
>UR CALLIN ALL ENGINE DEVS MORANS
You're also a moron.
>>
>>51720676
that your own pixelart?
>>
>>51720704
>say that engine devs who's interest is actual engine deving should be respected for it, but stop trying to accuse non engine devs of being kids
I don't think this has ever happened. There are plenty of people who will say things like "wow really using >Unity your game needs to be in Assembly" but can you really say that they're demonstrably productive enginedevs?
>>
>>51720622
>buttons have no feedback on mouseover
0/10
utterly useless and waste of time
>>
>>51720721
nah

>>51720740
i wrote the entire menu system in two nights before due date
i could add it in like 5 seconds if you want lmao
>>
>agdg hates engine devs
>there's at least 2 games on agdg at the moment getting praise that are running on home made engines

>>51720732
Do I really need to quote the "unity is for 10 year olds" post again?
I'm not saying non-engine devs are inherently nicer on agdg (and lets face it, 4chan isn't indicitive of non 4chan communities) but they're at the very least no worse than the engine devs are on average and in my experience use more memes than putdowns.
>>
>>51720676
you'd have spent a week on it if you'd used python
>>
>>51720778
that defeats the purpose
I'd have spent a couple hours if I used an engine
>>
>>51720704
>Name 10 features in popular (for simplicity lets say 2d) games that would have been better implemented had the engine been built from scratch.
All of them.
Things are always technically better when implemented from scratch and built custom for a specific project, the only redeeming aspect of using pre-built things is if you aren't capable of implementing it yourself or don't have the time to do it.
Using other peoples libraries and tools are always a big technical burden - it's extra dependency management, annoying build systems, licensing and support issues, basically always a lot of friction to integrate into your own code.
>>
Is the guy doing sshchan in here?
>>
File: tree diagram.png (16 KB, 1000x400) Image search: [Google]
tree diagram.png
16 KB, 1000x400
>>51720635
here's the pic i drew. i know for sure that the tree represented with 1's and 0's in the text file is correct because i decoded it by hand and it was right. as you can see, the incorrect tree being read in is a subset of the correct one. i'm not sure whats causing the issue
>>
>>51718929
>What uses does Erlang/Elixer excel at in the modern day?
Elixir/Erlang can handle concurrency at a huge scale because it doesnt use locks that make threads wait and take turns using shared memory. It can spawn hundreds of thousands of very light weight processes on a single CPU that use message passing to communicate, so they dont share memory and they dont have to wait their turn to execute. A web server like Apache uses operating system threads to handle its concurrency, so the OS is managing all the issues related to locks/threads. Web servers can get away with using this primitive kind of concurrency with no interprocess communication because each server request can be handled in isolation without having to store data from previous transactions. In systems where you do have to maintain a socket connection and stored data like in a ptp network or messaging system with millions of users, then you need a system like Elixir/Erlang. Elixir/Erlang goes beyond being able to handle process spawning but has the OTP which is a framework for managing a huge hierarchy of processes in a fault tolerant way where there are managing processes that will take over for child processes that crash. There is nothing out there like the OTP for managing large scale concurrency as easily and efficiently as the OTP because it was designed for maintaining telecommunications with millions of simultaneous connections
>>
>>51720773
chill out
>>
>pre-made engine users feelings insecure
>>
>>51720767
explain that to the teacher
anon, see me after class
>>
>>51720860
heh
>>
>>51720821
>>51720635
i just realized that the if and else if are meaning i read two direction bits at once instead of 1
>>
>>51720804
i'm all for people learning and appreciating C but to develop anything big in it that's not a kernel or running in an embedded environment is a waste of time

my thinking is that if you learn how a language like python is made using C, and then you learn how a game is made using python, then you've effectively learned how a game is made using C, but you were able to save months of development time
>>
>>51720884
>and then you learn how a game is made using python, then you've effectively learned how a game is made using C
No, note even close.
>>
>>51720884
it was a final project for an introduction to programming with C course
I being the only student with prior C experience decided to do something that shows the class what C can do
If I wanted to make a game to make a game, I obviously would've used unity
>>
>>51720884
I agree with you that C is a waste of time, but Python is an awful language for programming games. C++ is my recommended "step up" for anybody using C.

Also
>my thinking is that if you learn how a language like python is made using C, and then you learn how a game is made using python, then you've effectively learned how a game is made using C
this is totally nonsensical.
>>
>>51720819
>All of them.
What a fucking copout
>Using other peoples libraries and tools are always a big technical burden - it's extra dependency management, annoying build systems, licensing and support issues, basically always a lot of friction to integrate into your own code.
Which goes back to my original rebuttel: This logic requires that you generate everything from scratch, because your engine will rely on graphics libraries, which will rely on an OS, which willy rely on graphics drivers.
Either third party libraries as a concept are inherently bad, or inherently have a place. You don't get to pick and choose an opinion like that.

The only way what you're saying could ever be true, is if that you as an individual are better at producing a large code base for a graphical, sound, input and gameplay system, with better performance than longstanding, well established and contributed to projects, can buttest and debug better than those communities, and can do all this faster than those communities.

I guarantee you cannot do that. What you MIGHT be able to do, and it's not an invalid option at all, is using the lowest level libraries you can get away with to make the minimum possible engine for you game which prioritizes size over features, stability and community
>>
>>51720884
the lower level you go - more satisfaction
>>
>>51720510
The term 'game engine' can mean almost anything. You can make a simple demo in OpenGL that allows a user to move around pixel shaded triangles on a screen with the arrow keys in a couple hundred lines of code. Technically all you would have to do is add a music track and it would qualify as a game that would equal games that existed in the 70s/early 80s
>>
so regex and the like has always, always frustrated the shit out of me because, and I admit, I have no idea how to use the tools.

I'm trying to make a battery monitor in bash that alerts me when the level is low.

I'm using acpi to report the battery.
simply running acpi generates:
~ » acpi
Battery 0: Discharging, 11%, 00:45:26 remaining


I've managed to jury rig something using cut which outputs just this
~ » acpi | cut -d',' -f2
10%


I'm getting closer, but I need the raw battery level. My cut hack has extra whitespace and a % at the end. I don't know how to get rid of them.

Can someone help me out here?
>>
>>51720911
>>51720923

yes because in the extreme case you just rewrite python and then use that to make the game

it's a transitive relation you literally can't argue with that
>>
>>51720933
this guy
>>
>>51720933
this
once i could move the camera around and have actual bricks I was ecstatic
10 minutes in unity
>>
File: plebs vs pats dpt.png (56 KB, 839x777) Image search: [Google]
plebs vs pats dpt.png
56 KB, 839x777
>>51720884
>>
>>51720927
>This logic requires that you generate everything from scratch, because your engine will rely on graphics libraries, which will rely on an OS, which willy rely on graphics drivers.
Impressive mental gymnastics.
>I'm going to do an engine swap
>WOW YOU FUCKING SCRUB EITHER MAKE YOUR OWN CAR FROM SCRATCH OR LEAVE IT EXACTLY AS IT IS
>>
>>51720635
Doesn't the
readBit()
function that you call on your if's do additional getchars that you don't want?
>>
>>51720967
^true
>losers will argue
>>
>>51720973
Ironic enough, because it was you who said it not me
>Things are always technically better when implemented from scratch and built custom for a specific project
>>
>>51720992
>you
>>
>>51720933
the lower level you go - more satisfaction
>>
>>51721000
>>51720999
nice
>>
>>51720820
I'd like to contribute to sshchan if you're here.
>>
the lower level you go - more satisfaction
>>
>>51720967
>compiled languages vs every commonly used scripting language
full retard fizzbuzzer alert
>>
>>51720999
>jumping into conversation threads, not reading them, putting out an opinion, and acting surprised when someone calls you out for being the other person saying something stupid.
>>
>>51720981
it was because i was calling readbit twice with the if/else if. i put it inside a variable once at the beginning instead and now it's working perfect
>>
>>51720992
But it's undeniably true that if you were able to write a game and its engine as a kernel and drivers running on bare metal, it would be more efficient and give you more control.

The great thing about software layers is that you get to choose where to stop. You're not being dishonest or hypocritical if you say that the OS is good enough but you don't want to use a premade engine.
>>
>the lower level you go - more satisfaction
can't deny this
>>
>>51720967
>PHP
>>
>>51720927
>What a fucking copout
You made the original claim, lets see your evidence. Not gonna do your work for you.
>This logic requires that you generate everything from scratch
Nope, no one in this thread has said make *everything* from scratch.
>you as an individual are better at producing a large code base
That's where your fundamental misunderstanding lies.
The point is that you don't ever get to a massive code base when you custom tailoring things, when you're writing towards a specific 2D platformer game you will never get to hundred of thousands of lines of code because your game wont ever have that many features.
>What you MIGHT be able to do, and it's not an invalid option at all, is using the lowest level libraries you can get away with to make the minimum possible engine for you game which prioritizes size over features, stability and community
That is absolutely a valid option and in fact the best possible option you idiot. YAGNI.
>>
yeah when you're a NEET retard and your time is essentially worthless go as low level as you want
>>
>>51721077
girly faggot, subiq brain
>>
>>51720951
>yes because in the extreme case you just rewrite python and then use that to make the game
That's not an extreme case, you would HAVE to do that for your point to even make sense, but:
>it's a transitive relation you literally can't argue with that
It's not.
>>
>>51721093
>Just trust me you dumb fucks, use Unity.
>>
>>51721077
is hating php a new dank meme?
>>
>>51718225
Try using clang/gcc and pass -Wall -Wextra -fsanitize=address -fsanitize=undefined -ggdb

Then the compiler give you more warnings/errors when compiling and it'll tell you when you from what line you crashed and what the reason was most of the time.
>>
>>51721093
frustrata
>>
>>51721077
Only power level 1000+ programmers can appreciate the incomparable genius of PHP.
>>
>>51721112
retarrds
>>
>>51721112
No it's an old classic meme
>>
>>51721103
it is
>>
>>51721112
I thought defending php was the dank new meme.
>>
>>51721143
for ones who can't handle it
>>
>>51721146
Prove it.
>>
>>51720938
got it
grep -o '[0-9]\+'
>>
>>51721038
>But it's undeniably true that if you were able to write a game and its engine as a kernel and drivers running on bare metal, it would be more efficient and give you more control.

It's absolutely deniably true. Because unless you specialize in all of those things and spend huge amounts of time on them, you will never produce more efficient and bug free code than a collective project targeting the same thing.
Operating systems are not simple. Low level graphics libraries are not simple. 3d game engines, physics engines and lighting engines are not simple, and when they are simple, they're universally bad.
Only someone with the worst known case of the dunning kruger effect could say otherwise, and they would be laughed at by any serious developer or academic.
If it was that simple, everyone would be doing it.

>You're not being dishonest or hypocritical if you say that the OS is good enough but you don't want to use a premade engine.
Not necessarily, no. The people in this thread I've been responding to, however, are. They don't get to make a sweeping claim, then slowly pull back on it as they realize how stupid it was originally while maintaining otherwise.

>>51721079
> prioritizing size over features, stability and community is the best possible option
>prioritizing file size
>more important than stability
>than community fixes
>than many eyes looking for inefficiencies
>kb of binary
>more important than not crashing, obscure bugs, framerate issues and freezing
>being capable of maintaining this opinion
Did I fall into a yahoo answers?
>>
>>51721216
Where can I buy your book?
>>
>>51721233
All good bookstores and amazon
>>
>>51721241
Nice. I've been looking forward to reading The Maddest Anon.
>>
>>51721163
take x, y, z such that you know how y is made using x and you know how z in made using y
make y from x
make z from y
you have made z from x, indicating that you know how to make z from x
therefore it's transitive fuckboy
>>
>>51721277
It's the best book around for logical, reasonable opinions on software development choices.
Linus torvalds endorsed
>>
>>51721285
You know an extremely inefficient way to make Z from X.

What if I told you that you could make Z directly from X and have the final product be much more pure?
>>
>>51721216
>Did I fall into a yahoo answers?
You have a false dichotomy going on.
Keeping things small, focused and custom made reduces bugs (hell of a lot easier to understand and fix bugs in code you've written yourself as opposed to 3rd party code), makes things more stable (you reduce the number of moving parts, no shitty weird libraries and interfaces that need to be glued together because they are written by widely different people using widely different design approaches) and what the fuck does 'community' even mean?
>>
>>51721312
what if i told you that now for EVERY OTHER THING that you wanted to know how to make using X, you could now simply use Y, saving you an infinite amount of time as the number of things you want to learn to make using X tends towards infinity
>>
>>51721285
>you have made z from x, indicating that you know how to make z from x
You have not provided any evidence for this claim.
>>
>>51721353
What if certain things were best done in X, still? Y might be better for some, but not all.
>>
>>51718172

>Mirrored below if you don't care about leaderboards
Thank you. Fuck people hiding content behind a social media wall.
>>
Does anyone have some good learning sources on functions in C++?

I'm trying to make a function which loads data from file, puts it in array, and then main can read from that array, but for the god of me I have no idea how to return an entire array.
>>
>>51721414
Use a vector.
>>
>>51721422
I'm a beginner and have no idea how to use one, mind elaborating?
>>
>>51720938
You can read from

/sys/class/power_supply/BATn

were n is usually 0,1,2
>>
>>51721437
read Absolute C++ by Walter Savitch
>>
>>51721357
you started with x and ended up with z, what other explanation could there be except that you know how to make z from x

>>51721380
define "best done in"
>>
>>51721437
They're sort of like arrays, but have an arbitrary size and you can return them since they're self-contained.
// C
int numbers[3];
numbers[0] = 100;
numbers[1] = 150;
numbers[2] = 175;

// C++
std::vector<int> numbers;
numbers.push_back(100);
numbers.push_back(150);
numbers.push_back(175);
>>
>>51721458
Are you saying that C is not orders of magnitude faster than Python, and that it doesn't allow you access to memory?
>>
Can anyone give me any tips in designing an adjacency matrix for weighted edges which connect multiple graphs? For example, should I design a hash function (might be too much time, the project is due in a week) for a 2d matrix or create a matrix with 3+ dimensions. It's for a machine learning algorithm for Blackjack.
>>
>>51721438
this is so fucking cool
everything really is a file
>>
File: weee.png (32 KB, 940x1047) Image search: [Google]
weee.png
32 KB, 940x1047
I re-made pong today in js for the craic
>>
>>51721515
did you write the engine yourself
>>
>>51721515
cool, let me play
>>
>>51721458
>you started with x and ended up with z, what other explanation could there be except that you know how to make z from x
You have not demonstrated any transitive relation.
Implementing y in x does not necessarily mean you exercise all features of x, and implementing z in x might require you to use those features you never got familiar with when implementing y.
>>
d-does .bat files count as coding senpai? >.<
>>
>>51721528
lol, nah i used unity and unreal torunament
>>
>>51721553
yes but it shouldn't
copy-pasting stuff from online isn't
get off windows
batch files were cool in second grade
>>
>oversimplify real life situation into a poor analogy
>if the analogy has a problem, then real life must too!
4chan: the argumentative technique
>>
>>51721528

HTML5 Canvas
>>
>>51721500
Yeah

to get your current charge out of a 100 in percent

// pseudocode

(charge_full_design or energy_full_design) / (charge_now or energy_now) * 100
>>
>>51721489
>muh efficiency
>0.5 seconds of execution time is worth extra months of development time for a program that only i will ever run

>>51721537
what does exercising all of the features of something have to with anything? if you don't use sockets to implement fizzbuzz in C, does that mean you don't know how to implement fizzbuzz using C?
Thread replies: 255
Thread images: 30

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.