« first day (897 days earlier)      last day (4052 days later) » 

2:00 PM
but it certainly got a speedup, yes
I mean GPUs are so fast it's really absurd
 
I am constantly amazed at what mine is able to do
if you only keep the data and let it render
Recalcing is also my fault
 
I have a 2D lighting issue.
 
Go see a doctor
 
2:02 PM
Yes. The way I see this, it would be dark, with.. say, lamps/torches, which would make things brighter around their radius.
 
Yes that's how we define lighting
It lights things up
 
I had been drawing a translucent dark rectangle over the window, and then transparent white from the lamps, but.. this has flaws.
 
user142019
@Pawnguy7 that's not very difficult.
 
@Pawnguy7 you need blending
Proper blending, that is.
 
I am not certain the best way to go about it, because my way is not correct.
 
2:04 PM
Shaders are easiests.
 
Would blending be more of actually lighting the pixels as I intended?
 
blending is mixing the data
there is no "light" on pixels
there's only data.
 
Oh look what's that
A Google query?!
41
Q: How is 2D lighting implemented?

Christopher HorensteinI am wondering what the best way to approach a "lighting" effect in 2D games is. For instance, if my main character is glowing, what techniques can I use to complete the visual effect of the character glowing when it is near other objects which would be affected by the light?

 
@CatPlusPlus meh first answer is a fucking linkdump
 
@Magtheridon96 The @Cat speaks the truth here. I used very little assembly. It was almost entirely SSE intrinsics and lots of micro-optimizations.
 
2:05 PM
@BartekBanachewicz So?
 
There are few things more annoying than speaking German to a native and getting a reply in English.
 
Click the links lazy
 
@Mysticial You're awesome.
 
That is a pretty nice effect, actually, but what I desire is simpler.
Not to mention, I don't know if GM allows use of shaders.
 
@R.MartinhoFernandes They're just politely indicating that your German sucks
 
2:06 PM
@Mysticial I'd call you my hero if it wouldn't make this awkward
 
@CatPlusPlus They are fucking assholes.
 
@Pawnguy7 don't use GM problem solved
 
If I wanted to speak English I would.
 
ahah
if they wanted to speak German they would
 
@Pawnguy7 GM?
 
2:07 PM
@Magtheridon96 I used snippets of inline assembly in a few places. But it's definitely not a major part.
 
@CatPlusPlus game maker
 
@Magtheridon96 um...
 
now run.
 
@BartekBanachewicz Yeah I wonder if that's that
 
@R.MartinhoFernandes You couldn't even pass a captcha!
 
2:07 PM
@BartekBanachewicz Maybe I should get back at them in Portuguese.
 
@BartekBanachewicz Probably. Still, I feel that my simple lighting is achievable within. I beleive there are blending functions.
 
Because it wasn't very good last time I checked
And also non-free so
 
@Pawnguy7 also why the fuck should I care exactly?
that's not even remotely related to making games
 
because that software is a terrible and utter crap for morons
 
2:08 PM
It's a tool
It's not a very good tool, but still
 
so is Eclipse
go figure.
 
Right in the nuts.
 
The "it's not real programming" thing is complete bullshit
 
well okay, that was too much
 
It's exactly the same with Unity or UDK, except the language is different
 
2:09 PM
touche.
 
That stupid UDK not remotely related to making games :argh:
 
ok, so let's just say the limitations of it are well known and you should be aware of them
because heck, that's the downside of using ready-made engine
limitations
 
@Magtheridon96 Granted, it is possible to do better than intrinsics using pure assembly. But the cost-benefit curve is pretty steep. And most of the time, it's not worth it even when performance is critical. Proper use of intrinsics can get you pretty damn close to optimal assembly anyway - with the benefit of being more portable.
 
Eh, limitations
Your engine has limitations too
 
my engine in its current form is a thin OpenGL wrapper
 
2:11 PM
It's a non-issue
 
so well yeah you could say OpenGL has limitations
point is, are the limitations of GM/UDK too much or not
if not, use them obviously
 
however, limitations of GM are so extremely dumb
 
Well, GM maybe, because it's not a very good tool to begin with
But it's typically a non-issue
 
so what you are picking at exactly?
 
2:12 PM
I don't know
I forgot what we're talking about
2
 
that's classic.
 
user142019
There are people who use a DLL for doing OpenGL in GM lol.
 
I ain't even wanna know about that
spare me the details.
 
@Mysticial I acknowledge that the cost-benefit argument is completely sensible, but I can't get it at the moment because I'm messed up. I waste way too much time on unnecessary bs, so when the cost is time, I don't feel the need to care :c
 
