« first day (515 days earlier)      last day (4440 days later) » 

2:00 AM
85ºC doesn't make sense.
 
hmmm
 
That's... rather warm.
 
trying to write some code that deals with money in my game, and I'm unsure of how to handle it
 
@DeadMG Euros!
 
@DeadMG: Don't use floating point. :-P
 
2:00 AM
@RMartinhoFernandes That doesn't sound very off to me.
@Insilico Heh, no other choice :P
 
85 C = 185 F
 
No, don't use floating point.
 
@DeadMG It's highly unusual.
 
Or 358 K
 
@RMartinhoFernandes So some of the thermal paste on the CPU flaked off, or some dust clogged the fan.
 
2:01 AM
It usually runs <60ºC, and gets to 70ºC when I'm playing DF or building GCC.
 
@CatPlusPlus How else am I going to deal with variable steps or resources which do not have integral quantities?
 
I assume you've checked the vents and stuff
 
@DeadMG Yes, but I prefer to believe the sensors are broken :P
 
Is the CPU pegged at 100%?
 
struct money { unsigned euros; unsigned short cents; };
 
2:02 AM
@RMartinhoFernandes lol
 
@DeadMG For money.
You don't use floating points for money, ever.
 
@CatPlusPlus "money" was a generic term. It's not any actual extant currency.
 
Whatever.
unsigned long long money;
 
user406009
Why bother using a short for the cents?
 
@DeadMG: Still, I would not want to see that I have $7.999999999999999999999 to spend in the game
 
2:03 AM
and for variable-step resource consumption?
 
user406009
The compiler will pack it into the native size anyways.
 
@Insilico Eh, that's just about rounding before displaying
 
You can't have 4 billion cents.
 
anyway
I'm perfectly happy with my choice of representation
 
@DeadMG: Well, still, if the difference between what I have and what I need to pay is just bigger than machine epsilon then I'm screwed.
 
2:04 AM
the point is that I have no idea what to do about minus amounts
 
If it's FP, then it sucks.
 
like right now, a Unit can consume an amount per second, and I lerp it over the variable step
 
I'd go with unsigned int cents only for the internal logic and arithmetic. Euros and cents is a UI detail.
 
Floats are fugly.
 
user406009
Nvm, it's powers of 2.
 
2:05 AM
but I have little idea how to handle going negative
 
Don't go negative, duh.
 
well, I got that far
 
You can't have -n resources.
 
@CatPlusPlus Ask the governments.
 
Shouldn't the math just take care of that for you?
 
2:05 AM
maybe I should just hook up an event
 
Unless you're implementing debt and game over by bankruptcy.
 
I mean the mathematical operators works on negative quantities too
 
"When the player reaches 0 resources or is about to reach 0 resources, then .. .. turn off some functions until they're spending less."
 
so if(GetAmountOfMoney() < GetThreshold()) { SpendLess(); } doesn't work?
 
eh
I should really just stop trying to write super-generic code and start writing the game logic I actually need
namely that there is no current unit in my design which actually consumes resources per second
 
2:08 AM
Ah I see.
 
making the whole effort sorta pointless
 
premature generalization
 
and a Giant'Waste'O'Time
 
Premature economisation.
 
Well maybe not exactly the inner-platform effect
 
2:11 AM
Oh, silly me. I forgot to Ctrl+Z that clang build.
 
Undo?
 
How long does it take to build Clang?
 
Probably one hour.
Never actually measured it.
 
That's actually not too bad
 
2:18 AM
man
now I'm not wholly sure what section of my simulation I was supposed to be working on next
broken mah flow that resources malarky
also, did I remember to buy food?
cause else I'm going hungry tomorrow
 
@DeadMG: What are you simulating?
 
an RTS game, right now
projectiles! that's what I need next
 
You must have lasers.
 
yes
 
Even Age of Empires have lasers in them
 
2:20 AM
yes I have lasers
 
(well, at least as an easter egg)
 
