Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 01 Feb 2008
Offline Last Active Oct 29 2012 04:02 PM

#4925899 Game Economics

Posted by on 28 March 2012 - 01:01 AM

First of all Im not asking for specific advice about my game. just discussing for all MMOs. how the hell would this work in single player without NPCs?

I'm done with this discussion. Bye.

#4925861 Game Economics

Posted by on 27 March 2012 - 07:40 PM

Some more information about your game would be useful e.g.:

1. Is it single player or multi-player?
2. What is an actual resource. What sources are there and what sinks?
3. Is the value of the currency fixed? Are you modeling it based on something? How does it enter and exit the world?

Anyways, more specific questions would help get the discussion rolling.

#4830213 Moving an object between two points

Posted by on 01 July 2011 - 07:30 PM

if (Player.Location != MoveTo)
	double Angle = Math.Atan2((MoveTo.Y - Player.Y), (MoveTo.X - Player.X)) * 180 / Math.PI;

	double SpeedX = Math.Cos(Angle) * Speed;
	if (Math.Abs(SpeedX) > Math.Abs(MoveTo.X - Player.X))
		Player.X = MoveTo.X;
		Player.X += (float)SpeedX;

	double SpeedY = Math.Sin(Angle) * Speed;
	if (Math.Abs(SpeedY) > Math.Abs(MoveTo.Y - Player.Y))
		Player.Y = MoveTo.Y;
		Player.Y += (float)SpeedY;

Anything in there jump out and say "bad noob!"? ;)

UGH! Are you just trying to do a linear move from a point to a destination at a constant velocity? If so don't use all this trig... it's horribly complicated and error-prone.

Instead you should use parametric equations. Let t = floating point ranging between 0.0 and 1.0.

If t = 0.0 then you are at your starting point. If it is at 1.0 then you're at your destination.

x = (1.0 - t)*start.x + t*dest.x
y = (1.0 - t)*start.y + t*dest.y

Slide t from 0.0 to 1.0 at the desired rate and use the above formulas to calculate your current position. That's all you need. Parametric equations work great in 1, 2, and 3 dimensions.

#4822087 problem with my blackjack game

Posted by on 11 June 2011 - 08:17 AM

that works, but running it, nothing really seems to work as it should

-choosing sit does not cause the player to sit
-choosing n when asking to play again does not close the loop
-it seems like choosing draw causes the game to go to instant check if player won or lost

i keep reading over the code and everything seems to be where it should be, so i don't understand why it doesn't work....

Personally, I wouldn't use a for loop for your inner loop. Instead I would do something like:

