« first day (952 days earlier)      last day (4005 days later) » 

Ell
5:00 PM
yeah
wait.
 
model -> world -> view -> ndc -> window
 
Ell
yeah
 
right?
 
Ell
right
 
so projection happens in view -> ndc
either orthographic or perspective
 
Ell
5:01 PM
I think you are mixing together projections with coordinate systems
gimme a sec
 
const int TEN=10; // As if the value of 10 will fluctuate...
 
you mentioned them :p
 
that was awesome! :D
 
@GamesBrainiac That's quite handy in case you don't want ten to be ten anymore. You can change it here and have it changed throughout your whole program!! :D You should probably define variables like these for the whole set of real numbers. Never know which number you may want to change. ;D
@Ell sure
 
@Tuntuni Easier to use old FORTRAN, where you could change the value of a literal by passing the literal to a function, and assigning a new value to it there.
 
5:04 PM
@JerryCoffin LOL really? Ahahaha
 
Ell
  ModelMatrix
model -> world
            ViewMatrix
         world -> view
                ProjectionMatrix
                  view -> clip
                             OpenGL Defined
                          clip -> ndc -> window
 
@Ell Ya.
So after the ViewMatrix, what kind of coords are used?
 
@Tuntuni Really and truly. Though I'm sure it wasn't intended, I believe the first Fortran spec basically mandated that behavior. Some Fortran II compilers still had it too.
 
Before the projection matrix the coordinates are (x,y,z,1)
 
Ell
You start with your model, apply the model matrix (e.g. scaling your model to the appropriate size, rotating it, etc.)
Then you apply the view matrix (to move the camera/objects around)
Then you apply the projection matrix (for perspective/ortho)
 
5:05 PM
@JerryCoffin Oh lawd.
 
the projection matrix affects all 4 components
the fourth is used as a division in the end
 
Ya
So when defining positions for my vertices in actual code, what coordinates am I using?
 
@EtiennedeMartel We want LAN? :P
 
@Tuntuni One of those things you really needed to know, just in case an IBM 1401 should suddenly appear in your basement. :-)
 
I don't remember OpenGL having separate model/view matrices. Wasn't there a single stack of matrices for this?
 
5:07 PM
@JerryCoffin HAha I hope it does. :D
@CodesInChaos Yes.
 
@Tuntuni Some local system. How you transform them is up to you.
 
Ell
@CodesInChaos opengl doesn't force you to use any matrices now
 
@CodesInChaos It had a modelview matrix and a projection matrix.
 
I'm still angry they never published the real OpenGL 3.0
 
With tag dispatching you can approach pattern matching. This could be cool.
 
Ell
5:09 PM
@CodesInChaos what do you mean?
What was the "real" opengl 3.0 ?
 
The complete redesign they were working on for a few years
until they gave up and called the next minor revision of 2.x 3.0
 
@Ell There was a lot of discussion of an object-oriented (or at least object-based) API, but it was never made official.
 
Ell
ohh right
as opposed to giant state machine?
It's heading that way anyway bartek says, and you can see from the newer functions
 
somewhat similar to OpenAL without the stupid statemachine
 
So in the model space the coordinate system is relative to the model itself. In world, to the whole world, in view to the camera, in clip to the camera and in ndc between -1 and 1 for each direction?
 
5:13 PM
@Ell It seems to be headed in that general direction, but taking an extra 10 years or so to get there. Worse, in the meantime they've done a lot that was (IMO) clearly wrong. While OpenGL had a lot of old cruft that was better off removed, they've removed a lot that's still useful along with it.
@Tuntuni You can pick the limits you want in each direction. -1 to 1 is common, but if you wanted -.001 to +1e3, you could do that.
 
@JerryCoffin Oh, how would you do that? (Is the rest of the stuff is correct?)
 
OK, I need a little clarification on something. I'm having brain scatter....
2
Q: std::list.unique() should invalidate iterators?

grayasmI have this code: #include <iostream> #include <list> int main() { typedef std::list<int> list; int i0t[5]={-1, 2, 3, 3, 5}; list list_1(i0t, i0t+5); list::reverse_iterator ri0 = ++list_1.rbegin(); list_1.unique(); list_1.remove(3); int val = *ri0; // why is ...

I'm going with unspecified behavior at the moment rather than undefined...
 
@Tuntuni When you call (for example) glFrustum or gluLookAt, you specify the limits. I don't see anything wrong with the rest, but it's been long enough since I played with OpenGL coordinates that I can't say it's correct with any certainty either.
 