@Magtheridon96 s/necessary/unnecessary/ FTFY
 
2:15 PM
Good catch.
 
@Magtheridon96 Yeah, Prime95 in GIMPS is one of those rare cases. It quite literally is the author's lifetime hobby. So he has unlimited time to pour into it.
 
    template<typename T>
    void push(T&& t) {
        boost::apply_visitor(detail::push_variant(m_LuaState), variant(std::forward<T>(t)));
    }

    template<typename T, typename... Args>
    void push (T&& t, Args&&... rest) {
        push(std::forward<T>(t));
        push(std::forward<Args>(rest)...);
    }
 
does boost::variant even support move semantics?
 
I don't know
I am not moving it
I am moving args.
 
2:17 PM
Likewise, it was similar in my case with the Pi program. But due to the sheer size and scale of it (likely many times larger than Prime95), I can't really put infinite time into every micro-optimization and expect to finish it.
 
@Mysticial I wish I had that kind of time. School isn't teaching me anything I don't already know at this point, but I still need the dang degree ;(.
 
but yeah variant(forward(t)) is probably variant(t) anyway
who cares.
 
Variant:

Added rvalue constructors and rvalue assignment operators (for C++11 compatible compilers only). Library now can be used with move-only types (#7620, #7718).
 
WTF
If I plug in headphones, sound dies.
 
user142019
Turn the headphones' volume on.
 
2:22 PM
@LucDanton aha! 1.53?
 
@Zoidberg Tried that. Tried a different set of headphones too.
 
I am still using 1.52, I have to update eventually
 
Oh well... reboot time maybe... :/
 
hm
how can I get the value that variant was constructed from?
 
2:26 PM
On the other hand
main.cpp:12:5: error: static assertion failed: teh suxx
     static_assert( !std::is_copy_constructible<boost::variant<std::unique_ptr<int>>>(), "teh suxx" );
     ^
 
or wait I have to use that visitor
@LucDanton why should it be?
 
user142019
@LucDanton lolwot
 
user142019
Isn't that bad?
 
user142019
@BartekBanachewicz !
 
2:28 PM
Wait, why did I wait until inheriting constructors to even enable that? I didn't need to.
 
@Zoidberg I always forget if true triggers the assert or false :/
 
user142019
false, silly. :P
 
user142019
You assert something is true.
 
user142019
If it's false, the assertion fails.
 
@Zoidberg It is what you get when you don't use SFINAE.
 
2:30 PM
@R.MartinhoFernandes so that is #14?
 
You can't SFINAE special members.
 
> Note: I'll just check the the first type. Variant's design somehow makes the first type important. It's the one that's default constructed and it's (almost always) a nothrow-default-constructible type.
???
 
whag
dsfafsaf
 
2:34 PM
Also WTF, headset works on Linux but not Windows?
 
also visitor design is nice, but clumsy to write "in situ"
 
user1357851
 
user1357851
Awesomeness ...
 
but yeah, anything better would essentially state that normal boost.variant is bad somehow
 
> #5871 variant constructible/assignable from anything
Unconstrained conversion constructor.
 
2:37 PM
@BartekBanachewicz That can be mitigated somewhat.
 
@R.MartinhoFernandes do you have anything in particular in mind?
 
Not bad, just... different ;_;
 
Reading the tickets gives some insight into the implementation. It's a bit wtf :s
 
@Magtheridon96 different from what. ah, I see what you mean
 
2:39 PM
haha, I can see the discrete from here.
 
@Pawnguy7 not smooth
 
Yes, I am aware of GM's limitations, but I don't know OGSL either.
 
@R.MartinhoFernandes correct
@Pawnguy7 GLSL* FYI
 
Sorry. Internet.
 
@Pawnguy7 what?
 
2:40 PM
Ah. I thought I had it wrong. I think the other is HLSL though.
Lost connection.
 
HLSL is DirectX one
 
DirectX or Direct3D?
 
Fuck this shit.
 
What is HLSL? Sounds like High-Level Shading Language or something
 
Correct.
 
2:43 PM
Why not Hot Lingerie Sale Location? ;_;
 
Referring to the above picture, though, I don't know where the lines came from.
 
what what what? zip supports lzma for compression?! fuck. why nobody told me that before =\
 
@Pawnguy7 Show shader or no assist
 
I don't have a shader.
In theory, that was GM drawing circles outlines, so I am not sure...
 
er
oh, right.
that never works because discrete.
 
2:51 PM
hhhokay... probably the hugest noob question ever... I get that pointers are pointers to places in memory, but what exactly does that mean in terms of USING them?
 
You can use the * operator on it to act on the value.
@DeadMG So this circular lighting is not possible?
 
it probably is, but you'll need a lot more brains about it
as in, try using a shader.
 
okay but like, what's the difference between for example int and int * ? Or char and char* ?
 
@Crowz An int says: "Here is an int." and an int* says "There's an int somewhere over there.".
 
@Crowz int is an integer value while int* is a pointer to an integer value, i.e. it stores an address of where that value can be found.
And if you use the * operator you can "follow" that address and get the value. Simple.
 
2:54 PM
to be more accurate, you gain a reference to that value.
 
@DeadMG Yes. :)
 
What was it? A reference is like a const pointer that is implicitly dereferenced.
 
screw that
pointers are like references you have to dereference
references are the primitive, not pointers.
 
LOL
good one
 
IS that sarcasm?
 
2:55 PM
ITT: Puppy teaching newbs what a pointer is
 
@Pawnguy7 Microsoft's STL maintainer is sort of against that way of thinking about them.
 
Or maybe noobs, since Crowz is here for ages and still has to ask
@Pawnguy7 bullshit
 
He thinks of them as just aliases for values.
 
and that's ok
 
Indeed.
 
2:56 PM
since references aren't objects
 
You are telling me references came before pointers?
 
we are telling you they are different
 
@BartekBanachewicz So do references occupy any memory?
 
@DeadMG okay but WHY? I mean, why not use an int instead of a pointer to where in memory an int IS? You know what I mean?
 
@Crowz Because sometimes you want to edit exactly that value.
 
2:57 PM
@Tuntuni hey, that's a nice question.
 
I know they are different. Note, in my comparison, I said "like". As in, its function is akin to that.
 
A great example is the WinAPI which relies heavily on you passing pointers to data structures that it then fills out for you.
 
@Tuntuni you can only change the value of an int * ?
 
@Crowz are you asking "why are we using pointers?"
@Tuntuni WinAPI isn't a good example or anything, except a bad API
 
We use pointers to point at things.
 
2:58 PM
@Crowz You can change both the value of the pointer itself (i.e. the address it points to) and the actual value it points to (using the * operator).
@BartekBanachewicz Ahaha, that's also true. :D
 
@Crowz Because you can't say "Here is an int on the heap".
or "Here is an int on another stack frame."
 
@BartekBanachewicz more or less. Noob question I know but I never quite get what the point of pointers is
 
you can only say "Here is my int in my stack frame".
 
@Crowz And easily googleable
RTFM.
I am going to get more food.
 
I don't understand half your acronyms
 
2:59 PM
@DeadMG I don't really think he knows what a stack frame is if he doesn't understand pointers first.
@Magtheridon96 Me neither ..
And I cba to look them up.
 
@Tuntuni I understand what a stack and a heap is
 
I think RTFM is "Right then my friend."
 
@Crowz Oh, sorry then ..
 
RTFM is "Read the fucking manual".
 
loool
I'm way off
 
3:00 PM
Well @Crowz, then you should see what they're useful for (if you know what stack frames are).
 
I like the friendly version better
 
^
 
You should see this :)
 