int hand_finished = 0;
while (!hand_finished) {
    opp_total += draw();

    // at the bottom of the loop determine if the hand is finished i.e. someone busted or won

Add lots of println statements too and use your debugger so that you can following the flow of the code.

#4822072 problem with my blackjack game

Posted by on 11 June 2011 - 07:49 AM

I think your problem is here:

for(opp_total = 0; opp_total > 17 && opp_total < 21; opp_total = draw())/*opp sits if 

Notice the loop invariant is immediately false (0 > 17 && 0 < 21) and so execution never enters inside your for loop. Thus the statement: opp_total = draw() never executes as well.

#4817627 Reading someone's code

Posted by on 30 May 2011 - 01:35 PM

I kept investigating, placing breakpoints and playing the game, but nothing happened. It seems it was a completely useless class, I commented it all out and no compiler or linker error.

I mean, I don't want to say the code is bad, because I'm a novice and the game works. But dammit...

Actually you made good progress. You figured out that the class wasn't needed. If I was in your shoes at that 'aha' moment I would feel some (perverse) satisfaction. Determining what parts of the code aren't used or are not relevant is equally important to your goal.

#4817427 Reading someone's code

Posted by on 30 May 2011 - 02:09 AM

About what is good documentation and bad documentation... I've never written a big document (like what doxygen generates) but I have never been in a large project before either, so I guess I just have to get used to the way doxygen wants me to document stuff.
Anyways, about comments. In my opinion, when you create a class or function, there is a minimum of comments that it needs:
1. what is this class supposed to do (and what things isn't)
2. who is supposed to call it, and with what kind of parameters (nothing exhaustive)
3. maybe explain how it does it if it takes some unexpected approach to optimize it or something like that

Good documentation (inline code comments) includes why something was written the way it is. I like seeing comments like:
// Don't remove this line because otherwise component X will crash (bugzilla-2152)

Good comments answer what when it isn't apparently obvious. E.g. the comment /* Use Newton-Raphson algorithm */ at the top of the function is all that I need to know and is an excellent comment. Another good comment:
long duration;  // in msec

Bad comments (apart from obviously incorrect information) is how something was written and sometimes the what. For example:
i++;  // increment i [BAD]
myDict[i] = name;  // place name into the dictionary [BAD]

I can determine that by looking at the code directly thanks.

Finally a good comment says the who.
// TODO: fixme [BAD]
// TODO-JS: fixme [GOOD]

With the second comment I know that my colleague John Smith is the one who I should put my hands around his throat... er go talk to.

#4817413 Reading someone's code

Posted by on 30 May 2011 - 01:02 AM

My question: besides reading and debugging and tracing the code in the debugger... what else can I do?

Sometimes documentation can be a bad thing i.e. when it is incorrect. If I were you I would look into some kind of automated tool that could parse the code and show you its static structure preferably in a graphical format. Knowing the class hierarchy, the dependencies, and any tangles from a high level would go a long way in helping you determine what the heck is going on.

#4817407 Debate me about the bible

Posted by on 30 May 2011 - 12:34 AM

So in desperate help, I ask you to prove me false. I ask you to rebuttal each and everyone of these statements. My mind is going crazy these last few nights. The more I think about it rationally, the less I believe.

In my limited time here on this earth, here's my advice...

Why all the fear? Don't be afraid to question the very foundations of your belief systems. Even the things that you may have been taught that if you disbelieve you'll go to hell, be excommunicated, etc... For example if you're Catholic, you'll have to question if Mary was really a virgin, or if that's really Christ in the bread.

These aren't your beliefs, they've been thrust upon you by well-meaning parents, religious authorities, and countless others before you...

Until you can cross that threshold, you'll never know what's beyond. The funny thing is that God (if you believe in him) works in mysterious ways and even after crossing over, it doesn't mean that you need to abandon your faith that you grew up with. Sometimes you just see with new eyes and can now filter the hokey pokey from what really matters.

#4817385 Doubt in VS 2008

Posted by on 29 May 2011 - 11:08 PM

Debug = /DDEBUG at the command-line i.e. the equivalent of #define DEBUG for each C/C++ compilation
Release = /DRELEASE or (merely the lack of /DDEBUG?) ... see above

x86 = 32-bit target
x64 = 64-bit target

The latter two may affect things such as byte-alignment, type-sizes, etc. during compilation.

As for why your program didn't compile it's impossible for us to tell unless we can see the exact error message and corresponding code.

#4787291 Question about me

Posted by on 17 March 2011 - 08:10 PM

MAEnthoven, you have been very helpful and I thank you for your opinions and advice. I will update my resume accordingly. As it turns out, I have a lot more interviews now. I guess it took time
for them to review and screen resumes. Now I have to prepare for the interviews. I thank you again for your help. I owe a lot to this community.

Congrats on your interviews. As long as you're getting them your resume is doing its job.

#4737245 Opinions on Guarding inside Combat Systems

Posted by on 24 November 2010 - 06:46 AM

Original post by AntiGuy
I'm wondering what people think about combat systems that rely heavily on blocking/guarding? Does it feel like a burden? Do you usually just hack away at the opponent with little care about defense? Does it make the game more difficult to control?

The devil is in the details. At the simplest level, blocking might be a decision on whether or not to go one-handed with a shield (sword-and-board) vs two-handed (think polearm or big weapon). After making that choice I don't have to micromanage where I place my shield because the engine takes care of the all the calculations. It's a simple balance of defence vs offence.

Or you can design your game where you need to control your sword arm and your shield arm separately. If balanced correctly then there will be monsters that you must fight with a shield that you would have no chance without and accurate timing is key to winning the fight. Perhaps you might fight a high-damage, low hit point monster that is easier to take out with a two-handed weapon.

The first mechanism works better in MMOs and games where the player controls multiple characters. The second mechanism makes more sense for FPS style games.