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!


Member Since 13 Jun 2001
Offline Last Active Today, 04:26 AM

#5195254 Particle Systems & Handling Transparency

Posted by Madhed on 28 November 2014 - 03:58 PM


(it is possible to draw additive and alpha blended particles in a single draw call).


How do you do that? (I'm an OpenGL beginner)



I suppose with the blend function: Dest * (1 - SrcAlpha) + Src


Aka premultiplied-alpha.


If SrcAlpha is 0, it simply reduces to additive blending.

If SrcAlpha is between 0 and 1 you can achieve alpha blending but you have to premultiply your textures by the alpha value first.


This also allows you to seamlessly blend from explosion to smoke and other cool effects.

#5193245 The left-hand side of an assignment must be a variable

Posted by Madhed on 17 November 2014 - 07:48 AM


How does this even let you do this?

class Foo
   Foo yolo;


It's Java. yolo is a reference. You are probably thinking in c++ terms... tongue.png

#5192939 Proper C++ header file?

Posted by Madhed on 14 November 2014 - 08:32 PM


Where is the compiler output?


Hmm...? I'm compiling with g++ from the terminal command line. The only thing being output to the terminal that isn't posted here is the command I used to compile.


g++ -c TileMap.cpp



Ah, now it's there. It wasn't when I posted.

#5192550 Live filesystem changes

Posted by Madhed on 12 November 2014 - 06:36 PM

Really, go for a version control system.

I you want to go open source you can use github.

Alternatively check out Assembla. https://www.assembla.com/home

1 Project with up to 1GB of storage is free there.

#5188647 O(pow(N,12))

Posted by Madhed on 22 October 2014 - 06:43 PM

This somehow reminds me of the lugaru source code that was posted here a while ago.

#5188643 O(pow(N,12))

Posted by Madhed on 22 October 2014 - 06:23 PM


#5188641 Is optimization for performance bad or is optimizating too early bad?

Posted by Madhed on 22 October 2014 - 06:21 PM

Optimizing is bad if your "sub optimal" code is actually running perfectly fine on the target system and you have more important things to do.

Optimizing code that you haven't tested is bad because you are most probably fishing in the dark.

#5188640 C++ header inclusion question

Posted by Madhed on 22 October 2014 - 06:16 PM

I think #2 should actually read: "Only include headers in headers if you can't get away with forward declarations"

#5187648 How to remove GET variables from URL in php

Posted by Madhed on 17 October 2014 - 08:50 AM

That's the whole point of GET. The parameters are added to the url.

Either I didn't understand the problem correctly or what you are trying to do is impossible.

#5187214 What's best (Custructor Arguments)

Posted by Madhed on 15 October 2014 - 01:28 PM

If your constructor takes too many arguments, well... make it two classes or more. biggrin.png

Could be a sign that your class tries to do too much.

#5187037 How to Separate the Rendering Code from the Game Code

Posted by Madhed on 14 October 2014 - 04:29 PM

The main selling point of ECS is code reuse and separation of concerns. By breaking up your typical classes into small self-contained components you can easily build more complex behaviours by combining them.

Cache coherency is a nice side effect that *can* occur if you design your systems right.


As for the mostly empty list, you could simply sort your objects so that unused ones get appended to the end of the list. Then you can trivially stop iterating once you hit the first unused element.

#5186053 safely researching PC games

Posted by Madhed on 09 October 2014 - 02:07 PM


#5184541 passing data between objects using messages... wat do?

Posted by Madhed on 02 October 2014 - 05:17 AM

It sounds like you are trying to implement a completely dynamic system without any explicit dependencies. While this is possible it completely circumvents c++'s type system with respect to classes.

Also it is arguably far worse to have dependencies implicitly encoded within your code rather than explicitly enforced at compile time.


Reality is, there will always be dependencies. No object is an island.

There exist different design patterns to deal with these dependencies. The mediator pattern is the first than comes to mind.


As for circular dependencies, if you write your headers the right way (inclusion guards, forward declarations) and design your game right you won't have problems here.


Sounds to me like a case of premature optimization.

#5184439 passing data between objects using messages... wat do?

Posted by Madhed on 01 October 2014 - 05:31 PM

Why not simply store a reference to the Time object in the Mario object when you create it?

Mario is apparently dependent on Time so I see no reason why this should be done with messages.

#5184163 This chat, apparently, is a gigantic coding horror

Posted by Madhed on 30 September 2014 - 04:31 PM

It's especially funny since javascript already has a built in function called encodeURIComponent which replaces certain characters with their respective safe counterparts.