I remember the AoE lasers
 
I'm attempting to simulate reality
 
user406009
Then there should also be mirror armor. To reflect the lasers back.
 
man
 
2:21 AM
(or at least a very, very, very small part of it)
 
I also need to lose a bunch of weight
 
Reality already is its own simulator.
 
@EmileCormier: I'm actually simulating diffusion through a sphere
So it's unbelieveably boring but I would like to verify my math
 
user406009
I just thought of an awesome RPG idea: The war of the programming languages.
 
@Insilico : I was just being a smartass. Looks up diffusion Whoosh over my head. :-)
 
2:23 AM
@EthanSteinberg: So a game starring Bjarne Stroustrup vs. James Gosling?
@EmileCormier: You should look up Bessel functions, for which my program needs to implement for the task. :-P
 
@Insilico : Have you tried logarithms?
 
user406009
No, more like the whole thing is themed off programing languages. Each "race" is a language(Java,C++, Python,etc). Upgrades are new features(threading, templates, lambda's, etc). People buy "units" which are pieces of code.
 
Hello
 
hmmm
my unit destruction is somewhat odd
 
2:26 AM
I need to have RAII destruction if, for example, a player leaves the game, then all their units are destroyed
 
@EmileCormier: No, but that's because the standard library already provides a log function. :-P
 
but I also need to be able to explicitly Destroy() them
 
Hi all
 
@EmileCormier: Ahh I haven't seen that yet
My problem does in fact involve exponentials so your suggestion isn't that far off. :-P
@DeadMG: Are the units shared across players?
 
user406009
@DeadMG Tell the players to destory their units.
 
2:29 AM
Wow, Windows.h is so annoying
 
@SethCarnegie: What was your first clue?
 
In one place, if __cplusplus is defined, they define a struct with inheritance, and if not, they define it with aggregation
#ifdef __cplusplus
typedef struct tagMONITORINFOEXA : public tagMONITORINFO
{
    CHAR        szDevice[CCHDEVICENAME];
} MONITORINFOEXA, *LPMONITORINFOEXA;
typedef struct tagMONITORINFOEXW : public tagMONITORINFO
{
    WCHAR       szDevice[CCHDEVICENAME];
} MONITORINFOEXW, *LPMONITORINFOEXW;
#ifdef UNICODE
typedef MONITORINFOEXW MONITORINFOEX;
typedef LPMONITORINFOEXW LPMONITORINFOEX;
#else
typedef MONITORINFOEXA MONITORINFOEX;
typedef LPMONITORINFOEXA LPMONITORINFOEX;
#endif // UNICODE
#else // ndef __cplusplus
 
Well, windows.h has to work in C as well
 
Notice the two retarded definitions of tagMONITORINFOEXA
 
So of course it does weird crap like that
 
2:30 AM
@Insilico yes, but they should do it the same way for both
aggregation works for C++ too
 
@Insilico nno
@EthanSteinberg Came to that decision when I was pissing
 
@Insilico because they use inheritance in C++ for MONITORINFOEX, in C++ you can't do MONITORINFOEX = {...} but you can in C
but you can do MONITORINFO = {...} in both C++ and C
 
@SethCarnegie But in C++, pointers to the two objects will work correctly as the designer intended, whereas in C you must explicitly cast
also, I believe that in C++11, you can do MONITORINOEX = { ... }
 
That is true, but I don't think it was worth it
Yes in C++11 you can
 
I think it is
 
2:32 AM
but VS2011 doesn't support that
 
user406009
@DeadMG, just wondering, are you doing networking as well?
 
brace-initialization is once per creation, pointer casting is per-use, O(1) vs O(n)
I'd rather pay the O(1) cost than the O(N) cost
@EthanSteinberg In an ideal world, I would use e.g. Steam for such things
 
That's true too
 
of course
 
I guess it's just my use that makes it annoying
 
2:33 AM
what would be better is if they simply provided decent C++ wrappers
 
yes
but I think they are wanting Win32 to go out of style, no?
 
@DeadMG: That's basically what half my personal "toolkit library" is
@SethCarnegie: Probably not
Since pretty much every Windows application depends on it
 
@Insilico lol
 
@DeadMG I thought you were super sexy.
 
@Insilico I thought they wanted people to go toward .NET
And then something about Metro
 
2:35 AM
Microsoft hosted an event that focused only on native development recently
 
@RMartinhoFernandes I am. But I'd be truly irresistible with a little less thigh.
 
Yeah, I know of it
 
If they really wanted everyone to go .NET, they wouldn't host such a thing.
Either that or they have a really weird business strategy I haven't heard of
 
Would any technical problem prevent them from making a C++ wrapper? I don't know why they don't
@Insilico it is Microsoft...
 
2:38 AM
@SethCarnegie A C++ wrapper around what?
 
@RMartinhoFernandes: The Windows API
 
@DeadMG I don't think Steamworks come with complete networking solution.
 
@CatPlusPlus I think it does.
 
@Insilico Isn't that what WinRT is about?
 
There are C++ wrappers around WinAPI.
 
2:38 AM
@SethCarnegie: They have C++ wrappers already. It's called MFC, ATL, and WTL
(Note I didn't say "Modern C++ Wrapper")
 
It has only P2P, it seems. partner.steamgames.com/documentation/api
(Aside from the meta stuff, obviously.)
 
@RMartinhoFernandes: Come to think about it that's probably what WinRT is
Since it's still dependent on the Windows API
Although it will certainly come with some new features implemented in terms of the existing API
 
that's fine for me, because RTSs use P2P architecture
 
@Insilico Calling MFC "C++" is a joke. It's pre-Standard.
it's not even "not-Modern". It's pre-Standard.
 
2:41 AM
@DeadMG: The whole library is a joke
 
Ah, dammit, I need to finish that stupid game UI for today and I'm not even half done.
 
@DeadMG: There's a reason why I have a little "toolkit library" to write my applications
 
you should get cracking then /whips
 
(albeit simple ones)
At least your programs have some kind of UI
 
The problem is, it's supposed to be scalable, but not use scalable elements "because it might work slowly on the tablet".
 
2:43 AM
So far all my simulations are command line thingies that spit out numbers
 
lol
 
I mean, I don't even know how the fuck do you do working non-scalable UI.
 
@CatPlusPlus: What's wrong with scalable elements on tablets that make them work slowly?
 
Xeo
Damn, I got lost in the Nether.
 
It's more of how Unity draws the stuff.
It uses 9-patch, but at the same time it uses immediate mode crap.
Which blows draw calls into the sky.
I mean, one stupid button is two draw calls.
Or more.
 
2:45 AM
Each button is >=2 draw calls?
 
immediate-mode is stupid
 
I need better architecture and two weeks more.
Sigh.
I think I'll try generating meshes on the startup, and only draw text with immediate mode.
 
at least in D3DX, you only need two D3DX draw calls per button, and they batch real draw calls
 
Of course, since I'm using Unity for two weeks, I really have no idea how.
 
hmm
each Unit's colour is the colour of the owning Player
so when you change the Player's colour, you'd have to change the colour of all of the Units they own
or maybe I should just leave the Player's colour as immutable
man, immutability, it solves so many design problems :P
 
2:55 AM
Store reference to player inside the unit?
 
done
but really I need to call like RefreshColour() on the Unit
 
Then get colour from there.
 
the thing is that I don't want to have that as part of the public interface
 
Directly.
 
yeah, but how does the Unit know when the Player's colour has changed?
it needs an event/callback
 
2:56 AM
You render them each frame, right?
 
.. sure
 
Then just start drawing with new colour?
Or, rather, not do anything, since you use colour from player in the first place.
 
sure, but the Renderer has no idea about Units or Players
it just has Objects, which have Colours
so when the Player's colour changes, it needs to ask the Unit to change it's owned Object's colour
the problem is that there is no appropriate place for this function, like
I need it to be accessible to the Player, but I don't want to friend the Player cause that's too much, and I also don't want to make it public
 
Like you need cute interface inside a game.
 
why shouldn't games have the same quality as other software?
well, there are a couple of hackeries I could do to offer limited extra functions to the Player class only
but it's not really worth it
 
Xeo
3:02 AM
61
Q: Popular Deleted Questions list

systempuntooutStack Overflow What was your first home computer? What's your favorite "programmer" cartoon? Programmers' last word How can you tell if a person is a Programmer What code would you have on your wedding cake? Worst UI You've Ever Used How do you clear your mind after a day of program...

 
I'll just add the update function as public
 
Xeo
drops the time killer bomb
 
3:13 AM
Where do unit tests go? In their own directory?
 
Xeo
It has become so silent since I dropped the link...
 
Heye guys, I was wondering if I could get a hand with this.
http://stackoverflow.com/questions/9695262/program-making-blank-output-file#comment12321131_9695262
 
3:38 AM
how do you do with static inline functions when doing a shared library?
and will moc-files be produces when there's no cpp file?
 
3:57 AM
I'm going to attempt sleep now
wish me Teh Luckzorâ„¢!
 
4:25 AM
what's up fellas
 
I hate everything.
UIs are tedious and boring.
 
no kidding
 
Especially when there's no WYSIWYG or layouting that doesn't kill the target device.
 
and all the ui toolkits suck
what are you using?
 
Unity.
Which has like, the worst UI capabilities ever.
Writing raw WinAPI calls isn't that tedious.
 
4:34 AM
unity is a 3d engine, or did I make that up?
 
You'd think a professional 3D game engine with integrated editor would have something to create the damn UIs.
And then they come up with crap.
 
maybe that's why most uis on 3d apps suck balls
 
Xeo
@CatPlusPlus Ew, Unity.
 
not everybody has the freakin official nintendo sdk on their computers, @xeo
 
Of course, there's what looks like decent UI toolkit, but at the same time, 99$.
 
Xeo
4:36 AM
Err, I don't
 
@xeo I thought you had a hero of gamedev++ certificate
 
Xeo
@CatPlusPlus That's the main reason for the "ew" in my "Ew, Unity"
 
how are you? still hanging out with your brother?
 
Xeo
@keithlayne I have, but that doesn't mean I have access to NDA level hard- and software just for the heck of it. :)
 
I know, if you told us you'd have to kill us
 
Xeo
4:39 AM
The Nintendo ninjas are everywhere
 
@cat does it totally suck, or just for ui stuff? the only 3d I'll probably ever do would be a 3d console app
and I don't mean game console
 
I don't do anything except UI.
 
Oh yeah, I forgot your favorite language is VB
 
Xeo
> It's an opportunity for fun. Make an untitled list of ranomly selected people's names (say 25% of your department), leave it in the photocopier and then sit back and enjoy the paranoia-induced fall-out. – Dan Dyer Jan 14 '09 at 18:02
(10k+)
 
nice
I've been learning C#. Don't judge me.
 
4:43 AM
I'm writing this crap in C#.
 
I knew nothing at all of C#. I let myself ignore a whole language for like 10 years just because it was made by microsoft.
It doesn't take long to figure out its shortcomings. But there is some good stuff there. I just don't think the problems can be overcome because of that CLR stuff.
 
user406009
What's wrong with the CLR stuff?
 
well, maybe I'm wrong, but I don't know if you could really implement c++-like templates unless they changed the model some
the library is massive though
I realized that C# was the easiest way to target all of the major (consumer) platforms with the (mostly) same codebase
I had no idea mono had come so far
especially for android and ios
is c++/cli just C# that looks like c++, or does it actually allow compile-time generic programming?
 
C++/CLI is mostly a waste of time, if you're not integrating legacy code.
 
Xeo
Oho, awesome. I just noticed you can still favourit deleted questions.
 
4:53 AM
@cat so it's not really c++ then?
 
No. They probably do have templates, but dunno.
 
Take it easy guys. Say hello to the robot and gorilla for me.
 
@keithlayne All you need is some name-mangling scheme. C++ templates run at compile-time, so the CLR doesn't really need to know about it.
Of course, good luck using those from another language.
 
5:19 AM
UnityGUI.
UIToolkit is for fixed resolutions AFAICT.
No shit.
Yes, whole two.
SD and HD, on failPhone.
 
> Our plugin packages are designed to work synergistically with each other
Well, well.
Interesting marketing blurb they got there
 
5:34 AM
hi .. i having a problem ... can u plz tell me that i have 2 array and in 3rd arry i want to find the common elements
 
Xeo
5:51 AM
Man, I'm so happy now that my WLAN / router is fixed. Why didn't I think of this before...
@EtiennedeMartel "Oooh, complicated words.. it must be good!"
 
6:04 AM
blergh Qt !
 
Xeo
I hate it when Ideone is just.. down.
Or increadibly slow
 
@Xeo: It seems fine to me
 
Xeo
Does this display anything for you?
 
Hmm their backend must be screwy today
Can't get even a hello world program to work
There's no way it needs this long to compile a hello world program
 
Xeo
Or run.
 
6:16 AM
Their frontend works fine though
 
Xeo
Oh, runs now.
0
A: Element Lifetime of STL Containers

XeoC++11 has emplace_back which will perfectly forward whatever you give it to the elements constructor and construct it directly in-place: #include <vector> #include <iostream> struct X{ X(int i, float f, bool b){ std::cout << "X(" << i << ", " << f <&...

:)
 
I guess they just fixed it.
 
 
1 hour later…
7:20 AM
> gcc version 4.8.0 20120313 (experimental)
Finally.
 
7:36 AM
a bit annoyed that a newbie isn't accepting my first to post +10 answer...
 
7:58 AM
Oh hey, the guy who asked that denormal float question is back:
0
Q: What happens if I call an objects member function from a different thread?

DragarroIf I have an C++ object created in the main thread, and then start another thread, and from that thread I call a public member function of the object I created, what happens? Is it different if the public function has parameters or if it manipulates private object members? Does it behave differ...

 
Morning all
time for a coffee :D
@jalf what... you type in one address and get taken to another altogether... the wonders of the modern world
 
As someone very new to C++ (coming from Java) the 3rd from the bottom just blew my mind
 
@Sparksis: The answers are reordered each time you view the question.
So, 3rd from bottom is not good enough specification. :)
 
