Jump to content

  • Log In with Google      Sign In   
  • Create Account

mic_k

Member Since 24 Oct 2012
Offline Last Active Dec 05 2015 01:04 AM

Topics I've Started

Put game data to files or using database tool

22 November 2015 - 08:59 PM

Hi,

I'm finishing a small game prototype with c++,

now still considering about game data for character attributes, levels/stages info, and saving game progress.

 

Currently for character attributes (like health, damage, size(width & height), weapon, shieldpower.. etc),

i put it directly harcoded in character class. Example:

class Foe1

{

   public:

      Foe1();

      void Moving();

      void Attack();

 

   private:

      int Size_W = 50;

      int Size_H = 80;

      int Max_Health = 200;

      int Max_ShieldPower = 100;

      int DamagePower = 50;

      string WeaponType = "TypeA05";

}

also with Foe2, Foe3... have same attributes, but with different value.

 

For levels/stages info, i put into separate files (in xml),

so everytime to begin new level i will load the level attribute/info from my level01_data.xml, level02_data.xml... file.

 

My question:

** Is this ok to put all those harcoded attribute at class? 

   ..or should i put the attribute value in separate data file, then load it when everytime creating a Foe instance?

 

** To save data in separate file, for char.attributes or game progress,

i'm considering to save those into encrypted files or using (maybe)a light-weight database tools.

Which method is probably better?  (considering the balance of "runtime loading process" and "data management issue" )

 

 

This far my program run ok and smooth,

but somehow i feel my codes are bit crowded biggrin.png

To do modification at next month or 2 months again, i'm affraid to fix certain things may not simple.

 

Any opinions & suggestion are welcome, thank you..

 


Sequence animation by codes or using .gif image

14 May 2015 - 10:45 PM

Hi,

I'm working on 2D air shooting (using c++), idea is something like 1943 or Gradius.

Basically, player moving around up, down, left & right, shoot bullets to enemy, and enemy shoot too.
It works find, and now i'm in modif & fix-up things.

The ship movement animate some sprites, following the direction button hit by player.
If moving up, then i animate the up-movement sprites,
about 4 images within some(1 or 1.5) seconds, as long the player hold the up-button.
Same on with moving left, i play the left-movement sprites,
also the behavior for moving right & down.

And now i have this in mind:
1. I will stick to play animation sequence using program(codes) everytime player push the button.
Or,
2. Should i change, by prepare 4 images(up, down, left, right) in gif format,
which is each image already play their own frame sequence as i setup from image designer tool

(not to play the sequence by codes)

I'm thinking about:
- Memory consumption when game is running, overall, regarding player's directional movement.
- Game modification (if someday i need to change/add the sprites, sequences, etc... related to efficiency or practically)

Does anybody have opinion ? 

smile.png Thanks.


C++ Function Parameter

31 October 2012 - 12:11 AM

hi,
i'm currently in practice with c++, i found a situation(not critical).

as i read from tutorial & article, it said that good thing in passing argument by reference, but not to change the value inside the function, is to use the constant-references as the function parameter.

in situation that i just want to pass the argument to a function just for resource only, not to change the value itself,
1. so when is the right time to use the by-value parameter ?
or
2. when is the time not to use the constant-references parameter ?

may anyone have suggestion..

thank you,
happy coding Posted Image

PARTNERS