oh wait. The friendly version is RTMF not RTFM
 
Ell
@Magtheridon96 also that acronym doesn't work anyway xD
right then friend my
yeah exactly xD
 
3:02 PM
@Ell Yoda.
 
Rape the fucking mayonnaise
Read the fucking memory address
 
@StackedCrooked What language is that?
 
South African
 
Well, lightings out. Time to make the water physics.
 
user142019
3:06 PM
@DeadMG Dat pun.
 
user142019
@StackedCrooked Die Antwoord. I have a friend who loves them.
 
@DeadMG lol this is the most boring thing I ever read
 
Bye.
 
@DeadMG It's the BBC, it has to be news.
 
@DeadMG It was probably a slow day or something
 
user142019
3:07 PM
BBC means Big Black Cock. :v
2
 
@Zoidberg Stop it with the poultry.
 
Cocks are good for you
 
user142019
poultry |ˈpəʊltri|
noun [ mass noun ]
domestic fowl, such as chickens, turkeys, ducks, and geese.
 
user142019
lolwot
 
user142019
Oh, ORIGIN Middle English: from Old French pouletrie, from poulet ‘pullet’.
 
user142019
3:10 PM
 
user142019
^ BBC.
 
@Zoidberg LOL
Nice find. :)
 
What is all this cock talk?
 
user142019
 
user142019
3:15 PM
FINALLY.
 
Don
Oh woot here's my koala
 
do advertisers on youtube honestly think someone will watch a 3 minute ad?
 
@Crowz I can't even stand the 15 sec ones ...
 
