Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

Tudor Nita

Member Since 09 Mar 2012
Offline Last Active Dec 13 2012 05:25 PM

Posts I've Made

In Topic: c++ file reading

20 August 2012 - 05:55 AM

Just personal preference I guess. It's a bit verbose for my liking and enforces type safety at compile time. This nags at me a bit too: http://stackoverflow...answer-5165293

Seeing how I'm really used to the fgets way, this is all, of course, highly subjective. Still, it's a valid alternative.

In Topic: What are the downsides to using Unity?

20 August 2012 - 05:45 AM

Unity's fbx import will convert it, but have non zero values in the rotation fields, with no way to set the default rotation to identity (0,0,0).

Especially when writing scripts to instantiate objects

I'll have to agree on that. Was thinking from a manual import POV. However I remember you can get a 0,0,0 rotation if you pre-rotate the object/ pivot in 3DS Max before exporting. Will have to check this out again as my memory is not to be trusted.

In Topic: c++ file reading

20 August 2012 - 05:38 AM

I wouldn't use iostream. Something like this works for me. Imagine an input file like:

# a comment
a 3.5 3.5 yay_some_text
a 3.2 4.5 yay_some_more_text

[source lang="java"]FILE *pFile = fopen(filePath, "r"); // the file to loadchar buffer[512]; // character bufferchar temp;// read each line into the bufferwhile (fgets(buffer, sizeof(buffer), pFile)){ // switch based on leading type switch (buffer[0]) { case '#': // do nothing, it's a comment [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] break; case 'a': // set ambient color ? sscanf(buffer, "%c %f %f %s", &temp, &someFloat, &someOtherFloat, &aString); break; }}[/source]

In Topic: Pong

20 August 2012 - 05:28 AM

"stupid long mathematical equation"

That doesn't sound good regardless of how much I spin it around in my head.

Anyway, you could just go with some simple conditional statements and inverse the direction of the ball. If you want something more complex you'd have to do some vector maths with at least the ball's direction vector, the paddle's forward vector and the position the ball hit the paddle.

[source lang="cpp"] // edge of playing field if (pong.ball.centre_y > 0.6f) { pong.ball_velocity_y = -ball_speed; } else if (pong.ball.centre_y < -0.6f) { pong.ball_velocity_y = ball_speed; } // ball hit a paddle on the right side if (pong.ball_velocity_x > 0 && collides(&pong.ball, &pong.bats[1]) ) { pong.ball_velocity_x = -pong.ball_velocity_x; } // ball hit a paddle on the left side if (pong.ball_velocity_x < 0 && collides(&pong.ball, &pong.bats[0]) ) { pong.ball_velocity_x = -pong.ball_velocity_x; }[/source]

In Topic: What are the downsides to using Unity?

20 August 2012 - 05:16 AM

As a long-time user of Unity:

  • Although it's amongst the best in asset management, the module does have its quirks and can ruin your day if you're not careful.
  • Hard to "patch" asset/ scene files since they are binary (see 500mb comment above ). [They are switching to a text-based scene format so this will change very soon ]
  • Some web-game developers complain about users leaving the game page once they see the Unity logo [ which in the free version has to be there ]. This is a side-effect of so many people having access to the free version and so much shovelware being developed. I have my doubts about it.
  • Jack of all trades dilemma. It does everything but doesn't really shine in any particular category. It's not exactly a downside but surely not an upside either.
  • Really bad GUI implementation. The inbuilt GUI system is a performance drain at best. [ This is bound to change with ver. 4.x ]
  • Binary SDK. As a c++ enthusiast, source code access would make my day.
  • Extremely easy-to-use. I love UDK, Corona, Cocos2D and even ShiVa but they just aren't in the same ballpark when it comes to ease-of-use.
  • Awesome cross-platform support. [ with 4.0 ] Linux, Web ( plugin and flash), Windows, Mac, iOS and android. And all of them free [ basic versions anyway ].
  • Well documented scripting. Some of the best documentation this side of a complex engine.
  • Decent to great performance on mobile devices. Couple of tricks to make it run great but it eventually gives.
  • Great community. They've got their trolls and whiners but overall the community is great.
  • Asset management. Both a blessing and a curse.
[ Daaark ] Getting the correct orientation is not a bug nor an inconvenience. It's just the coord. system they use ( common y-up system ). The problem lies rather with the authoring tools [ z-up for 3ds max for example :| ]. Nothing some decent planning won't take care of.