but I'm too damn fuzzy at the moment to say either way :|
anyone have an opinion
 
5:22 PM
@JerryCoffin Ah, ok. Btw, could you answer one more thing: when specifying vertex positions in actual code, which coordinate system am I using? AFAIK the positions are always specified in the range [-1, 1] for all 3 directions, so would it be NDC?
 
@CaptainObvlious It's unspecified what happens to the iterator after you do something that invalidates it. Attempting to use the iterator after it's invalidated gives UB.
 
Ahh. thank you
 
@EtiennedeMartel More like, BabyKnight has no idea of the requisite strategies against Swarm Hosts and his micro and multitasking are bad
 
@DeadMG Right, because Stephano can't be good.
 
nah, Stephano is great
but that was shown much better in Stephano vs Thorzain of the previous round.
this series just showed that BabyKnight can't deal with Swarm Hosts
er, the second and third games anyway, I didn't watch the first
 
5:25 PM
@Tuntuni Most code will just use model coordinates. As already noted, the range will be -1 to 1 by default, but you can change that if you want. For example, if you want to, it's entirely possible to use real-world scales, so (for example) 1.0 represents exactly one kilometer or one mile or one micron, or whatever scale you find convenient.
 
And if I have multiple models I want to place? Whose model coordinates am I using?
 
each model's vertices are specified in it's own co-ordinate system usually
then simply apply the desired world transformation to transform them all into one world co-ordinate space
 
One common way to think about this is a world graph
a tree where each elements coordinates are transformed with its own matrix and all matrices up to the root
 
@Xeo buzz?
 
Xeo
?
 
5:32 PM
i.e. each elements coordinates are relative to the parent
 
    Any(pred) {
        return function(range)[pred := std.move(pred)] {
            return ~All(function(val)[pred := std.move(pred)] { return ~pred(val); })(std.move(range));
        };
    }
I believe this should be correct?
 
Xeo
!All can also be None
Oh, wait, inverted predicate.
Yeah, that works
I have it similar for my meta::And, meta::Any and meta::None
 
awesome
I had a hankering that it should work
so presumably, if None(pred), then All(~pred)
 
Xeo
ya
 
awesum
 
5:36 PM
@CodesInChaos I'll try to think about that. What matrix is the current matrix by default in OpenGL?
 
Is everything in Wide immutable like Haskell?
 
watno
why would I do that
 
I don't know.
so Map modifies the existing sequence rather than return a new one?
cool
 
no, it does return a new one
 
Ah.
 
Xeo
5:38 PM
@Rapptz It's lazy, with per-element modification
 
There is a difference between not everything being immutable, and standard sequence operations modifying their input
 
Xeo
But it doesn't modify the old range
 
you can't mutate the existing sequence when the return type of Map might be an entirely different type.
 
@Xeo Ah right.
 
ah
no, I did not implement and.
let us do this promptly
right
so my algorithm series is now all, any, append, drop, dropwhile, filter, flatten, fold, foreach, map, none, take, and takewhile
 
5:54 PM
a function that creates a sequence with a single element might be useful as well
 
I have delimited [begin, end) and N copies of value as range creators
y'know
I wonder what the C++ Standard says about the namespace of lambda types.
 
Xeo
@DeadMG Nearest enclosing scope, IIRC
Or what do you mean?
@DeadMG I don't think Value is a particularly fitting name for the last one
You're missing an ana for an infinite list, btw. Repeat(x) is what Haskell has
 
