Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


alnite

Member Since 07 Nov 2002
Offline Last Active Dec 24 2014 05:20 PM

#4960580 Java vs C# - Experts points of view

Posted by alnite on 18 July 2012 - 12:09 PM

Ultimately, Java or C# or C++ do not matter. You really should consider programming languages as musical instruments, and you use them to play your music. Some instruments work better for certain types of music. But just like any other good musicians, a programmer must learn how to play not just one instrument, but several. Depending on what music he wants to play, what mood he wants to convey, he picks up the right instrument and play it like a maestro.

Since you are a beginner, pick one. Java or C# really does not matter. C# has XNA for games. Java, on the other hand, has plenty of 3rd party libraries, but also allows you to make games for Android. Pick your platform (XNA or mobile), then start learning.


#4959779 Save State and Loading Advice

Posted by alnite on 16 July 2012 - 04:18 PM

Use FileOutputStream and DataOutputStream.

try {
    File file = new File("test.bin");
    FileOutputStream fos = new FileOutputStream(file);
    DataOutputStream dos = new DataOutputStream(fos);
    try {
	    dos.writeInt(100);
	    dos.writeByte(20);
	    dos.writeUTF("Hello World");
    } finally {
	    dos.close();
    }
} catch (IOException e) {
    System.out.println("Exception thrown.");
}

Output:

00 00 00 64 14 00 0b 48 65 6c 6c 6f 20 57 6f 72 6c 64										



#4959227 game programming as a viable career?

Posted by alnite on 15 July 2012 - 04:11 AM

1. Is game development a viable career? I have heard from articles (most rather old) that game development careers are pretty terrible working conditions in some big companies -- is this true for most? I understand that there will be crunch times in certain parts of the development cycle, but is 70-80 hours weeks typical at many studios? etc. I have also heard from a friend who has done some internships and other jobs in game development that it is reasonable.


