Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 Nov 2002
Offline Last Active May 27 2016 04:50 PM

#5210336 What's the point of obfuscating managed code?

Posted by alnite on 12 February 2015 - 01:56 PM

Code obfuscation is typically done when you release your game to the public.  During the normal development time, you never want to obfuscate your code.


Which means that you have to get into habit handling multiple development environments (e.g. Release vs. Debug, development - alpha - beta - production).  Your code has to cope with those differences in the env too.  During development, you output as much as debugging info as possible, turn on fps, wireframe, collision boxes, etc.  When you toggle your build to Release, all of that is turned off and obfuscation is turned on.


You still have to retest your game in Release mode as it's now a different binary.  There could potentially bugs that arise only when you have it on Release mode.

#5209749 Enemy Bullets

Posted by alnite on 10 February 2015 - 12:46 AM

Here are a question to ask yourself:


When do enemies shoot?  Is it after a predetermined set of interval, e.g. every 2 seconds, 1 second, 10 seconds? or is it triggered by a specific event in the game, e.g. player happens to be in the line of sight?  Or perhaps a specific frame in an animation?  Just like the player shoots after the player presses the shoot button, enemies need their own triggers too.  The only difference is that instead of having the human player initiates the trigger (pressing a button), the trigger for the enemies must come from within the game code itself.


Once you have determined the trigger, then it's a matter of calling that createBullet() function from that trigger.


If you have organized your game objects such that the player and enemies share a common interface to shoot bullets, then having the enemies shoot is just the same as having the player shoots.