@Xeo Yes (i.e., that's where the lambda lives).
 
@Xeo So this is guaranteed by Standard
@Xeo What would ana for an infinite list take as arguments?
@Xeo I agree that Repeat(n, val) is a better name.
 
Xeo
@DeadMG It's a bit like Replicate
 
6:04 PM
hmm
 
Xeo
Just a value, which is repeated indefinitely
 
so Repeat(n, val) is n vals, and Repeat(val) is infinite vals.
 
Xeo
Hm
 
I'm not really sure what the applicability of infinite vals is.
hmmm
I also noticed that one property of Wide ranges that I didn't intend but keeps coming up is that if you evaluate past the end you keep getting back empty optional, instead of UB.
 
As an example, sometimes you want to work on elements of a range + the indices of those elements. So you zip(integers(), r).
i.e. map (\(i, e) -> whatevs) . zip [0..] l
 
6:10 PM
@LucDanton I can get behind that, but that's not infinite copies of a pre-defined value, it's just an infinite sequence.
 
user142019
LLVM documentation WTF?
 
Gah.
 
@rightfold Just noticed?
 
user142019
> LLVMSizeOfTypeInBits — Computes the size of a type in bytes for a target.
5
 
@DeadMG Isn't an empty optional preferable to UB?
 
6:11 PM
lol
 
user142019
LLVM likes 1-bit bytes.
 
the sizeof stuff isn't so great.
 
user142019
Does it work at all?
 
@Borgleader Yes, but strictly, it should be UB.
@rightfold Seems to work for me. I don't recall where I used it, but it seems OK.
 
user142019
Ah okay, thanks.
 
6:11 PM
oh yeah, Clang's fucking ridiculous type punning shit.
 
user142019
I'll need it for allocating objects on the heap.
 
I should stop sucking and start working on my game engine -.-;
 
The LLVM size function that seems to correspond to sizeof() is getTypeSizeInBits (/ 8 obviously)
 
@DeadMG I'd have to reread the exact wording to be sure, but I don't think so. The nearest enclosing scope of your lambda is the body of f, so that's where its type is defined, so it's only visible inside of f, not in the surrounding namespace.
 
@JerryCoffin Would be a pity. I implemented lambdas that way in Wide and it's quite useful.
 
6:15 PM
@DeadMG I'm checking the exact wording right now.
 
user142019
@DeadMG / CHAR_BIT :v
 
@rightfold Always 8 in LLVM.
 
user142019
Oh.
 
and by extension, always true for Clang as well.
and always true on MSVC since they only target x86 and ARM.
so I think only GCC and minority embedded actually target any non-8-bit byte platforms.
 
@DeadMG "The closure type is declared in the smallest block scope, class scope, or namespace scope that contains the corresponding lambda-expression." So yeah, I think that means the lambda is declared inside of f ("block scope").
 
user142019
6:17 PM
and always true in practice. ( Í¡° ͜ʖ Í¡°)
 
@JerryCoffin I guess that the logical followup to that is "Does that mean that ADL can't find the operator?" since intuitively, a name declared in a nested scope of the namespace will look in there for ADL, if I remember correctly (but not quite sure)
 
@DeadMG True for current versions of MSVC, but (at least arguably) not for the Windows CE version. It sort of still defined a byte as 8 bits, but did not allow you to use an 8-bit type. The smallest thing you could use was a short, with sizeof == 2.
 
@JerryCoffin Hmm, that's.. strange :P
 
@DeadMG Yes, and that's putting it mildly. It's also, of course, thoroughly non-conforming.
 
I was just thinking that
 
6:23 PM
@DeadMG Oh, one minor detail: on your question, in main I'm pretty sure you really want auto x = hi::f();
 
er, yeah
brainfart
nice catch
 
@ThePhD you here?
 
Coliru never works for me anymore
It always hangs on compiling.
Oh I found out why
 
@DeadMG I think Nicol has the right conclusion, but at least partly for the wrong reason. Since the scope of the return type of f is restricted to the body of f, I don't see any way your operator + outside that scope can have any hope of finding it under any possible circumstances.
 
main.cpp:8:6: note: candidate template ignored: substitution failure : template template argument has different template parameters than its corresponding template template parameter
:|
 
6:37 PM
Par for the course when using template template parameters.
 
Pretty much had it coming to me.
Thing is I don't know how it's wrong
 
What's the parameter declared as?
 
uh
I can make a SSCCE
 
tl;dr it should be template<typename...> class.
 
Why?
 
6:40 PM
Unless one of the parameters is not a type.
 
@Rapptz I don't know, it's not like I know what you're doing.
 
Well I'll try it out.
:|
Magic again?
 
wot
did it work?
 
ya
 
Of course it did.
Psychic TMP debugging powers.
 
6:43 PM
I was doing Cont<T> btw
i.e. template<template<typename> class Cont, typename T>
 
As in continuations?
I guess not.
 
@Borgleader HUH WHAT WHAt'S GOING ON
 
HAI
I wanted to know something.
 
Oh
 
@ThePhD go to rooooooom
 
6:45 PM
In your engine, are all "entities" direct childrent of the root "scene" or can you have entities be children of other entities?
 
Uh....
 
@Rapptz In so many words, template parameters and their arguments are not nice like function parameters: there's no deduction (e.g. template<typename T, T value>`) and there are some implicit conversions but they're silly.
 
The tree is unlimited. Children can have children can have children, yo.
 
In particular this means that std::vector<T, std::allocator<T>> can never match template<typename> class.
 
OH
Man.
 
6:46 PM
However, someone thought it would be a good idea to make template<typename...>, well, magical.
So yes, you were right: it's magic again.
 
How the hell did I forget that
 
Now guess what happens if you use a specialization of std::array? :)
 
