Jump to content

  • Log In with Google      Sign In   
  • Create Account

DishSoap

Member Since 13 Sep 2012
Offline Last Active Oct 14 2014 09:49 PM

Posts I've Made

In Topic: Pointer to Pointer Issue

26 February 2014 - 12:01 PM

That was exactly the issue. I will fix my post when I get home.

 

*EDIT*

Home now! I fixed it. Thank you.


In Topic: Pointer to Pointer Issue

26 February 2014 - 11:39 AM

Haha. I figured it out driving to school. Funny how a 10 minute break after staring at something for hourd makes you realize your mistaked. How can I delete this thread??

In Topic: Type of game for a newbie?

08 December 2013 - 08:58 AM

If by mastering the basic games you mean you have developed a couple of the games mentioned above then I don't see why not. A top down rpg or some creative twist on 2D rpgs wouldn't be too far off. 

 

If you don't have much experience now and are wanting to learn C++, while building a game, find yourself a good book or reference for C++ and program a text based rpg or text based adventure game. That may not sound too interesting but I think you will learn that they are a lot of fun to create. You will be amazed at how much you learn about a language from coding that style of game as well. 


In Topic: Type of game for a newbie?

07 December 2013 - 09:42 PM

|EDIT|

I didn't answer the first part of your question so here that part goes... I would focus on creating easy clones for a while, pong, space invaders or asteroids are all excellent choices. After that you can move on to games a big larger in scale, perhaps a simple platformer or a puzzle game. The idea is to start small in scope and progress onto larger and larger projects, you can't learn to run before you can walk! Programming is the same way.

|DONE EDIT|

 

It all depends on your preference and what you know and want to learn. Is there a certain language you want to learn or one you know already?

I don't believe those aspects to be terribly important, but if your goal is to eventually program a game using technology X and Y it would be best to recommend some APIs and languages that would eventually guide you there.

 

I personally started game development with C# and XNA, a lot of people around here might suggest using something more current, but for a beginner I think you could still learn a ton really quickly using a XNA or MonoGame with C#.

 

If you know any C++ you could use a graphics library such as SFML or SDL for graphics.

 

There are plenty of game engines out there these days too, while I haven't personally used it, plenty of people use Unity to great effect. 

 

The possibilities are nearly endless smile.png. Is there a certain direction you were leaning?


In Topic: Memory Leak Question C++

06 December 2013 - 04:20 PM

Here's what's going on, and the explanation for your leak:

- You create a Person object, and put a pointer to it in some_list.

- When some_person goes out of scope, Person is destructed. At this point, the two strings inside it (email and name) will also be destructed. And as you know, you still have a pointer to this (now garbage/undefined) memory that used to contain a valid Person.

- When you make this assignment:

        map[1]->email = "blah";

 it will call std::string's assignment operator. What that does is allocate new memory, and copy "blah" into that new memory. Technically this is the undefined behavior, since you shouldn't be calling methods on objects that have been destructed.

 

And that's it. There's your leak. You invoked std::string's assignment operator, which makes an allocation. But that std::string was already destructed, meaning its destructor will never be called. And thus the destructor for the mail and name strings will never be called.

 

Thank you!

 

The fact that I didn't understand 'why' it was a leak made me feel like I was lacking some basic knowledge, which I was. So thank you for spelling it out for me. 


PARTNERS