Image just above i.imgur.com/rnLSx.png
int (*p)()
or is it reffering to an actual function rather than a property at this point in the image
 
8:34 AM
unless you are a poor soul using old C++, there is very little reason for raw pointers these days
 
@thecoshman How about situations where you just need temporary access to an instance (that has already been created on the stack, or as a shared pointer) so that you can call some methods on it and not have to deal with the memory management fallout ? :P
 
sounds like a legit reason
perhaps I should have 'few reasons'
 
@thecoshman :) good coz I have been making extensive use of the technique in my code and was nervous about it all falling apart :P
 
though I am not C++ pro
and on closer inspection, wtf are you trying to do :P
 
@thecoshman :D just a substitute for returning references in certain scenarios
 
8:41 AM
your creating an object, and then passing a pointer to it, into a function
 
@angryInsomniac Sounds like a job for a reference.
 
in effect, myClass foo; bar(&foo); is that what you are doing?
where bar is defined (roughly) as bar(myClass* object)
I may have got the wrong end of the stick, but from my understanding, if you are using raw pointers, as a class data member or as a parameters etc, chances are, you are doing it wrong
 
@thecoshman I have a vector which holds shared pointers to many objects , like a lookup table , there is a manager class which sometimes needs access to these objects so it can call one or two methods on them, so I find the pointer in the map and then pass it somewhere as a naked pointer not worrying about the memory management , this naked pointer can then be accessed anywhere , methods can be called on it and the allocated memory will be cleaned when the shared ptr's are cleaned
@thecoshman nope , not as class data members
@LucDanton Yeah , I might have to go and change all these cases to references , but for now it works fine ! no leaks according to VLD
 
