Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Oct 2007
Offline Last Active Today, 06:48 AM

#5288466 Noob pointer question

Posted by Alectora on 24 April 2016 - 12:01 PM

Hi guys,


I've been in JavaScript for a very long time for work, and now back to C++ due to excitement of Vulkan. Of course, my hazy memory about pointers already got into me to lots of pointer errors. So here's a quick one...


Why is this working:

int* a = new int(5);
int* pA = a;
delete pA;

But this one isn't:

int a = 5;
int* pA = &a;
delete pA;

I may be wrong, but is it because I'm trying to delete a pointer (is it even a pointer I'm deleting?) allocated in reserved memory or something?



#5148147 My Custom Memory Pool Seems Too Slow. Need Advice.

Posted by Alectora on 19 April 2014 - 09:10 AM

After the clarification about the template issue, I tried to remove the map and decided to use the template instead. It removes the needs to find which pool I have to allocate (due to map), which increases the performance slightly (up to 0.1 sec) compare to the one that uses map and without template. If I reserve the capacity (by the total number of the test), it is reduced to 0.23 sec! The number of classes that would need this would probably at hundreds or less, unless doing such template that way is very expensive (I don't know).


EDIT: As Waterlimon suggested, I've changed the benchmark against the Car class to be quite a bit the same as Entity. The Car class now inherits Vehicle, where it has to pass a string through its constructor and save it to a name variable. Apparently this is the culprit. Now the Car increases up to 0.5x seconds!

Now everything looks quite normal, as a matter of fact, better!


Thanks a bunch guys!! you guys are very helpful. laugh.png

#5105976 Building a Modern 3d Game from the Ground Up a Realistic Goal?

Posted by Alectora on 31 October 2013 - 10:01 AM

Since you said you'll be very specific on your game engine, I think I don't mind for you to continue on. Of course, feature creep may get in your way so be careful for this, time will tell. I just hope it's just a hobby.


I think you should create a little risk management, but of course that depends on your goal. For example, if all you really want is the engine, you'll actually don't mind to give your life to make your specific 3D game engine. However, if your goal is the game, you'll set about X years phase for the game engine. If it's not quite feature complete/game development ready, you might want to switch to use current available game engines with extra 6 months of learning phase, or if the game engine is usable even at 50 - 75% completion, you can finally start the game development.


This way, since you've been dealing with the engine for a few years, fail or not, you know the scope of what specific graphics features are, and using someone's engine would be easier cause you know what you're looking for and you know how it works. So it's a win-win for you. Just set a deadline to motivate yourself on how long does the engine should be completed.


Trust me, no matter how many years/features you put on your game engine to be perfect, when you finally start creating the game using that engine, you'll always want to fix your engine where someone else could do the job. I've been there, and it's quite a long journey for one man's brain to go back and forth from engine to the game itself just to fix a little something (happens a lot and not to mention architectural/design failures; it's crazy, you might want to take a little vacation when that happen. which usually you'll end up letting it happen until the next big refactoring, the engine v2 roadmap).


Forgot: About Java/C++, since you want performance you might want to try C++. About the graphics API, that depends on your target platform.

#5105538 JavaScript literal object as C++ struct?

Posted by Alectora on 29 October 2013 - 07:18 PM

Technically, C++ structs are almost identical to classes (with just a minor difference in default visibility).  Realistically, C++ structs are typically used like C structs, or your Javascript Plain-Old-Data object above.  Limiting it to that is actually pretty valuable.

Cool Thanks! Now I'm more confident to limit my struct usage to just POD. :)

#5104684 Just how complex are AAA games?

Posted by Alectora on 26 October 2013 - 07:17 PM


I think it's getting complex as AAA when you put all efforts to push every single feature you need because you have money.


For example, indie devs usually don't have that much budget, so if you want to animate character, you use pixel art because it's easier enough (technically) than creating 3D realistic character as well as it doesn't matter since pixel art has its market as well, and sometimes can be done by the programmers themselves.

For me, it gets "AAA" when you want one 3D super realistic character to live by hiring one of the best 3D modeler, animator, fashion designer, weapon designer, facial expression designer, lighting designer, motion capture device, actor/actress, combat designer, etc just for that.


So if it goes to game code, see BioShock's case for example. They have money that they can hire one of the best they could as water programmer to solve complex water equations in a form of efficient code, and then integrate it to an already complex system within a heavily modified Unreal Engine based on the demand.

It is also when you want the best 3D sound ever that you have to make partner with one of the best sound synthesizer out there and code together with their technology (and their internal programmers) which increases the complexity due to integration and different way to deal with that partner's API.


So yeah, it's complex on demand.


Were an Indie, there's three of us in total. It's not impossible to make a AAA game, but it's near enough improbable.. It's taken nearly three months just to get the first scene set up, get basic animations and player characters / enemies, tessellation, shader system, Navmesh AI, basic DB, load save, a half working gui and buggy dialogue system and learn the quirks of the engine and start optimising everything so were not battling against it later in the pipeline.. That's doing 14 hours a day, at the moment we are trying to get the balance between graphical quality and performance which we have been scratching heads over for the last couple of weeks.. It's going to take a long time and our main concern is, by the time we've released the game (Probably two and a half to three years time) the bar will have been raised higher and it makes all this time and effort on graphics mute.


Don't get me wrong, we could do a simple indie type game in a week.. But were trying to go all out and make it the best we possibly can.



Yes I get you mean, the pixel art stuff was just one possible example. What I'm trying to say is, for me a AAA is since you have big budget, you'll use whatever means to make things happen. For example, when it comes to big budget like making a music video, hiring many choreographers won't be hassle instead of researching on your own.


I'm pretty sure even with a super small team can produce AAA graphics and gameplay quality games especially with current tool sets available, but the idea is the budget that you can reach all over the world to get your thing works to the edge. Another example is like GTA 5 pushes the dialogue as realistic as possible by hiring real gangsters out there. That costs money for sure, while we can watch YouTube, movies and stuff to save costs with a result that maybe a little close enough.

#5103996 How can I gain a deeper understanding of C/C++?

Posted by Alectora on 23 October 2013 - 10:20 PM

Do a lot of programming, and make it bigger and bigger too see how repetitive your code could become that you finally learn how to make stuff generic (generic programming). If you finally end up wanting to read about patterns and architecture books, that's when you realize you're getting deep. It won't be about C++ anymore, it's about the concepts, and only comes up when you face real problems every day based on your requirements.


Learning from other programmers make it quick as everyone always have opinion on the way they code, as coding doesn't always about right or wrong when it comes to patterns or architecture, it's what's fit on your current problem.

#5103705 Will it be C++ the preferred game dev language in 3 years from now?

Posted by Alectora on 23 October 2013 - 07:45 AM

I think C++ will stay. C++ is really like a sports car using manual transmission as you can always manage your memory without tricks like in Java, C#, or any other languages that uses automatic garbage collection which causes trouble on resource-intensive tasks. Since you're asking about game dev, it's a yes for me.

#5082457 Wisdom Of The Land (New relaxing World Map track!)

Posted by Alectora on 02 August 2013 - 06:17 AM

I really can't level my words with your works. All I can for this one it's greatly excellent. You were great and just getting even more, better-er.


I really like the transition 0:13 - 0:15, and 0:25 - 0:33. I like the flow, it's all at the same level, not too loud and not too quiet.

#5031418 Tales of Home - A Snippet

Posted by Alectora on 12 February 2013 - 08:26 AM

As a matter of fact, graphics can have a serious impact on performance, especially when you have a lot of floating windows with software and plug-ins not optimized for graphics performance. I quickly ran into this problem with my old MBP as it only had an integrated Intel HD GPU.
On my new machine, I disabled the graphics switching feature that would switch to the weak on-board GPU when the MBP feels it doesn't need the powerful GPU and can save some power. I have the power adapter plugged in most of the time anyways, and graphics performance shouldn't become the achilles heel with the powerful CPUs we can use today.


Oh my, I didn't realize that. I better get a new machine too then. I am currently in MBA with integrated Intel HD GPU, and its totally limited when it comes to East West orchestra (it is supposed to have around 3.5 GB memory but the graphic card takes up to 1.6 GB memory, leaving me around 2.2 GB ... sad).


Thanks for the correction Moritz!

#5016542 Demo reel 2012 - Do you think I'm ready for contract work?

Posted by Alectora on 01 January 2013 - 08:48 PM

I simply say just jump in. Your quality of music is on production level, in my opinion. Now its a matter you'll find the "right" client or not; ones that like your music. How do they find you? make more, share more, get into them. There are a lot of way to do it on the internet days. Play more and more games and find out who made them; if you target on indie games, contact them, have interest in their games (only if you really like them), chat/message them that you can offer great music regarding to the games or next games, be proactive and genuine. In the end its a matter of how strong you are when tackled on different opinions/rejections while keep on improving.


Good luck, you can do it! laugh.png