Page 1 of 1

Bubble Lava Lamp

Posted: July 24th, 2018, 6:09 am
by MrGodin
Hey folks, I was playing around with some partitioning and spherical physics when all of a sudden this happened. Reminds me of a lava lamp from back in the 70's
Built with VS 2017 on Windows 10
There is a text file called runData in the Solution Explorer you can alter a couple numbers that the app will load in and parse so you just change the text file.
This runs best in release mode.
I found with the data used in runData.txt on my machine gives the best results, yielding about 57 fps.
I know i have alot of work to do with this yet but I found the visuals pleasing
Peace Out

Re: Bubble Lava Lamp

Posted: July 27th, 2018, 2:53 pm
by chili
Sounds like something I need to check out :)

Re: Bubble Lava Lamp

Posted: July 27th, 2018, 6:02 pm
by albinopapa
Why capture by value?

Code: Select all

			m_components.erase(std::remove_if(std::begin(m_components), std::end(m_components),
				[=](const std::unique_ptr<Component>& comp)
			{
				return comp.get() == m_componentArray[getComponentTypeID<Type>()];
			})
				, std::end(m_components));
That means that for each component in m_components, make a copy of the m_componentArray array. Wouldn't it be better to capture by reference?

Code: Select all

			m_components.erase(std::remove_if(
				std::begin(m_components),
				std::end(m_components),
				[=](const std::unique_ptr<Component>& comp)
			{
				return comp.get() == m_componentArray[getComponentTypeID<Type>()];
			})
				, std::end(m_components));
Actually, in this case, you could just get away with capturing the 'this' pointer.

It's in the GameObject::Remove() function btw.

Re: Bubble Lava Lamp

Posted: July 27th, 2018, 6:05 pm
by albinopapa
Though, I suppose if you were to throw in some multithread support, you'd probably want to capture by value on some things, but I'm not so sure this instance would be a candidate.

Re: Bubble Lava Lamp

Posted: July 28th, 2018, 1:07 am
by MrGodin
@ chili, I am no where near your comprehension of coding so don't laugh lol

Re: Bubble Lava Lamp

Posted: July 28th, 2018, 1:38 am
by MrGodin
@albino.. i'm just a fuck around hobby guy, if it works it works .. to a fault i tend to do that lol ;) Peace brother

Re: Bubble Lava Lamp

Posted: July 28th, 2018, 7:56 am
by albinopapa
Coolio, peace.