Is it 10 MB of errors :(
 
I can't claim to know the specifics.
 
@Borgleader In some cases, it makes sense to have all entities available as one giant list from the root (whether that's your "scene" or some other kind of container). In other cases, a tree-like scene where children can have children of children
is more desirable.
Notice that, however, in the children-of-children-of-children case, you can let the user simply decide to never nest entities if they don't want to.
Thus they get the "flat" structure they want.
It's also, really, not much work to let entities have their own children.
 
6:49 PM
Yeah, it's just I've been debating whether I should go for the strictly flat model or the tree model., and I came to wonder which model you went with.
 
Tree model provides flexibility and also provides the ability to have entities that refer to their parents.
E.g. three orbs spinning around a single larger orb can be easily modeled as parent-child relations and offsets.
 
Guys
did any of you learn to use C++ (in the beginning) without a book?
 
In a top-down structure, it might be a bit more manual work to get going.
 
Ell
@JosephPotts I did
 
@Rapptz The bigger picture is not to use template<typename...> class, but concepts (or as close as you can get to them).
 
6:51 PM
It's gotta be more fun than reading a book
@Ell what'd you do?
 
@LucDanton I don't have concepts :|
 
Ell
It was just learning by doing really
I could already programme in ruby before I learned c++
 
I mean, where'd you start?
 
@Rapptz Doubtful. Why would you use Cont<T> otherwise: what does it mean?
 
Ell
Errm. Well, I can't remember :P
 
6:51 PM
(Or anything to imitate them truthfully)
 
Ell
Hello world :P
 
oh, not like that :P
Like from your first language.
 
Ell
My first language was ruby, because RPG Maker VX used ruby for scripts :P
 
@LucDanton I'm trying to do um input Cont<T> but it returns Cont<V>
 
Ell
I learned ruby from that
 
6:52 PM
Via a book or?
 
This was the first thing that sprung to my head
 
'input'?
 
@ThePhD I'm trying to design the whole system at the moment, and it's not easy because of how the engine is structured, each system essentially has it's own copy of the "scene" so not only do I have to manage all the entities, I have to manage the replication and synchronisation of changes across the entire engine in a clean way.
 
Ell
Actually, I went like this:
batch file -> as2 -> vb.net -> ruby -> c++ -> python
But I just used the internet for all of it
 
@LucDanton as in, function
i.e. f(Cont<T>) would return Cont<V>
 
6:53 PM
I see. So no book?
 
@Borgleader Sounds.. weird.
 
Ell
No books
 
Why not a reference / pointer to the same scene?
 
Alrighty.
 
Ell
I have actually read c++ primer, but I had already learned what was in the book, it was more of a concreting my knowledge
 
6:53 PM
@Borgleader Is there a reason it's spread out / replicated?
 
Ell
It taught me to use size_type and stuff
 
@Rapptz Allocator have that in their interface via rebind. That's something that can be part of a concept. So instead of having Cont<V> f(Cont<T>); you can have Rebind<Cont, V> f(Cont);, and you can choose to implement Rebind<Cont<T>, V> as one of the default behaviour.
 
@ThePhD Yeah, since I'm going for a threaded engine (the high level design was done by intel), the explanation is that whenever a system does a change to an entity it queues up a change which the engine and these changes are propagated after each frame is completed. This avoids locking/unlocking an entity everytime a change is required.
 
@LucDanton How would I do that?
 
6:57 PM
Which part?
 
Rebind<Cont,V>
I've.. never messed with std::allocator_traits if that's what you're talking about
 
Ell
@Borgleader Couldn't you just have a central readonly scene? It's readonly so you don't need to lock (right?)
Then you push the change deltas onto a queue
 
I still have to manage the change propagation so i dont see the point of it being readonly
having copies takes more memory but meh
like hell im gonna max out 8Gb of RAM
 
Oh, right.
Multi-threaded paralell woohoo.
 
@Rapptz Example.
 
Ell
7:03 PM
@Borgleader well what's the point of making duplicates?
 
The 'concept' we have so far is that f can be called on anything that fulfills 'can be retargeted via Rebind<Cont, T>'.
 
Hm
 
@Ell With your idea if system A changes an entity that changes only happens until the next frame. What if inside system A, i need that change now because the entities im going to process after need to see it? With your method I cant. If i have a local duplicate im free to change it, mid frame if i need to.
 
Ell
@Borgleader I'm sorry I don't understand - if you need the other systems to see the change, then you need to lock surely?
 
Btw this is coding against an interface where we're using metafunctions as an extensible, late-binding, compile-time mechanism.
 
7:10 PM
I am a little confused
 
@Ell Theyll see it later once the change queue has been propagated my point was if i dont have a local copy a system cant change an entity mid frame it has to wait for the changes to be propagated. If I have a local copy in each system i can change my local copy mid frame. the other systems will see the change later during propagation but at least my copy will be updated immediately
 
Rebind is an operation at the type level :v The rest is details.
 
Ell
@Borgleader well, you could keep local deltas, that seems like less wasted memory and doesn't any synchronisation
then there is only one thing which needs to be synchronised
also, how will you deal with the order of applying changes?
 
Oh I think I get it.
 
Ell
It will not be deterministic if it is multithreaded, this could cause problems
 
7:14 PM
@Rapptz :) The concepts part is relevant when it's start to be not just about types, but also expressions and their semantics: for instance it's probably not enough to compute a rebound type, there should perhaps also be a way to obtain values of that type. Otherwise how can f actually do anything at all?
 
@Ell Last one will be correct, or i could implement an importance system. But honestly I've been going through the use cases in my head and there should be minimal to no conflict
 
Ell
Right okay
 
eh
I've done some threaded engine stuff, and there should be no reason for double buffers or basically any synchronization for persistent objects (i.e. more than function-local, say)
the whole "Run one system on one thread, run X systems concurrently" design is slow and doesn't scale past about 2-3 cores
 
I don't expect you to read it, but if you were to read the pdf i linked earlier it should make sense
 
I did glance at it
briefly
it seems to be full of shit.
 
7:19 PM
Also, there are 2 types of decompositions in the design im following, a) functional decomposition (1 system/thread), b) data decomposition (each system will treat multiple entities at once)
 
