« first day (763 days earlier)      last day (4187 days later) » 

user1804599
3:00 PM
The bump map looks terrible on the Moon. I need a new one.
 
user1804599
Or decrease the depth.
 
user1804599
And it needs to be more blurry, but I have no good bitmap editor.
 
@Aardvark I think you have it right there.
 
Ell
@Aardvark gimp?
 
@Aardvark There's hundreds of free bitmap editors. GIMP can get you by, even Paint.NET.
 
user1804599
3:01 PM
@Ell I was already downloading that. :)
 
user1804599
@ThePhD Paint.NET doesn't run on OS X.
 
GIMP takes forever to load.
 
... Dat OSX.
 
I'm being generous by using the word "forever". Just saying.
 
OH!
That reminds me
I wonder if Pixen got any better for the OSX...
 
3:02 PM
They should really delay, lazify, or backgroundify all that plugin loading crap.
 
@Aardvark Perhaps nVidia can help? Not sure about running on OS/X though.
 
Ell
ugh. I'm gonna go with just writing ImageCache, MeshCache etc. - this template business is too difficult :P
 
@Ell Where are you running into problems (presumably with a template <class T> class Cache or something similar)?
 
user1804599
Io looks terrible without a bump map.
 
@Aardvark What is that rendering with, anyways?
Flash?
I can't tell.
 
user1804599
3:05 PM
@ThePhD WebGL
 
I don't see anything
 
Ooooh.
That stuff is finally alive?
Is the Web version of DirectX kicking as well?
 
user1804599
@DeadMG In Chrome you need to click on the shield icon in the address bar (right-hand side).
 
user1804599
Stupid Dropbox uses SSL, but the jQuery and CoffeeScript CDNs don't.
 
