Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


alnite

Member Since 07 Nov 2002
Offline Last Active Apr 20 2015 06:27 PM

#5223256 Write ToLower As Efficient, Portable As Possible

Posted by alnite on 14 April 2015 - 05:14 PM

"Portable" and "Efficient" is almost a polar opposite of each other.

 

Efficiency makes certain assumptions and/or optimizations based on current architecture/environment/encoding (e.g. ASCII only).

Portable means that it must be usable in as many architectures and environments as possible.




#5221739 are non sql databases better than sql databases?

Posted by alnite on 06 April 2015 - 06:44 PM

A few corrections to your misunderstanding here:

 

The reason why Redis is fast is not because it's a NoSQL Database, it's because it's an in-memory database.  If someone implemented an in-memory, scalable SQL database, it will be fast too.

 

NoSQL does not have to be a KV-driven, or document-based database as people have started to commonly refer this as.  There's also a graph database (e.g Neo4j).  It's a bucket term for any kind of database that are not using relational tables to store its data.

 

 

What is the difference between redis and C# dictionary?  Redis is a cluster of computers all dedicated to store your data in-memory, while C# dictionary only persist your data locally in one node.  If you are running your code in multiple server nodes, you can start seeing a problem where some data might exist in one node, but a request tried to retrieve it from another node.  That's what Redis is solving that it makes sure your data is available across the network.

 

You can put XML on redis since it isn't trying to format your data in anyway.  Set the key to your document to any string, and the value to be your XML.




#5221718 Two Questions - Willing to Trade experience on Tools and Business Side, for M...

Posted by alnite on 06 April 2015 - 04:57 PM

The best way to learn is just do it.  It seems you have done your own research in what language and platform you want to use.  Most beginners are still confused in that state.

 

People here can talk in length of best practices, for loops, OOP designs, etc, but without the context and experience, you won't understand why best practices are best practices.  So my advice is just get your feet wet and build something.




#5215352 Unity 5 or Unreal engine 4

Posted by alnite on 08 March 2015 - 09:54 PM

Is this going to be the new "vs" question now?  No more DirectX vs. OpenGL? :D




#5215016 Employee appraisal

Posted by alnite on 06 March 2015 - 02:39 PM

You have been with the company for a year.  That's usually more than enough for anyone to see how you work, and what you have been told is your boss' perception of your work.  He's in charge, and he's clearly not super happy with your work.  He wants you to improve, and he gives you time.  It's a good thing that he told you this upfront.  Some people will let it sit for a long time until you suddenly get the pink slip without warning whatsoever.

 

Here's the thing of being an engineer.  You need to figure things out yourself.  That's what makes a good engineer, when they solve problems.  Engineering problems are not math problems.  There is not one answer, but many.  The way I see it, engineering problems are the opposite of math problems.  A typical math problem asks you "what's the result of 1+1", an engineering problems is "I have 10 and 3.  What should I do to get 2?"

 

You need to figure out what you need to do, instead of asking people what you need to do.  If you are stuck, research things yourself, figure things out yourself.  This is part of the reason why tech forums don't want to solve people's homeworks.  Don't let the senior engineers solve problems for you.




#5214001 Drawing a city in 3D

Posted by alnite on 02 March 2015 - 01:35 PM

How much do you know about 3d modeling?  The bulk of this work will be modeling each individual houses, and putting textures on them.   5000 is quite a lot.  You could also go by creating a generic looking house that fits the architecture at that time, and apply that to all or majority of the houses, but it will not look very convincing.




#5213510 Confusion with insides of 2D games

Posted by alnite on 28 February 2015 - 11:30 AM

Sometimes people like to make things sound more complex than it actually is.  I never knew what a scene graph is when I first made my own video game.

 

Video game programming, in a nutshel, is really just handling logic for each object you have in the game, and draw them to the screen in the order you want them to be drawn.  At its simplest form:

for (int i = 0; i < gameObjects.length; ++i) {
    // handle logic for gameObjects[i]
}

for (int i = 0; i < gameObjects.length; ++i) {
    // draw gameObjects[i]
}

Done.  That's your game loop.  The only thing important is to separate the logic code and drawing code, and that's why I wrote two separate loops.

 

Then games become complicated, scrolling map, parallax scrolling, 3D, particle systems, objects attached to other objects and so on.  Some objects drawn completely, some others partially on the screen, and some others are completely out of the screen.  So people start handling these game objects into a complex tree structure which they call a scene graph.  You do not need a scene graph structure to make a game.  However, once your game start getting more complicated, and you have had solid programming background, you would naturally solve that complexity with a scene graph anyway.




#5211624 Creating a server for a mobile game and matchmaking with facebook

Posted by alnite on 19 February 2015 - 01:45 AM

The common wisdom says that if you want an online capable game, you have to write it with online capability from the beginning.  It seems that you have been writing your game in single player architecture, so it's likely that you will have to rewrite it to add the online part.  But, it depends on the game and the complexity of what you are after.




#5210819 Exclusive maximum in random functions

Posted by alnite on 15 February 2015 - 08:16 AM


Stated differently, I *am* designing for general use, and I get the feel that exclusive maximum is a weirdness designed for indexing arrays, a very specific problem.

 

The physical 6-sided dice we have been using starts at 1, but it may just as well starts at 0 and ends at 5.  What if I have a die that uses icons: Sunny, Cloudy, Rainy, Thunderstorm, Foggy, and Snow?  I should be able to call Random(6), to indicate that I have 6 elements to choose from. Regardless of where I start from, 0 or 1 or 13 or 10417, I still must be able to map this result that:

startingPosition + Random(6)

Should give me the correct result.

 

Now, instead of an interval, what if I have an offset and length.  Give me 10 results starting from result #102.  My notation is therefore [102, 102+10), rather than [102, 102+10-1].




#5210589 Very basic 2D RPG game

Posted by alnite on 13 February 2015 - 09:30 PM

A basic 2D RPG like what you mentioned has these things:

 

1. Animation

2. Map/tiling/scrolling

3. Input to move the characters

4. Moving from one map to another (visiting a house takes you to another map of the inside of the house)

5. Understand the concept of layers.  You need to render the tiles, houses, trees, characters, character bubbles, how they overlap, which gets drawn first, etc.

 

I suggest you tackle this one at a time.  First, learn how animation works.  Given a sprite sheet, how do you animate the characters.

Then learn about tiling maps, scrolling maps, and how do you position objects in the map and make sure they stay at where they are supposed to be when you scroll.

 

So you just build up your skill there.




#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()) {
    playerShip.createBullet();
}

if (enemyTrigger.shoot()) {
    enemyShip.createBullet();
}



#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;





PARTNERS