a is worthless
and secondly
I don't know if you've noticed, but the number of cores has gone up a lot since 2008... a design from then probably isn't designed to scale to a 4 or 6 core desktop or console
not to mention that it's full of things like "global managers" which should be a giant warning sign to anyone
so after my brief reading of it, my primary advice is to throw it in the bin
 
Well I guess I'm done with this series' Doctor Who.
 
@DeadMG It can -- as long as the tasks are quite independent of each other.
 
@DeadMG You didnt read it enough. As for the singleton managers, I've made them un-singleton. It was actually breaking another part of their design if they were to be singletons.
 
@JerryCoffin When you're doing a game, the vast majority of tasks even when added together can't stress a single core, and then a couple of tasks are vastly more heavyweight. So once you have more cores than the very-heavy tasks, you're wasting.
 
7:26 PM
@DeadMG Fair enough -- but your comment was a lot more general than just games.
 
@Borgleader I did have a very good laugh at that thing showing a task breakdown for a quad core. Who comes up with this shit?
@JerryCoffin The entire conversation is in the "game" context.
 
@DeadMG The image on page 11?Whats funny about it? It's a bunch of tasks in a threadpool
 
@DeadMG Almost anything that attempts to explicitly breakdown "core 0 will do X, core 1 will do Y, core 2 will do Z" is generally laughable (not to mention almost always a crappy design).
 
@Borgleader Because if instead, they put the thread pool to doing all physics at once, they would no longer have to expend massive amounts of time and complexity synchronizing with the Graphics task.
 
@DeadMG I'd also add that you seem to be restricting it (almost) exclusively to a fairly limited subset of games though. Just for example, if you're talking about a server for an MMORPG, the multiple-processes model can have quite a bit more to recommend it.
 
7:31 PM
On my last PC Starcraft 2 was CPU bound, I was not able to play 4v4s because my Q6600 was choking on the amount of computation required
 
@JerryCoffin If you're talking about something like an MMORPG server, it's a bit of a different bucket because you only really have two tasks- game simulation, and then some I/O, you don't have any audio or rendering or anything like that, and the game rules tend to be very simple. But for this case, I would say that the primary thing you have to do is run the simulation on all cores simultaneously- if networking and such aren't the primary bottlenecks anyway.
 
MMORPGs typically run on a cluster of servers anyway. So you'll need multiple processes.
 
yes
that's definitely not the "Sim: core0, render: core1" style approach
man, now I want to resume work on my own game engine
better to wait until Wide is combat ready
 
7:47 PM
Plz dont, you'll get something working before I do and I'll feel bad because I am bad
 

« first day (952 days earlier)      last day (4005 days later) »