if (shootButton.pressed()) {

if (enemyTrigger.shoot()) {

#5209651 Clean OOP programming question

Posted by alnite on 09 February 2015 - 01:28 PM

Pointer debate aside, "Clean OOP" is elusive.  To OP, I would suggest that you shouldn't sweat too much about doing things the right way.  Pick one, do it, and assess it yourself whether it has helped you steer in the right direction, or make your code worse.


Your app is event driven.  If user interacts with CProjectWizardWindow, and CMainWindow should receive a message when such event occurred, then you have several options.  You could create some "listener" classes for CProjectWizardWindow.  How many listener classes?  Depends on how many events you are emitting, and how many of them you want to differentiate into separate classes, or you could just lump them into one class.  Up to you.


For the sake of an example, let's have one and call this listener class: CProjectWizardEventListener.  This class would define certain methods that need to be implemented by the subclasses.  Depending on the events, CProjectWizardWindow will invoke different methods.


CMainWindow should inherit from CProjectWizardEventListener, and implement these methods.  CProjectWizardWindow will then maintain a list of these listeners, then, when the ok is pressed, it iterates through the list and call the method.  Something like this:

class CProjectWizardEventListener {
    virtual void OnOkPressed(CProjectWizardWindow*) = 0;
    virtual void OnCancelPressed(CProjectWizardWindow*) = 0;
    // add more events here

// notify the listeners when ok is pressed
std::vector<CProjectWizardEventListener*> listeners;
for_each(listener.begin(); listener.end(); InvokeOnOkPressed);

class CMainWindow : public CProjectEventListener {
    virtual void OnOkPressed(CProjectWizardWindow* cpww) {
        // handle the ok event here

Now, this is not the silver bullet.  You can design this in however you want, but this is a direction you can decide to choose.  Sometimes people don't like this approach because your CProjectWizardWindow has to maintain the list of the listeners, inserts them, removes them, etc.  Sometimes people rather choose to emit the event to some event manager that handles all events and all the listeners.  Pick one, and decide for yourself.

#5208850 Why do mobile app crash?

Posted by alnite on 05 February 2015 - 04:09 AM

Thanks for the suggestion !! But still I don't get that ... sad.png I think I am a little more dumb then I though of myself !! biggrin.png I am sure other member over here will help me out once they see my post ! smile.png


You first need to install the Android SDK.  You might also need to install Java Development Kit (JDK).


Enable USB Debugging on your device.  Where it is in the Settings depends on your phone's manufacturer.  Look it up.


Plugin your Android device through USB.  If you use Mac/Linux, it should be able to detect it.  If you use Windows, you might need to install a driver first, again, depends on your phone manufacturer.


Then run the Android Monitor tool.  It will give you the activities that's currently running on your phone.


If there's a crash, it will usually say so and why.  However, this is usually for the developer of the app that's crashing.  As a user, this information is not that useful because you don't have access to the source code.

#5206490 Java how to do this

Posted by alnite on 24 January 2015 - 07:10 PM

I think the problem is that you are not saving the resulting string from the previous invocations, so strOutput only yields the result from the last replaceAll().

strOutput = english.getText().toString()
for (int i = 0; i < enLang.length; i++) {
    strOutput = strOutput.replaceAll(enLang[i], petLang[i]);
return strOutput;

#5205857 Should I leave the current company and take the risk?

Posted by alnite on 21 January 2015 - 03:24 PM

I have offered a C++ Augmented Reality job, which is interesting to me, at least I won't go far away from GD.. but I'm very worried, it's a small company, pays less, and right now, the manager told me that there are two c++ guys that are leaving and they want me asap.


That's actually a redflag.  Perhaps there's something with the management or the financial of the company.  If this is a brand new startup with lots of funding, and everyone is excited to jump onboard, that's a whole different story.  But the fact that there are people quitting, and these two happen to be (I would assume) the core C++ programmers, you would be left out dealing with source code which you have no idea how it works, and there's deadline looming over your head because he wants to join you ASAP.


My suggestion is look for other opportunities.  Take advantage of the idle time you have at work as much as possible by learning/working on separate projects that can make your resume look better.

#5205206 A new beginning, some questions for pointers for a stranger to coding

Posted by alnite on 19 January 2015 - 12:18 AM

I am now going to self-proclaim myself as an expert.  So, in addition to reading my expert advice, please read the forum's beginners guide for further references.


As I understand it's rather easy or at least possible to change to another platform with JAVA coding am I right?

That's what they say, but usually when you are coding an app, be it for mobiles or PC or server-side, you will eventually use the platform-specific libraries.  That promise only holds true when you write a Hello World, or a very simple program.


The list that says you first need to start with tetris, then breakout, then pacman isn't authoritative.  You don't have to have that exact sequence.  What you need is lots of experience.  Lots of programming experience dealing with lots of different things.  That sounds a lot, because well it is.


Programming is a tricky skill.  No one can tell you exactly how to become a good programmer.  Unlike, let's say carpentry, in which you may have some blueprints of a design, along with its measurements, programming doesn't have that luxury.  There are sample codes, but part of the fun of programming isn't making someone else's games, it is to make your games.  To make your own game, you just have to do it with trials and errors.


The good news is that you don't need all of those just to create a game.  Creating a game counts toward that experience, and you don't even have to start with tetris.  Make some lame game where you get to drag this...camel, collecting stranded adventurers in desert, or something like that.  Create a game with ridiculously simple mechanic that takes a 2-year-old no longer than 10 seconds to master, like Flappy Bird.


Don't be discouraged by its simplicity, nor feeling like a loser for making such a ridiculous simple game.  If your friends make fun of you for making ugly simple games, instead of shiny 3d graphics with unity, then dump them and make new friends.


Don't worry about the nitty gritty details like whether to use Paint or Photoshop, or which IDE, or what PC with what video cards.  All of those are irrelevant.  Just pick one, and start coding..

#5203983 I am beginning to hate the IT and gaming industry.

Posted by alnite on 13 January 2015 - 12:04 PM

Tbh, I never want to work for a game company ever again (unless I'm running it of course)

Awesome! We are on the same boat now!


General tech industry interviews are more annoying than game industry btw, and you have experienced some of those at Microsoft.  They want people with a particular set of skills with X years of recent experience.  One example is this one company that builds game engines using Java.  I have worked on Java professionally for like 6-7 years, but I wasn't using Java in the last two years.  They flat out rejected me.  Like, flat out rejected my resume!  They didn't even want to call me in for an interview.


Here's some insights about these employers:

People are picky, but they don't really know how unqualified they actually are to be picky.  This is why you see job description with bazillion requirements.  They don't know what they want, they vaguely know what kind of person they are looking for, but they can't make a decision.  So they just throw in the most impossible qualifications.  They want the best, likable, person they can find who's willing to take the bait.


If you are applying at a hot startup company (e.g. Twitter back before it went IPO), this can get worse as ego will bloat their little heads thinking they are a hot piece of a company.  You gotta be as "cool" as them.  The definition of cool is up to whatever they feel at the time they interviewed you.


If you are applying at a company that's as behemoth as Microsoft or Google, then you are at the mercy of whichever department interviewed you.  Their expected set of skills might be different than that of your resume.  Expect the worse.  I have had an artist interviewed and rejected me.  A fucking artist who didn't even ask me any technical questions rejected me.  Obviously he didn't like me.  What could I do?


Employers buy skills, they don't buy potential.  They buy what you can present at your resume and interview.  Even if you have done your best to present yourself, sometimes people expect different "type" of person.  I have interviewed many qualified candidates, but my coworkers didn't like them.  They vibed you.  "Can I get along working with this guy?",  "Oh he talked to much", "Oh he is too opinionated".  "I don't like his hobbies".  "I like cats and he said he loved dogs.  I don't like dog people", "Oh he doesn't have a Facebook account.  He's got something to hide."


Whatever random crap that's going on in their heads.  You can't control these.


The best thing you can do is to do your best presenting yourself.  If they don't like you, then fuck them, you move on.  End of relationship.  Did you know one of cofounders of What's App applied for a job at Facebook and Twitter but got rejected?  Technically unqualified?  Hardly.  Whoever interviewed him at Facebook and Twitter didn't like him.


Accept the fact that there are millions of personalities out there.  Job interviews aren't just about a set of skills, it's also a match.com.  If they personally don't like you, they will come up with lame reasons, within legal boundaries, why to reject you, which I am sure you have grown tired of.

#5201763 Is it a good idea to block android phones that cause lots of trouble?

Posted by alnite on 04 January 2015 - 10:46 AM

I thought Google provide you with a crash log remotely?  Last time I did Android development, you can check in your Google developer page the recent crashes along with their stack trace.


Singling out particular models because your app is crashing is bad engineering.  Unless it's beyond your control (e.g. hardware issues, in which case it should only affect that one device only), you can normally find the problem.  Perhaps it's a timing issue if your app is multi-threaded.  Perhaps different resolutions causes some computations to mess up and you got a divide-by-zero.  Maybe your app is consuming too much memory, and these phones can't handle it.


Releasing an app is running a business, and these are your customers, so I would recommend that you investigate and try to fix it.

#5188631 Does Valve have a good working methodology?

Posted by alnite on 22 October 2014 - 05:29 PM

Somewhat related:



There's also the part 2.  Check it out.


The whole idea of this loose structure is based off trust.  Without trust, this won't work.  So obviously, if you have an enormous company with poor management teams and where 50% of employees aren't happy, you can't just switch to this structure and expect everybody to get happy and get along.  This is something that has to be built from the ground up, starting from the core original employees, and the support from the management.


Managers of a Big Co sometimes want to keep that power.  Why?  They don't trust their employees will do the right thing.  They treat them like some kind of farm animals, resources that needs to be caged and directed to maintain order.  This is fine and well, but domesticated employees will do nothing but being told.  Without direction, they will refuse to work.  When there is no project to work on, nobody will come up with a new exciting project, people will simply sit and idle.  Not because they can't start one, because they don't want to.  Why should they?  They don't get paid extra for it, and perhaps if the project did end up successful, the managers or other people will try to steal the credit -- because there's no trust among the employees.


While a structure that's as loose as Valve's encourages employees to be independent, so they can have some 'ownership' or 'investment' to their projects, which ultimately benefit the company as a whole.  The idea is for employees to understand that the company trusts them to do the right thing, and that they should be the one turning the gears, not being the cog in the wheel.

#5182246 Fear of replacement

Posted by alnite on 22 September 2014 - 04:00 PM

Test, test, test your code.  Everyone makes mistakes, even professionals, even those with 1000 years of experience (exaggerated).  Your brain is so fragile that your thinking can be affected by the time you wake up/sleep, what you ate, what you drank, what your friend just told you, or a bug buzzing around your monitor.  Pretty much everything.  Any developer who refuses to write tests is only fooling himself.


Your coworker is immature.  Any senior engineer would've understood that everyone makes mistakes, and not make a big deal out of it.  He's not a team player, and plays the blame game.  If your manager is anywhere smart, he'd boot him instead of you.  Act professional, admit your mistakes, correct your mistakes, and don't play the blame game.  What you did was right.  If the company decided to boot you, it's their loss.  Really.  Keeping that coworker would damage the company more.

#5168691 Looking for feedback to add more of a 'point' to our game

Posted by alnite on 23 July 2014 - 11:33 AM

You need quests.  You need to direct people what to do when they first play the game.  I just tried your game, and found myself having to consult the manual a lot just to find out what I can do or cannot do.  And I have done a lot more reading than what most people would be willing to do.


As a level 1 thug, I can only pickpocket or punch, which only netted me ~$20/action.  When can I move on and do something else?  What commands should I enter to get to those?  I tried buying some drugs, and it tells me to get a container, and after consulting the manual (again), I can't find containers anywhere else in the shop.


Tell players exactly what to do:

"You are on your own and need some cash.  Type .crime pp or .crime punch"
> .crime pp
"You stole $100 from wandering tourists!  Awesome, let's buy some containers so we can get drugs later.  Type .shop buy container"
> .shop buy container
"You spent $10 on a container. Nice! Your buddy Joe asked you for some cash. Type .crime punch Joe to tell him to go away, or .debt add Joe to loan him some cash"
> .debt add Joe
"You loan $20 to Joe.  He said "I appreciate it" and left.  You now have $50. Go rob more tourists"
> .crime pp
"You stole $150 from wandering tourists!  Now let's try to trade some drugs"

You get the idea.  After players get a hang of the game with some commands, then you can let them go in the open world.

#5149515 Fastest way to get elements in one list but not in other and vice versa

Posted by alnite on 25 April 2014 - 05:35 PM

edit: ok. apparently I misread the question.


std::vector<T> difference(const std::vector<T>& A, const std::vector<T>& B) {
  std::vector<T> result(std::max(A.size(), B.size());
  for (auto &e : A) {
    if (std::find(B.begin(), B.end(), e) == B.end()) {
  return result;
difference(A, B); // A - B
difference(B, A); // B - A


Possible optimizations:

  • Sorted A and B can use binary search.
  • Only perform this operation when A/B change.  If you can identify a part in your code where A and B change, you can minimize the recalculation.

#5136251 Moving away from the games industry

Posted by alnite on 03 March 2014 - 11:31 PM

I am not in the game industry right now.  I switched around 4 years ago, after working on a failed game startup with crazy long hours.


I do not regret switching away.  However, that does not mean that I hated or gave up game industry completely.  There are moments where I would like to make a game, but it'd be my own game, not someone else's.  So you do not have to give up your passion in games.


Switching away also allows you to see what everyone else has been doing in the enterprisey technology -- what technology, tools, and practices they use.  Gee, DB, enterprise solutions, cloud technology, Big Data, Hadoop.  Even though some people may find them boring, I don't.  It's really up to your personality.


My lifestyle since then has changed a bit.  I play less and less games, because my crowd at work are naturally more diverse.  When I moved away, I realized game industry is a very exclusive community.  They love playing games, they love seeing pretty graphics, and they discuss games.  It's a very adorable community, and I meant that in a good way.  There are also some that are on the extreme side.  Hearing stories that you have to be a serious player of LoL if you work at Riot Games sound ridiculous to me now.  Moving away from it, if anything, actually benefits my perspective of the industry, and I could reapproach it later, if I want to, with a fresh pair of eyes and knowledge.

#5127610 Why it is so hard?

Posted by alnite on 30 January 2014 - 05:44 PM

I am not sure how artists could be hard to find, but to tell you the truth, if I were an artist, I too would be skeptical of these "profit-sharing" projects.


It's much easier to pay things up front.  Profit sharing is what mostly inexperienced developers would promise.  They can't pay, so they promise they would share profit.  Is there even a profit to begin with?  How can you guarantee profit?