I'm not sure if it's typical, but I've been there before (working roughly 10-12 hours per day, 7 days a week). It's not on paper that you are going to be working 80 hours a week (that's illegal), but I think the company expects you to be available whenever required.

2. (sort of going on the last question) is it a longterm career?


Depends on you. Your life will change over the course of your life. You will form different opinions. It may seem to be an attractive choice for your career now, but your opinion might change down the road. Some people stay, some others left (like me).


3. I understand that the starting salary is below average for a programming job, but I have read somewhere that the salaries for more experienced/senior developers is on par with comparable developers in other programming industries. Is this true?



You can research about salaries at various companies at glassdoor.com.

For example: Senior Software Engineer at EA is averaged at $122K
while at Google, Senior Software Engineer is averaged at $140K

4. Would you recommend I get a masters to try to get a better chance at getting accepted (understanding that it's not a purely game development masters, but a digital media which includes some game development in it -- which could be good or bad depending on how you look at it), or would that be overkill?


I don't know what the general opinion is now, but higher education tend to be looked down upon in the game industry. That's because higher degree means less real-life experience, and more out-of-touch you are with the difficulties and tenacity required to make games. Games aren't made with just ideas and theories, and certainly aren't made by people who can only boast and talk about their degrees. In any projects I have been involved in so far, games by far are the most difficult to carry. Having the experience of completed a game under your belt carries a lot more weight than a master in your title, even though that title says "digital media".

I'm not saying you shouldn't get a master. Like frob was saying, if you want to get a master degree, get it because you want to, not because you want to impress companies, and I'd suggest to get a more traditional title like master in computer science or software engineering, rather than digital media.

As long as you've got solid programming skills and experience, you will get hired no matter what your degree is.


#4959219 C++ As First Language

Posted by alnite on 15 July 2012 - 03:21 AM

..if you never programmed before then games aren't the first thing you should focus on in the first place.


Sorry, I disagree here. Games is exactly why I learned programming. It was my focus 20 years ago, and it still is my focus today. Don't underestimate passion.


#4957649 OOP design question

Posted by alnite on 10 July 2012 - 10:42 AM

My guidelines is if it's a private method and always works on the same variables, then it's method A. Otherwise, it's method B.

In most cases, I initially used method A, and as the code grows, I would refactor that to method B when the need arises. So don't think that you are stuck with one, you can always refactor them.


#4953181 Observer pattern question

Posted by alnite on 26 June 2012 - 05:46 PM


class Event

{

}



class FireEvent : public Event

{

	// bla bla bla

}



class IEventObserver

{

    public void OnEventTriggered(Event e);

}



class FireEventObserver : public IEventObserver

{

	public void OnEventTriggered(Event e)

	{

		if (e is FireEvent)

		{

			// do something

		}

	}

}




#4950669 Random number problem!

Posted by alnite on 19 June 2012 - 12:52 PM

Posted Image


#4950388 Structure of classes in good Game Engine?

Posted by alnite on 18 June 2012 - 03:28 PM

Keep in mind that your logging system probably doesn't need to be a class at all. Consider using a simple free function instead, possibly in a namespace.


This.

If you still decide it needs to be a class, ask yourself: does it need to be instantiated? What benefit do I get for having two or more instances of logger class? If there's none, then you don't need a class.


#4940570 Game Engine from Scratch...Why?

Posted by alnite on 15 May 2012 - 09:19 PM

I think a lot of people are confused about the differences of building a game vs a game engine. The goal has to be clearly defined before you start the project, and unfortunately, you can't do both unless you are armed with 10 full time developers.

When you are building a game engine, your goal is to create your engine as dynamic and extensible as possible. You really have to put a lot of thoughts in the design of your code, the relationships of your classes, the extensibility and customization, and the GUI of your app. It is not a trivial task. You have to know the most efficient ways of solving game development problems, like pathfinding and collision detections. Otherwise, your engine isn't even worth using, and nobody is going to use your engine other than yourself. During the course of the development, you will be making small games to demonstrate and test your game engines. You should be a seasoned game developer to qualify for this task -- only then you can ask yourself "is it worth it to build a new game engine?"

On the other hand, when you are building a game, your focus should be just building a good game. Many people thought that you have to build an engine first before you build game. That's false. Even if you build your game from scratch, like setting up a window, DirectX, and all that, your setup must be just good enough for your game and your game only. Don't worry about adding that high dynamic range effect if your game does not need it. Focus on building a good game.


#4939911 New to Game Programming, Sub: Creating RPG Skills

Posted by alnite on 13 May 2012 - 04:40 PM

I'd do it this way, so I can have an array of ISkill in the Actor class, and just iterates through it every frame calling applySkill(this);


Getting a little lost again, probably due to my limited c++ experience. Are you talking about an array which holds each skill known by the actor?


Sorry for the confusion. We were talking about status effects. So a character may have a couple of those at a given time (e.g. poisoned, diseased, and haste). Each character then will have a list of the currently active status effects, and you would need to iterate through this list once every frame to 'update' the effect.

std::vector<ISkill*> status_effects;
for (ISkill* s : status_effects) {
    s->applySkill(this);
}




#4939434 New to Game Programming, Sub: Creating RPG Skills

Posted by alnite on 11 May 2012 - 04:19 PM

Am I correct in thinking that things like status effects etc. wouldn't need to be included in the main ISkill inheritence tree?


You can. It's up to you how to design it. You can create a new class StatusEffect that implements ISkill, and this class will have common attributes for status effects like duration, damage +/-, and so on. Then if there's a special status effect that requires extra code, it can inherit from the main StatusEffect class, and add extra code as necessary.

I'd do it this way, so I can have an array of ISkill in the Actor class, and just iterates through it every frame calling applySkill(this);

You could just call applyEffect(Poison) within applySkill of any specific skill, right?


Yes, that's up to your implementation details.


#4939362 New to Game Programming, Sub: Creating RPG Skills

Posted by alnite on 11 May 2012 - 12:41 PM

I'm not entirely sure that I follow, sorry. It looks like your Fireball sub-class will only be able to execute a single ability, "Fireball". I understand that instead of having individual stats for each Skill, you could just use the specific numbers you need in each of those applySkill methods (which mean yeah, I don't need most of those stats),


Yes, each one of those method will execute a single ability.

but this loops back to the problem I had in the first place - I don't necessarily want to hard code 60 skill classes this way.


If you really want to make it that dynamic, then you need to implement a scripting system powerful enough to cover all types of skills, and that's probably several more months of development time. And TBH, you don't gain that much benefit unless you allow MODs to your game.

Each skill, eventually, is going to have to be unique and hardcoded to a certain extent. It's going to have its own graphics, its own projectiles, and its own behavior (summoning skills that create new units? skils that lasts over time? AoE effect? global effect? skills that spawn more skills? A couple of booleans and ints aren't going to be able to encapsulate all that, so you might as well code them all individually.

If you are smart in organizing your skill libraries, you don't have to code 60 skills separately. See below:

From what I do understand though, your way of creating skills seems to be way more open, which sounds really great. I'm just not sure how you'd be able to keep that openness without making a different class for every single skill.

Again, sorry if I'm missing your point here. I'd appreciate it if you could clarify things for me.


You don't have to, thanks to inheritance.

class FireBasedSkill : public ISkill {
public:
	virtual void applySkill(Actor& actor) {
		// apply fire-based damage to actor
	}
};

class Fireball : public FireBasedSkill {
	virtual void applySkill(Actor& actor) {
		FireBasedSkill::applySkill(actor);
		// apply fireball-specific code here
	}
}

class UberFireball : public Fireball {
	virtual void applySkill(Actor& actor) {
		Fireball::applySkill(actor);
		// more damage!!! burns the target for 100 seconds, etc. etc. etc.
	}
}



#4939172 New to Game Programming, Sub: Creating RPG Skills

Posted by alnite on 10 May 2012 - 06:33 PM

You don't want to have that AssignDamage method. As the number of skills grow, so is the size of that method.

Skill should be an interface, and it defines nothing (no attributes, damage, type, element, etc.). Here's an overview:

class ISkill {
public:
    virtual void applySkill(Actor& actor) = 0;
    virtual std::string getDescription() = 0;
};

class Fireball : public ISkill {
public:
    virtual void applySkill(Actor& actor) {
	    // do fireball damage here to actor
    }
};


By defining Skill as an interface without attributes, first, you are opening your skill libraries virtually limitless. You are not stuck to elemental skills, but also different types of skills, perhaps a specific swords slashes or pickpocket. Second, you won't have a large method body with different switch-case statements for different types of skills, as each skill is responsible in writing its own method to apply the effect to an actor. Third, you can use this interface as active skills (actor to actor), passive skills (actor to self), or status ailments (overtime buffs or debuffs).


#4928581 rename variables in release mode (like C++ #define)

Posted by alnite on 05 April 2012 - 01:57 PM

You need an obfuscator.

Here's what Google says about it.


#4928577 Best approach to loading and saving game data?

Posted by alnite on 05 April 2012 - 01:35 PM

I've been doing some research on ways to read and write data but don't know which is the best way to go about it.


It depends on the game and what you want to save. There's no one universal saved game format.

As for the writing data how do I go about saving? I went and looked through other game's save files. Why are some not in plain text? I assume they're encrypted or need to be opened with an appropriate editor.


Reasons why games are not in saved in plain text to prevent cheating, and save bytes (binary format generally takes up less space in disks than text). If saved games are human-readable, then it makes it very easy for anyone to modify it. You can, for example, change your character stats all to 100 if you present them right there in plain text format. You can still do it even in binary, but at least it'd deter enough people.

For loading from a file, I could create some values in a text file and have it read to the game but what if I wanted to add descriptions or commentary to the file so I know what values are which and not have it read by the game? I thought about using Regular Expressions to cut out the stuff I don't need when the game is reading but is that doing more than I really need to? I'm just throwing ideas around and hoping to get some feedback.


Ideally, you want to be able to save in both text format and binary format. During development, you save it in text-based format (your own, XML, JSON, whatever), and you can put all the comments you want. When you are ready to release, you switch it to binary, removing all the unnecessary comments.




PARTNERS