@ThePhD Yup -- and just got a fairly substantial "client" so to speak -- Google Maps can now use it (though it's still in beta).
 
3:08 PM
@R.MartinhoFernandes I remember it as being traditionally slow, but I installed it today and used it to combine the two plots and it did load in a timely fashion.
 
user1804599
@ThePhD DirectX is proprietary so that is very unlikely.
 
Ah, that's right.
But I could've sworn I heard something about DirectX in the browser...
 
Ell
@JerryCoffin basically, I'm trying to make some kind of auto resource loading cache class for Irrlicht so I can go like this: images["one.png"] or meshes["mymesh.dat"], but I want to load it automatically from a file. Irrlicht uses abstract bases such as IImage* and IMesh* so I'd need to create a wrapper class which adds a default constructor in order to store it in an std::map. So I was writing an add_ctor template which took me ages and turned out not to be very useful because...
 
@LucDanton I guess they didn't fix the Windows version yet.
 
It's probably going to be an IE-Only thing, seeing as Internet Explorer still doesn't support WebGL.
At least, not with Plugins.
 
user1804599
3:10 PM
@Ell can't you just write your own class and overload operator[]?
 
Ell
in order to load it, it needs the file path, so a default constructor can't be used. So now I'm going for something like this which doesn't seem to bad: ideone.com/yMfFRX
 
user1804599
class ResourceCache {
public:
    Resource const& operator[](std::string const& name);
};
 
Ell
@Aardvark I'm doing that now
 
by the way
that kind of cache is wrong
 
Ell
but that means I need a virtual loadFromFile. I wanted to make it all compile time magic but oh well :P
@DeadMG why?
 
3:11 PM
What kind of magic is this:
decltype(std::bind(&T::drop)
 
@Ell Yeah, I guess if you want to do that, you really do pretty much need one of those (dare I say it?) pattern thingies -- specifically a factory class.
 
Xeo
@ThePhD A syntax error!
 
because how are you gonna release the resource?
 
Isn't there UB in Boost.Pool if it's returning a pointer to unconstructed data?
 
Ell
@ThePhD well they are reference counted
 
3:12 PM
Oh. Okay.
 
@Pubby It is possible to manipulate pointers to storage under certain conditions.
 
A quick question, though:
Can I swap the pointer inside a unique_ptr<T> and will all things that reference that unique_ptr<T> have their data updated as well?
 
@LucDanton Does that mean it's malloc member is allowed?
 
yes, I do think of you as inferior
@ThePhD What?
 
@ThePhD No. No. No. No. Try something that works instead.
 
3:13 PM
Hm.
.... :3c
 
Xeo
@ThePhD Are you thinking of shared_ptr or something?
 
how would that possibly happen?#
 
@DeadMG Where did that come from?
 
@ThePhD What do you mean by "reference that unique_ptr"?
 
unique_ptr<T>*
 
3:13 PM
@Pubby I don't remember how that goes, sorry.
 
Xeo
1 min ago, by ThePhD
A quick question, though:
Most likely.
 
@ThePhD Well, yes, when they de-reference it, they'll find the updated value there.
 
Xeo
@ThePhD Burn that idea immediately.
 
In any case you wouldn't be able to tell from the signature alone.
 
@ThePhD Then yes, they will all see the update because they're all looking at the same pointer.
 
3:14 PM
@Aardvark Unless I'm badly mistaken, they do have something where IE uses DX to handle the drawing for whatever you put in an HTML5 canvas. If you want more than that, my guess is that MS would point you toward SilverLight (but that's obviously a guess on my part).
 
but why would you do such a thing?
 
Ell
@JerryCoffin They already use a factory class to be created - that's what I wanted to get rid of really
it's okay though, I think I've sorted it now
 
@ThePhD Yes.
 
what's wrong with just std::unique_ptr<Texture> CreateTextureFromFile(filepath)?
 
user1804599
@Ell what are you making?
 
3:15 PM
why have endless caches and such
 
@Ell Ah, I'll stay out of it then.
 
Another question, Boost.Pool deletes (calls destructor) of allocated objects when it goes out of scope. I'd like to make use of this feature except my allocated objects contain pointers to other allocated objects (which could be invalidated during destruction). Seems like silly UB, but should I be concerned?
 
@JerryCoffin MS was pointing everyone to Silverlight for so much as sneezing, until they suddenly pulled the plug on it.
 
Ell
@DeadMG well I don't want to needlessly load a texture twice
 
@Ell Then only call Create once.
 
Ell
3:15 PM
but multiple things will use the same texture
 
@Pubby Well RAII usually takes care of that. I.e. reverse order of destruction and all that.
 
Xeo
@DeadMG And cache that somewhere? :P
 
@Ell Then only call Create once.
 
@Potatoswatter Oh, did they pull the plug? I always get in trouble when I try to talk about what MS would do. I'm always at least an hour out of date!
 
Ell
@DeadMG well that's the whole point of this
 
3:16 PM
The idea is for run-time switching of assets, for example a Texture. I don't want to refuse to load my game if textures are missing; I have replacement textures that should be immediately subbed in when loading files. When the FileSystemWatcher finds the file it's looking for (my artsts uploads it and I pull it down, or when I make a change) I don't want to have to stop and then rebuild/reload. I want it to change, on the fly, immediately in the game.
 
user1804599
@Ell use a global! :D
 
Obviously it's mostly a debug deal, but it still would be nice to runtime-kick my stuff, hencewhy I was wondering if I updated the unique_ptr<Texture> with a new texture value on the inside, it would reflect that elsewhere.
And by elsewhere I mean everywhere elsewhere.
 
Every one aware of that pointer object would notice the changes. Note how that's two levels of indirection.
 
@LucDanton A better example would be a std::list of struct foo { foo* ptr }; where the value of ptr pointed to the previous foo` in the list. When the list gets destroyed I imagine there would be invalid pointers for a brief period.
 
@Pubby No.
 
3:19 PM
@Pubby struct foo { std::unique_ptr<foo> ptr; };
 
@DeadMG That's daft.
 
@Ell Right. But you also have a giant memory leak because you'll never release those resources.
 
@LucDanton std::list calls all of the destructrors and then frees the memory?
 
@LucDanton Why?
 
Ell
@DeadMG why would I want to release them?
 
3:20 PM
So either unique_ptr<T>& (or *) or just the good ol' T**.
 
Ell
they will be used throughout the game
 
@Ell Probably because you might discover later that you don't need them later.
what kind of game are you trying to create?
 
Ell
then I can release them :P
It's a strategy game, based around trading commodities between markets
 
@DeadMG One that needs texture caches, obviously.
 
What game doesn't need a Texture Cache?
Double-loading textures would be silly.
 
Xeo
3:21 PM
@ThePhD The latter doesn't work.
 
@DeadMG I would guess they should probably be reference counted so they exist as long as they're in use, and get discarded when they're not longer needed.
 
@ThePhD Depends on the texture.
 
Xeo
@ThePhD Text-based rpgs / roguelikes.
 
Fuck this. Is there no Linux distribution for the Raspberry Pi that comes with SSH enabled?
ARwtgjhjg.
 
@Xeo I see your point.
 
3:21 PM
for example
 
A purely textual RPG would be real boring, however.
 
Xeo
Or really, any console based game.
 
Might as well just give me some Microsoft Word Documents. =l
 
@Xeo Roguelikes are actually more likely to use one. Some kind of flyweight probably.
 
consider that you are playing a first-person shooter. Each map you play has it's own textures, but you don't need to keep them around when you're not playing that map.
or enemies which only appear in some maps.
 
Ell
3:22 PM
@R.MartinhoFernandes I could have sworn it asks you if you want to enable ssh when you install it?
 
Xeo
@R.MartinhoFernandes "text-based" was meant for both.
 
@Ell Install what? Installing is just dding an image into a disk.
 
@Xeo T** is not an option? D:
 
This is what I'm talking about:
 
Xeo
@DeadMG Why do you think that the resources are never released when the last reference goes out of scope? (Disclaimer: I didn't look at @Ell's cache implementation.
 
3:24 PM
struct foo { foo* ptr; };
int main() {
    std::list<foo> l;
    l.push_back({0});
    l.push_back({&l.last()});
    l.push_back({&l.last()});
}
 
Ell
@R.MartinhoFernandes is it? I watched what I thought was the second half of some kids installing it - so it was maybe configuring it. But either way there was a list of stuff to configure, ssh server/client was one of them
 
user1804599
@Pubby a triply-linked list?
 
@Xeo Defies the point of the cache, no? Then you are double-loading textures just like before.
 
@ThePhD Some people apparently still enjoy a well written one.
 
@Aardvark I don't have a monitor nor a keyboard to plug the thing into (and neither do I want them). So I cannot use it if there's no SSH by default.
 
3:25 PM
@Aardvark It's a list of an implicit list
 
user1804599
@R.MartinhoFernandes ok.
 
Xeo
@DeadMG Err... no.
 
Ell
@DeadMG you know what maybe I will just skip the cache. I'll add it later if I need it :L what should I do instead? just load it whenever I need to load it?
 
Xeo
You only load a texture if it's not currently loaded.
 
@JerryCoffin That's pretty sweet. :O
 
3:25 PM
@Ell Yeah. I'd worry about double-loading later- if it ever proves to be problematic. Better to just load them, reference count them, and be done.
 
Xeo
Upon load, you stuff a weak_ptr into the cache and hand out a shared_ptr. When it's requested again, check the cache and .lock() the weak_ptr if needed.
 
@Pubby Interestingly I can't find a requirement on order of destruction for Standard containers. Only took a brief glance though.
 
user1804599
I'd go with std::shared_ptr<Texture> and optimize only if it becomes a problem.
 
@R.MartinhoFernandes I saw that earlier on reddit. Looks silly.
 
3:27 PM
But even still, a text RPG could always be enhanced with background images and sounds
 
Ah well, doesn't matter what the requirements would be, since you could always devise a scenario where each element points to the element that will be destroyed before it.
 
@LucDanton Thanks for looking. I don't think having a pointer be invalid for a brief period should cause any problems though.
 
@Xeo That's a really poor thing to make use of as a "cache".
 
@Pubby So yes, in the general case it's not unheard of to have a pointer to unallocated storage.
 
I sneezed.
 
Ell
3:28 PM
I deleted stdafx.h and it broke :P
 
user1804599
I'm going to write a game. I'm in the mood to write a game.
 
user1804599
And I have an idea for a new game.
 
everyone always is
but actually making it work is another matter
 
Ell
@Aardvark write it - quickly! before you realise you can't be bothered :P
 
@ThePhD And a bit more complex than you probably expect if you've never played it.
 
3:29 PM
@Pubby Worse than that, it will be possible for a container like std::list to end up with invalidated pointers (i.e. not storage at all). Those are still destroyable though.
 
@Xeo Consider: #1 load texture "unicorn.bmp"; #2 weak pointer is stored, shared pointer returned; #3 client is done with it, drops the shared pointer; #4 client requests "unicorn.bmp" again; #5 locking the weak pointer produces no useful results, oh fuck, let's load again.
 
@LucDanton You mean internally? Or are you talking about what I did with that example code.
 
Xeo
@R.MartinhoFernandes Meh, always depends on your need. You can also implement a cache that actually stores shared_ptrs and cleans up on explicit request.
 
@Pubby I mean from the destructors of the element type (i.e. foo).
 
I should probably starting using shared_ptr and unique_ptr, since I'm starting to get into memory management and caching stuff now...
I also still have to understand which one's appropriate for which usage cases.
TO THE FAQ!
Also, ConstCPP looks exceedingly silly.
A fun idea, though.
Also, has anyone seen @Rapptz lately?
 
3:37 PM
last night
 
@DeadMG Hey, that's my line! :-)
 
well
I was thinking about adding "In bed!"
but decided against it
 
user1804599
How should I update the state of my objects for smooth animation? Have a member function update(double time_delta)?
 
call it advance or something that indicates more clearly what it does
 
move_light_cone
 
3:45 PM
One other thing: since you're using it for a cache, you probably don't want (exactly) what a shared_ptr provides either. When an object's reference count drops to zero, you don't want to destroy it immediately -- rather, you just want to move it to the cache's "eligible for removal" list. It remains in the cache, however, and available for reuse as long as it is. Only if the cache has grown too large do you start destroying objects that are eligible for removal.
 
Someone wants to add Chebyshev polynomials to the standard library.
I'm not sure how to feel about this.
 
Ell
I'm confused - why does unique_ptr need a default constructor?
 
To make empty ones.
 
Ell
I thought they pointed to null then
So I need a unique_ptr to a pointer?
 
wtf
 
Xeo
3:51 PM
"internal pointer equals nullptr" == "is empty"
 
Ell
I have become more confused with c++ than ever over the past day - how is that possible!?
 
@R.MartinhoFernandes Makes about as much sense as the Bessel functions being in the standard library.
 
Ell
right. one creates an IrrlichtDevice* with createDevice and one uses myDevice->closeDevice() to close it. How do I put that into a unique_ptr?
 
5 hours ago, by Luc Danton
auto deleter = std::bind(&IrrlichtDevice::closeDevice, _1); std::unique_ptr<IrrlichtDevice, decltype(deleter)> p { /* raw pointer */, deleter }; is one way.
 
Ell
then I said something after that
std::unique_ptr<irr::IrrlichtDevice, decltype(std::bind(&irr::IrrlichtDevice::closeDevice))> engine;
aww damnit I was reading the error wrong. std::bind is complaining about no appropriate default constructor available
 
3:55 PM
Just like I told you!
Amazing!
 
Ell
ahh man. sorry. I am being such an annoying douche today
 
Nah it's fine, it's normal to experiment and face errors. On the other hand if you keep ignoring what I say maybe I'll just stop answering altogether.
 
Ell
I just switched over to vs recently, I'm not used to reading their errors
I'll just put a smart pointer in later if I need one I think
 
@Ell scrubbed now?
 
Ell
@Cheersandhth.-Alf I have not scrubbed it :L
 
user1804599
4:01 PM
time = new Date()
delta = time - lastAnimationTime
if delta > 5.0
    lastAnimationTime = time
    cube.update()
 
user1804599
I could also do that, then I don't have to pass delta to the update functions every time. Problem is with >. :/
 
what's wrong with >?
 
Xeo
@Aardvark I'd go with overflow = delta - 0.5; if(overflow >= 0) { lastAnimationTime = time - overflow; ... } (or something in that direction, if I didn't mess up my thinking)
 
user1804599
@DeadMG if delta == 5.5, it is > 5.0, but the 0.5 is lost.
 
Xeo
@Aardvark Yeah, that's what my "overflow" is trying to handle.
I think I got the pseudo-code right.
You basically schedule the next update earlier.
 
user406009
4:13 PM
Couldn't you also do this with a target variable?
while time > target:
     target += 5
     draw
 
user406009
No need to worry about overflow when delta is larger than it should be.
 
@Aardvark Then subtract 5.0
 
Oh, that was an old image. It seems all new Pi images have SSH enabled by default.
Awesome.
 
4:31 PM
^ The Apple Pi
 
@Cheersandhth.-Alf Damn -- making me hungry for sweets now.
 
Ell
anyone have any experience with zlib?
 
user1804599
WTF
 
user1804599
How do I update an object's coordinates given a direction?
 
user1804599
moveForward:  ->
    radians = @mesh.rotation.z * Math.PI / 180.0
    @mesh.position.x += Math.cos(radians)
    @mesh.position.y -= Math.sin(radians)
 
user1804599
4:41 PM
I thought it was like that?
 
You're storing rotations in degrees?
 
user1804599
Yes.
 
@Aardvark You probably want to scale that so you get a consistent speed.
 
Xeo
@R.MartinhoFernandes He does in the sense that the code is invoked every 5.0 something
 
user1804599
That's irrelevant.
 
4:42 PM
@Xeo You mean it's discrete?
 
user1804599
Oh fuck. The angles were in radians already.
 
Xeo
@R.MartinhoFernandes Aye, guessing from his code above.
 
user1804599
But are x += Math.cos(radians) and y -= Math.sin(radians) correct?
 
user1804599
I want to move the object in the direction radians.
 
user1804599
I am so terrible at goniometry. T_T
 
4:49 PM
using degree_radian_ratio = std::ratio<3141592654, 180000000000>;
template <typename Rep>
using degrees = std::chrono::duration<Rep, degree_radian_ratio>;
template <typename Rep>
using radians = std::chrono::duration<Rep, std::ratio<1>>;
// <chrono> is awesome.
@Aardvark Yes, if you want to always move one unit.
 
user1804599
Hmm.
 
user1804599
Oh they both had to be +=.
 
Oh, right. How could I miss that.
 
Xeo
Always depends in the coordinate system.
Sometimes, positive Y is up, sometimes it's down.
 
user1804599
Ah yeah. I used -= in Game Maker when I was a child.
 
user1804599
4:55 PM
In Game Maker Y goes down, but here it goes up.
 
user406009
Positive y should always be up. I hate it when libraries force a positive y = down approach.
 
user406009
It's probably the worst part of SFML.
 
Xeo
Why "should"? It's the same thing with where the center of the coordiate system is.
 

« first day (763 days earlier)      last day (4187 days later) »