AlexB.hpp

Members
  • Content count

    37
  • Joined

  • Last visited

Everything posted by AlexB.hpp

  1. ranges and glsl

    In hlsl there is normalize()... Probably there should be something like that. But you should check this by yourself 'cause I do learn shaders for 2 months and don't know much.
  2. I've started working on simple and little class for C++ to check some memory leaks. I have made some work on it, but there is a lot of work to do. I'm planing to add cppunit, autoreconf, documentation, static class instread of global functions, different loggers. Now it has: shared library, header with some funcs declarations, makefile to build it via g++, simple script to test it, linux only but I'll port it to win after some researching. I do it for my own project but I would like to share it with a great pleasure. Now it looks like this [CODE] alexb leak_checker> ./run.sh MEMORY LEAK! 0x8c1a008 main.cpp 5 MEMORY LEAK! 0x8c1a038 main.cpp 6 [/CODE] with such main: [source] #include <iostream> #include "allocation_hooks.h" int main(int argc, char** argv) { int* num = new int; num = new int[1]; check_map(); } [/source] Repo is [url="https://github.com/AlexBolotsin/memcheck"]here[/url]. PS Warning it has some magic in it!
  3. [?++] Memory leak checker

    Oh, many thanks again. Looks like I've fixed the old one problem with infinite loop in stl. So... Actually I've done major work on it. Ok I pretty sure that realloc is ok now. It does; [CODE] new_ptr = realloc(old_ptr, size) if (!new_ptr) return old_ptr return new_ptr [/CODE] I'll read stuff about exceptions. And figure out how it should be. I have funny stuff as one of my friends said. I have calls of delete on unregistered ptrs [CODE] Try to erase unregistered pointer 0x82f10f8! Memory leak summary: operator new (0x82f1008) missed 4 bytes in main.cpp:5 operator new [] (0x82f1040) missed 4 bytes in main.cpp:6 malloc (0x82f1078) missed 4 bytes in main.cpp:7 calloc (0x82f10b0) missed 4 bytes in main.cpp:8 realloc (0x82f10e8) missed 8 bytes in main.cpp:10 Total leaked 24 bytes Try to erase unregistered pointer 0x82f10f8! Try to erase unregistered pointer 0x82f10c0! Try to erase unregistered pointer 0x82f1088! Try to erase unregistered pointer 0x82f1050! Try to erase unregistered pointer 0x82f1018! [/CODE]
  4. [?++] Memory leak checker

    Damn it, I've stuck a little. Meet cool bug when some containers of STL use my funcs and do stucking in infinite loop. You know how it happens - you read about 1000 books of cpp and still doing this stupid mistakes in you code.
  5. Looking for a study partner at C++, SDL and OpenGL.

    I want to join you guys. I have 4 years experience in C++. Now I'm working on 2d engine with few friends of mine. I'm about 3rd month working in game dev. It's AlexBolotsin@Gmail.com
  6. [?++] Memory leak checker

    [quote name='SiCrane' timestamp='1354131396' post='5005045'] That still doesn't handle realloc() properly. You aren't taking into account instances when size is equal to zero and you are also aren't handling null return values properly for what looks like any of the allocation functions. Your code also looks like it blows up messily if your header is included before code that uses placement new (which includes large chunks of the standard library). [/quote] Hm. I've read it already. Tomorrow I'll fix it. That bastard is really tricky, too many behaviors for just one func... About including my header - yeah it has a bug here, I know about it. I'll describe it in docs. Have no ideas now. Thank you. [quote name='e?dd' timestamp='1354134791' post='5005058'] Some other problems:[list] [*]void* operator new[] is missing a 'return'. [*]Not exception safe (meaning that somewhat ironically, it can cause leaks). [*]Causes problems with existing placement-new overloads (though working around that is probably very tricky). [/list] [/quote] Many thanks. Still need some tests. It's in todo list. About placement new... I'll keep it in mind.
  7. Read opened thread for this problem to find out better solution. It's really interesting.
  8. [?++] Memory leak checker

    [quote name='SiCrane' timestamp='1354124673' post='5005006'] Probably not, but I wouldn't know for sure unless I saw the complete context for your code. Either way it doesn't address the issue of properly copying the data in the buffer that realloc() is supposed to do. [/quote] To prevent all misunderstandings I've implemented it via original funcs. Also I have improved output: [CODE] Memory leak summary: operator new (0x83af008) missed 4 bytes in main.cpp:5 operator new[] (0x83af040) missed 4 bytes in main.cpp:6 malloc (0x83af078) missed 4 bytes in main.cpp:7 calloc (0x83af0b0) missed 4 bytes in main.cpp:8 realloc (0x83af0e8) missed 8 bytes in main.cpp:10 Total leaked 24 bytes [/CODE]
  9. [?++] Memory leak checker

    [quote name='SiCrane' timestamp='1354113215' post='5004970'] Your realloc() implementation is definitely wrong. As it is, it [i]creates[/i] a memory leak. If realloc() returns a new address, the old allocation needs to be freed. Also, the data copy doesn't properly handle the situation where the new size is greater than the old size. [/quote] Many thanks about this issue with old ptr. Yeah I knew about greater size then old ptr had. Will it be ok if i'll do memset(new_ptr, 0, size)?
  10. [?++] Memory leak checker

    [quote name='wqking' timestamp='1354096944' post='5004907'] Good start. But reporting leaks with only addresses is not quite helpful. I would like to know the call stack and the class name, if possible. [/quote] I'm planning such output: [CODE] Memory leaks summary: operator new in main.cpp:34 (0x0fa43d41) allocated 4 bytes ... [/CODE] What output would be enough informative for you? [quote name='Dynamo_Maestro' timestamp='1354102278' post='5004932'] I forgotten the method (since this technique ironically reports smart pointers as leaks heh) but MFC has a pretty decent way of checking for leaks already even if you arent making MFC apps, heres the link anyway http://msdn.microsoft.com/en-us/library/c99kz476(v=vs.100).aspx [/quote] I'm making it as cross-platform solution. But however thanks.
  11. [?++] Memory leak checker

    Added malloc, calloc, realloc and free wrappers. Added gitignore. I have a question about realloc. Does it reallocate of incoming pointer? Is it correct in my code?
  12. [?++] Memory leak checker

    [quote name='SiCrane' timestamp='1354058338' post='5004731'] Don't forget calloc() and realloc(). realloc() is always a fun one to deal with because depending on how you call it, it can also act like malloc() or free(). [/quote] Thx for calloc don't even know about it.
  13. [?++] Memory leak checker

    [quote name='ApochPiQ' timestamp='1354056553' post='5004714'] [code]#include <malloc.h> #include "allocation_hooks.h" int main() { void* foo = malloc(1024); check_map(); // No leak reported. }[/code] [/quote] Cause there is no malloc overloading. Will add to todo list. Thx [url="https://github.com/AlexBolotsin/leak_check/issues/1"]1st issue[/url] added.
  14. Stuck on newbie project

    [quote name='Nausea' timestamp='1353942090' post='5004205'] AlexB.hpp: I take it you´re joking? ... [/quote] Don't be mad about that... I didn't mean any stupid stuff. I wanted to said that you have a great possibility to make a nice game and take a lot of experience. Some time I write/say totally strange things, but it's ok for me. That's how I start deep thinking.
  15. Stuck on newbie project

    You need collision detector cauze bullets gets thought terrain. Actually there is a lot of possible improvements. Does your character can shot only horizontal ax? Are there any other types of weapons? What about some enemies? What about twitter or smth else in it? Does it have achievements? --- Looks like my English still pretty bad if I couldn't talk what I want.
  16. Storing static game information

    Looks like you have to many subquestions. You need to sort them one by one. So let's see.[list=1] [*]How to store some data? [*]Where to store data? [*]Can it be covered with encryption? [*]What the best format to store some pretty similar chunks? [*]Does xml enough good to store some data in it? [*]How many data I want to have? [*]What level of agile in my data sources I do need? [*]Do I really have to write it on Java? [/list] Actually you can use litesql for store data. It was ok for store some data in it. There is some important questions such as 7th of the list. For the beginning you can use some simple interface to obtain data. It will give you lot of abstraction when to realize it in the future, when you will have enough knowledge about how to do it in optimized way.
  17. I've got nice link from 3D Game Engine Programming by Stefan Zerbst and Oliver Duvel to gamasutra.com. Surfing it for a little I've got to a programmer blogs. And got it - [url="http://gamasutra.com/blogs/EmrahOzer/20121112/181409/30_Tips_For_Newbie_Game_Programmers.php"]30 Tips For Newbie Game Programmers by Emrah Ozer[/url]. I want to talk a little about 8th tip: [quote]If you're developing your own game -please I beg you- don't make a clone game. Nobody needs a another bubble game. Clone game development causes you to not to learn the game design iteration process.[/quote] I think it's really important for us, I'm talking about novices in gamedev which are looking for idea to realize. There is no need to realize ping-pong, asteroids, breakout and other crap, being implemented so many times... For those who don't know about ludum dare. So as a source of ideas I want to show you [url="http://www.ludumdare.com/compo/"]ludum dare[/url] contest. There is no prizes or anything, but there you can find really interesting in gamedev people which can give you a nice feedback to make you game better. So read about this contest and take a part in next one.
  18. 30 Tips For Newbie Game Programmers

    Hm. SuperVGA, I've got your point. But however it's always better to do what you really want to do. Actually you can cook an egg in few different ways. So you can spent time on figuring out all possible ways of an egg cooking or do smth else. It's only your very own choice. And I believe if you going that way it will lead you to success. You're very own success.
  19. swapping issue

    Delete it, please.
  20. 30 Tips For Newbie Game Programmers

    [quote name='Kale' timestamp='1353463130' post='5002824'] [quote name='AlexB.hpp' timestamp='1353442105' post='5002741'] I think it's really important for us, I'm talking about novices in gamedev which are looking for idea to realize. There is no need to realize ping-pong, asteroids, breakout and other crap, being implemented so many times... [/quote] If they're novices, do you really think they should be spending their time to do something that's never been done and losing their way with less chance from getting help from experienced developers? At least, if they do something that's been done, others will likely know how to assist them in it because they have probably done it themselves. Sides, most people who want to go into game development, have plenty of ideas they want to utilize, but their lack of skills is what holding them back. Which is why they redo simple games to learn the skills so they can get to what they really want to do. [/quote] [quote name='Telastyn' timestamp='1353443153' post='5002746'] People learning to program don't need to learn game design iteration. They need to be able to take an idea and make it work in code. Game design just muddies the waters. [/quote] [quote name='SuperVGA' timestamp='1353492150' post='5002878'] [quote name='AlexB.hpp' timestamp='1353442105' post='5002741'] I want to talk a little about 8th tip: [quote]If you're developing your own game -please I beg you- don't make a clone game. Nobody needs a another bubble game. Clone game development causes you to not to learn the game design iteration process.[/quote] I think it's really important for us, I'm talking about novices in gamedev which are looking for idea to realize. There is no need to realize ping-pong, asteroids, breakout and other crap, being implemented so many times... [/quote] I disagree; If you're learning to program it's great to have a clearly defined goal to stick to, so you can focus on dealing with the programming thing. It's like saying don't play "bad bad leroy brown" on the guitar when learning to play guitar. Play something new and different! Or saying; improvise while learning to cook! It will make you a better cook. If I'm not sure if I'm making spaghetti, I'll both be figuring out what I'm trying to cook, while running all over the kitchen, failing to memorize where I put the knives. - Just because somebody else cooked spaghetti with meatballs, my kids won't enjoy my meal as much? If you know you're creating a jawbreaker game, pong or asteroids, you have a pretty good idea of what you want to end up with. You can program your way there; that is the actual challenge, and what you actually need to learn. As superman3275 said, the statement seems to originally be directed towards established/upstart game developers (with prior programming experience implied). And aside from how games are received by the public, I think it's up to the individual developer to decide what he or she enjoys developing more. Unless you're looking to become popular, or make money off development, why would you develop a game based on what other people like? If it's my hobby, I intend to create something I enjoy. That's what drives indie development IMO. Only pleasing the end user is sort of a commercialization of the scene, I think. [/quote] Learning process isn't easy. That's why we need to be patient and use iterations on finding some answers by ourself. There is no right or wrong way to learn game making. There is only your way. If you don't know how to create a bunch of classes to hide your functions you should read some books. If you don't know what game to develop so you probably need to delay it and read something or just sleep to get some inspiration. If you don't know how to use some lib - create your own to get it. And so on. You should do it step by step - learn it point to point and after sometime you will be able to create really nice game, so you could get some good critics and even some profit. You can't ignore design part of gamedev. It's just like team without leader - it won't do something good because someone should get control on a project and lead it to success. So in the future you will have to deal with design anyway. There is only one thing I'm talking about - inspiration. When you could imagine some nice game, describe it and implement. I wanna to remember Phil Fish's story of making Fez. He was working on it for 4 years. He was insane about improve it and changed whole design for 3 times. You can say - stupid, but I say - it's inspiration. It's some kind of magic going of inside of everyone. To create something really cool you should do as much as possible and don't ignore even a little issues. Responsibility greatest motivator for programmers. So now let's see how much experience you will gain complete a breakout or complete some little nice game which was imagined by yourself. It's all about making a decision - do I like to programming and creating games or don't.
  21. Who to follow on Twitter?

    Find [url="https://twitter.com/theromero"]Romero[/url] on tweeter. Enjoy.
  22. Best OpenGL books for beginners (C++)

    About dates - it's ok. OpenGL don't changes too fast. Anyway this 2 books awesome starting point in OpenGL learning. I've read first one. Look at this one - [url="http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Tutorial-Reference/dp/0321712617/ref=sr_1_2?ie=UTF8&qid=1353259470&sr=8-2&keywords=superbible"]OpenGL SuperBible[/url]. It's brilliant. I'm reading it now and I like it so much.
  23. [quote name='Sugavanas' timestamp='1353237459' post='5002008'] [quote name='Mathew Bergen' timestamp='1353227489' post='5001983'] Im not sure if this was said already but a good book, that i personally learned c++ from, is called beginning c++ through game development. Its cheap and very easy to understand. And when it says through game development, its using simple text games as examples for learning c++. As many will say to stay away from c++ if you are just learning how to program since it is complicated, i say go for it. I learned c++ first, and it was challenging, and i don't recommend it, but it can be done. [url="http://www.amazon.ca/Beginning-Through-Game-Programming-Second/dp/1598633600/ref=sr_1_2?ie=UTF8&amp;amp;qid=1353226851&amp;amp;sr=8-2"]http://www.amazon.ca...6851&amp;#38;sr=8-2[/url] Also, there is c++11 out, and i haven't looked into it, and i really don't want to right now, but maybe you should look for something that explains that. Now don't quote me on anything, but c++11 is the new version of c++ and people will probably start moving towards that. [/quote] thanks, i am using c++ which come with visual studio 2012, if m correct it is c++11 [/quote] Actually it looks like VS 2012 has default support of cxx11 (just another one way to write c++11). Hm... I suggest next book as base of programming - [url="http://www.amazon.com/Ivor-Hortons-Beginning-Visual-2012/dp/1118368088/ref=sr_1_3?ie=UTF8&amp;qid=1353257607&amp;sr=8-3&amp;keywords=Programming+Visual+C%2B%2B"]Ivor Horton's Beginning Visual C++ 2012[/url]. This book is really nice to a novice showing all basic stuff: variables, loops and so on. But I'm warning you - C++ is difficult. It's much complicated than C# and Java, because it haven't memory manager as it's in Java and C#. Did you make a final decision? Probably it would be better to you to start with C# and XNA? It's allow you to do some simple games in near future.
  24. How should I tackle programming

    To protect the TS! I'd spend on C++ about 3.5 years and still learning it. GameDev programming is just another branch in programming. So you should learn it as another one. And if you start learning it on 1st year of learning the language, then you will more skilled in it on 2nd, 3rd year. I wish to TS a good luck and be patient. PS You do need a challenges to learn anything. There is no other way.