The movie ones only show the "approved for all audience" screens before I skip 'em
 
@Zoidberg Yeah, how stupied
 
user142019
3:27 PM
It was a bad answer but OP accepted it.
 
user142019
So I asked mod to delete. :P
 
A, I see.
 
user142019
The code I gave searched the binary tree in O(n). xD
 
user142019
With == instead of < or >.
 
Don
Eh c++ keeps going "Fuck off" everytime I have some idea of how to do things
 
3:30 PM
isn't binary tree searches pretty much always O(logN) ?
 
@Crowz Wouldn't that be the binary search algorithm that is used on sorted data?
In computer science, a binary search or half-interval search algorithm finds the position of a specified value (the input "key") within a sorted array. In each step, the algorithm compares the input key value with the key value of the middle element of the array. If the keys match, then a matching element has been found so its index, or position, is returned. Otherwise, if the sought key is less than the middle element's key, then the algorithm repeats its action on the sub-array to the left of the middle element or, if the input key is greater, on the sub-array to the right. If the rema...
 
but when you insert data into a tree, isn't it sorted?
left is less than root and right is greater than root
Also, when these sites say a "dynamic variable" made by pointers, what is a dynamic variable? One which changes?
 
@Crowz No, they're refering to how it's made. Memory for a dynamic variable is allocated at runtime (on the heap).
bbl
 
what
are you still talking about pointers
what is wrong with you
@Crowz that's best-case
worst case is O(N)
 
but isn't O(N) basically when everything is on one side of the root, essentially making it a list?
 
3:38 PM
yes, correct.
it is still a BST though, just unbalanced
 
AVL trees kinda work for fixing that, don't they? I have one implemented in java
It's good for search but terrible at most other things
 
implementing data structures by hand is useless anyway
in most of cases
 
@Crowz RB trees are the most common self-balancing binary tree.
 
@BartekBanachewicz it's good for learning
DeadMG, didn't you have tutorials on C++?
 
Ell
Hm. How are realtime multiplayer games synchronised?
 
@Ell they send packets to eachother
 
Ell
Yeah
But
 
@Crowz maybe, maybe not. I don't really feel wiser after implementing a list
 
Ell
What about if two players do conflicting actions? Who decides who wins?
 
Yeah cause you're probably really experienced at programming.
 
3:46 PM
@Ell What?
it depends on the architecture
 
@Ell server
 
what kind of game are we talkin'?
 
user784668
@Crowz The Game
 
@Fanael we don't speak about the game
 
user784668
Oh fuck, I lost.
 
3:48 PM
I lost too
 
that shit's just dumb
 
oh c'mon
auto results = vm.callGlobal("ret");
for (auto & result : results) {
    std::cout << result << "\n";
}
I am victory.
 
Ell
Ah feck my internet is dying again, sorry if I double post!
 
@BartekBanachewicz That's a fail.
vm["ret"](args); is what it should be like.
 
what
ah, ah
nonono
we are going to make callable objects
auto ret = vm.bind_function("ret");
ret(args);
 
3:51 PM
that's... still terrible.
 
what. where. how.
 
look
you have tried to special case every fucking thing
instead of exposing a generic interface.
 
uh, like op[]?
 
if I have template<typename T> auto f(T&& t) { return t["str"]; }.
for example.
also, callGlobal is fucking worthless when you have bind_function.
 
it's a prototype
suggestions welcome.
 
3:53 PM
ok
 
so yeah, I think that op[] is nice
 
Ell
@DeadMG you could have said it in a nicer way :L
 
something like vm["ret"] to produce a Lua value is fine.
 
It basically means putting everything in one function
 
@BartekBanachewicz Lua's dynamically typed nature means that you effectively have to do something like this anyway.
 
3:54 PM
@DeadMG vm["ret = 5"] where is your god now?
 
wat no
vm["ret"] = 5;.
 
no, i mean what happens if someone types that in
 
Ell
they get 5 back?
 
i.e. operator [] might be unclear
 
what if someone types that in?
let Lua look up _G["ret = 5"].
 
3:55 PM
okey.
I can totally do that.
too bad we can go both ways.
auto v = vm["v"];
vm["x"] = x;
 
why the hell would you have vm.get[val] instead of vm[val]?
 
oh wait
it got mixed in my head
anyway, in the second case it should use something like VariantRef
or LvalueVariant
 
to be more accurate
it's a bit of a tricky case because of Lua's table insertion semantics
 
LvalueVariant is something I am afraid of
 
you'll need to return a custom proxy type.
 
3:59 PM
that's that.
VariantProxy.
 

« first day (897 days earlier)      last day (4052 days later) »