Jump to content

  • Log In with Google      Sign In   
  • Create Account

Khatharr

Member Since 24 Apr 2010
Offline Last Active Private

#5284730 Javascript Canvas Question - Confusing coordinates, velocity vectors and the...

Posted by on 02 April 2016 - 03:34 AM

You're just looking at the space from the wrong direction.

 

unit-circle9_43217_lg.gif




#5284648 Actor object understanding

Posted by on 01 April 2016 - 02:25 PM

The compiler will tell you where the error is coming from. Post the full compiler output, please.

 

(inb4 SOLID explosion)




#5284156 Actor object understanding

Posted by on 29 March 2016 - 08:14 PM

I don't always inheritance architecture...

 

...but when I do Actor is an abstract class derived from Entity that serves as the base for the player and NPC types.




#5283980 queue of unique_ptr issue

Posted by on 28 March 2016 - 08:50 PM

Not sure if you're responding to the original question or nfries88, Khatharr...


It was like the joke about the plane: it went over your head.

 

------

Edit: Looks like you're not alone in that regard either, given the downvotes.




#5283775 queue of unique_ptr issue

Posted by on 27 March 2016 - 05:41 PM

#include <iostream>
#include <memory>

class Foo {
public:
  Foo(int i) : ip(std::make_unique<int>()) {
    *ip = i;
  }

  Foo(Foo&& other) {
    ip = std::move(other.ip);
  }

  void show() const {
    std::cout << *ip << "\n";
  }

private:
  std::unique_ptr<int> ip;
};

void test(Foo obj) {
  obj.show();
}

int main() {
  Foo f(42);
  test(f);
  f.show();
  std::cin.get();
}
main.cpp(28): error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function



#5283470 Regex - Scan a string for special chars

Posted by on 25 March 2016 - 04:46 PM

After poking around it doesn't look like there's an umlaut class, but if you're using a locale that supports umlaut (see http://stackoverflow.com/questions/11254232/do-c11-regular-expressions-work-with-utf-8-strings) then you should be able to just manually include them in the regex:

 

std::regex reg("[^A-Za-z0-9äüöÄÜÖ\s]");




#5283281 How can I locate a memory leak?

Posted by on 24 March 2016 - 05:52 PM

You really could have ended the discussion on smart pointers there and come off as being reasonable.

 
There's at least three bad assumptions behind that statement.




#5283254 Should I give up?

Posted by on 24 March 2016 - 03:19 PM

Just because we program or develop games (or any other type of software) doesn't mean we are an authority on who can and can't develop games.

 
That's right. Ultimately the only authority on whether or not you can be a game developer is me.
 
So stay on your toes and get back to work.

48269.jpg

 

(Truth be told, though... You shouldn't let other people determine your fate for this one simple reason: Everyone wants to control you some degree or another, and the only way to get any kind of entertainment out of life is to frustrate people mercilessly over this.)




#5283235 How can I locate a memory leak?

Posted by on 24 March 2016 - 01:48 PM

 


There might even be problems where you honestly cannot apply RAII in a reasonable manner.

The classic example of a problem in which RAII is inappropriate is transactions with commit/rollback semantics.  Otherwise, it is Best Practice™.

 

 

?

 

Don't you just write a 'commit' function on the transaction object that disables the default rollback-on-destruction behavior?

 

Or do you mean something else?




#5283091 How can I locate a memory leak?

Posted by on 24 March 2016 - 03:28 AM

Khatharr, your original comment did sort of read like "you should just always use RAII for allocations"

No it doesn't. It reads like this:
 

If you're using VS

https://vld.codeplex.com/

Otherwise valgrind is the only tool I've heard of.

Honestly, if you just learn to use RAII then you don't have to mess with it much anymore.

 
Note that one line of four is about RAII. The others are about leak tools.

 

Further, seeing that RAII will eliminate the overwhelming majority of leaks I'd say that fourth line is a pretty fucking fair.
 

which doesn't apply well to all cases.

Yes it does. But you have this misconception because:
 

I'm guessing you were referring more specifically to the use of smart pointers

No. I'm not.
 

Even this wouldn't catch all memory leaks

 
AGAIN, I NEVER SAID IT WOULD.
 

unique pointers don't work well for all cases and shared pointers have a weakness to circular references (weak pointers can fight circular references, but require that a programmer know where to use them).

Entirely irrelevant.
 

Also in some cases the overhead of smart pointers is unacceptable.

JFC are you even being serious right now? You're being serious, aren't you?

 

Even ignoring the obvious fact that you should still use RAII in cases where the naive application of smart pointers is not appropriate, the overhead from smart pointers is insanely trivial. The only way you can get a performance issue from them is to do something dumb like continually creating and destroying them in large numbers. Even in that case the performance hit from the smart pointers is effectively invisible when held next to the overhead from the repeated allocations and releases that you damn well know you shouldn't be doing in the first place.

 

Using RAII doesn't mean shoehorning everything you see in unique_ptr or shared_ptr and then just shutting off your brain and rolling your face on the keyboard. It means not leaving your resource management solely up to PROVEN SOURCES OF CONTINUAL FAILURE like human memory and myopic analytical capability.

 

STOP WRITING BUGS ON PURPOSE.




#5283032 How can I locate a memory leak?

Posted by on 23 March 2016 - 07:09 PM

And the part where nobody said that is clearly not salient.




#5283013 How can I locate a memory leak?

Posted by on 23 March 2016 - 05:48 PM

Jesus fucking christ.

 

If you're going to talk to your fantasies instead of what I wrote then there's no reason for me to participate any further.




#5283004 How can I locate a memory leak?

Posted by on 23 March 2016 - 05:05 PM

 

 

 

Honestly, if you just learn to use RAII then you don't have to mess with it much anymore.

 

That's like saying that if carpenters would only learn to use hammers then they wouldnt need to mess with screwdrivers anymore

 

 

It's more like saying that if you aren't a jackass then you don't have to learn how to avoid spilling your beer while you're driving.

 

RAII is a discipline that specifically targets resource leakage and nearly solves the issue by itself, whereas using a hammer on a screw is just using the wrong tool for the job. If you're not using RAII and you have a ton of leaks then fucking use RAII and stop wasting everyone's time and energy on solved problems. If you are using RAII then you should already know where the leak is coming from (the place where you did the weird shit), and if not then there have been tools suggested to help you out.




#5282966 How can I locate a memory leak?

Posted by on 23 March 2016 - 02:17 PM

If you're using VS

 

https://vld.codeplex.com/

 

Otherwise valgrind is the only tool I've heard of.

 

Honestly, if you just learn to use RAII then you don't have to mess with it much anymore.




#5282730 Is making a Slender Game in Unity a viable first game?

Posted by on 22 March 2016 - 02:52 PM

 

Also, unless something has changed overnight, IP laws protect indie studios as well as AAA studios, so if you're planning on releasing this publicly you may want to consider that.

 

AFAIK this Slenderman thing is something of an internet phenomena, I guess something like rickrolling, just less well known or funny. At least that is what my very quick googling tells me.

 

So as long as the TO is not ripping off the other Slenderman games completly, he is most probably fine as nobody really holds the IP to the Slenderman idea.

 

 

From Wikipedia: "created by Something Awful forums user Eric Knudsen (a.k.a. "Victor Surge") in 2009".

 

That's enforceable. (He'll probably give permission, though.)






PARTNERS