then you probably want a vector of std::shared_pointer<myClass>
 
@thecoshman its a map of <std::string,boost::shared_ptr<myClass>>
 
8:48 AM
you should probably move over the std rather then boost. also, if you already have a shared_pointer, why not just pass that into your other function?
 
ProblemObject* p = &problem;
 
oh perhaps best, you want to pass a weak_pointer
 
@thecoshman Hmm, I was wondering weather I should do that , will there be any significant fallout of moving from boost::shared_ptr to std::shared_pointer
 
this means that if you removed the shared pointer from the map, the object it points to will be removed, assuming there are no other shared pointers to that data
 
weak_pointer does not allow method calls on the object being pointed to
 
8:50 AM
@angryInsomniac in theory no, though though I must currect my self, it's std:shared_ptr
 
@thecoshman Yup , it has to be unique , that is the only place the pointer is held
 
@angryInsomniac is that so...
 
@thecoshman That is what I understood from boost.org/doc/libs/1_49_0/libs/smart_ptr/weak_ptr.htm
 
well, AFAIK, if you want to just take you old school int* and modernise it, you want to use std::unique_ptr<int>
shared_ptr is more an exception to the norm
 
I may be understanding incorrectly though , you might wanna read that yourself (and enlighten me if I'm wrong :] )
 
8:52 AM
boost::weak_ptr is not definitely the same as std::weak_ptr
 
@thecoshman Will unique_ptr allow itself to be passed around ?
 
@angryInsomniac It can't be copied, but it can be moved
 
@thecoshman oops , I forgot that we are referencing two different libs
 
so you can pass it by reference or rvalue ref
 
@jalf That means ownership will have to change hands everytime it is passed around ? ( or use a reference )
 
8:54 AM
@angryInsomniac You need to use the lock member to obtain a shared_ptr. Then, if that pointer is valid, you may dereference it (the shared_ptr). You can't do it on the weak_ptr itself because that's a race condition.
 
@LucDanton ok ... this is the first time I heard of lock , where can I read about it ?
 
ah, from reading en.cppreference.com/w/cpp/memory/weak_ptr it looks like weak_ptr is just so you can pass it around, but you may not want to be accessing it, it's more for when 'you may want this, so here it is just encase, and fyi I am still looking after this data'
 
Boost documentation?
 
@LucDanton surely you should be referring to std docs, rather then boost docs
 
because I have just been passing my shared_ptr's and dereferencing them at will
 
8:56 AM
@thecoshman No such thing as standard documentation.
 
@angryInsomniac AFAIK that will work..
 
@LucDanton ahh , you're talking about boost and @thecoshman is talking about std :P
 
@LucDanton I mean, documentation on the std version rather then the boost version
 
@thecoshman that = ?
 
Right, if you can deal with the standardese by all means read the Standard. But I don't know of any good resource to otherwise read about the Standard Library, sorry.
 
8:57 AM
@LucDanton en.cppreference.com/w/cpp/memory/weak_ptr this is talking about the std version rather then the boost version
do you get what I mean now?
 
@thecoshman Thats what I thought , I believed that locking and unlocking (I guess a semaphore like system) is handled by the shared_ptr so that the programmer doesnt have to deal with it
 
@angryInsomniac yeah, the point is that a unique_ptr gives the object exactly one unique owner. So either you can pass around references, while you hold on to the ownership yourself, or you can transfer ownership with a move operation
 
@thecoshman How do you know that's reliable?
 
@LucDanton is there any selective advantage to using std rather than boost ?
 
@angryInsomniac you don't have to rely on a third-party library ;)
 

« first day (515 days earlier)      last day (4440 days later) »