Jump to content

  • Log In with Google      Sign In   
  • Create Account

Waterlimon

Member Since 28 May 2011
Offline Last Active Sep 27 2016 02:20 PM

#5277803 Manufacturing chain for paper

Posted by on 23 February 2016 - 05:12 PM

Toilet paper?




#5277008 New Studio Name, Thoughts?

Posted by on 19 February 2016 - 12:56 PM

 

 

Good Bishop Studios

 

Bad Bishop Studios

 

King's Bishop Studios

 

Queen's Bishop Studios

 

Indian Bishop Studios

 

Bishop Pair Studios

 

 

Pfft

 

C5XfN2C.png

 

I demand 75% revenue share




#5276017 Victory conditions for a 4X

Posted by on 16 February 2016 - 03:28 PM

It might feel better if you have to complete those achievements within limited time (it can be a long time, but still a clear limit)

 

Perhaps, you also need to survive until that limit, even after completing the necessary achievements.

 

So you have to do some time management as well. Maybe you can get all the achievements by going all in, but expend too much resources doing it and fall before the time limit. Or maybe you want to play it safe and leave a difficult achievement toward the end (eg build something big which requires selling most of your army), but something unexpected slows you down and you lose.




#5270205 none issue when near plane = 0.01, is it just matter of time when I see artif...

Posted by on 08 January 2016 - 09:19 PM

The value of near plane is irrelevant on its own - what matters is the relative magnitude of the near and far plane to each other.

 

Set far plane as low as you can without issues. Then near plane as high as you can without issues.

 

If theres no issues, everything is fine.

 

If there still is issues, you need to do something else in addition to simple depth testing to deal with the cases where it isnt working (like doing multiple passes for different depth ranges to increase precision withing each range, or depth biasing like you have).




#5268915 Fun Challenge: Implement Polymorphic Callback

Posted by on 02 January 2016 - 08:11 PM


You are relying on vendor specific behaviour.
Calling conventions are up to the compiler and platform. So calling the member function as a free function with an implicit this argument might fail.
 
But as long as it works...
It's the same trick that the FastDelegate library uses. Only it has compile switches for a dozen compilers or so.

 

I dont specify the calling convention (I never convert the member function pointer to something else and only call it knowing both the class type and member func ptr type)

 

AFAIK the only requirement is that the member function pointer is compile time constant (as its used as template argument to 'wrap' it into normal nonmember function). Shouldnt compile otherwise...

 

Im not sure if the above assumption is true for something like virtual methods (it COULD be?). But yeah I dont feel confident using it for anything else than regular member functions which I can assume are known at compile time (better be, for my performances sake)




#5268874 Contrevertial Simulator Idea - Feedback Needed

Posted by on 02 January 2016 - 02:30 PM

You could also implement it so that the player is not the leader, but the very idea itself.

 

So it doesnt matter if groups of people claiming to be the cult all die, as long as the idea survives (if your idea bans internet, it might make your cults more resistant to its members becoming sane, but it might not spread so well, etc)

 

Ofc it could be interesting if you can directly control the leaders or whatever (maybe the idea is so ingrained in them, you have direct control)




#5268726 Raytracer is not working

Posted by on 01 January 2016 - 01:32 PM

try adding a minus sign somewhere...?

 

 

try track some rays in debugger through sphere test to see why they dont hit, maybe you will find bug




#5268725 Fun Challenge: Implement Polymorphic Callback

Posted by on 01 January 2016 - 01:29 PM

I made this when I realized C++ is lacking in that department

//Supports nonmember and member functions, lambdas (captured parameters are not stored!)
		template<typename ReturnT, typename... ParamT>
		class CallbackBase
		{
			//Member func as free function
			using MFuncT = ReturnT(*)(void*, ParamT...);
			//free function
			using FuncT = ReturnT(*)(ParamT...);
		public:
			CallbackBase()
			{ 
				reset();
			}
			template<typename ClassT, ReturnT(ClassT::*memberFunc)(ParamT...)>
			void connectMemberFunction(ClassT* object)
			{
				mObject = object;
				mMemberFunction = &memberFunctionPtrAsFreeFunction < ClassT, decltype(memberFunc), memberFunc, ParamT... > ;
			}
			template<typename LambdaT>
			//NOTE: Callback lifetime must not exceed that of lambda if variables are captured! Use connectFunction if lambda is noncapturing
			void connectLambda(LambdaT& lambda)
			{
				mObject = &lambda;
				mMemberFunction = &memberFunctionPtrAsFreeFunction < LambdaT, decltype(&LambdaT::operator()), &LambdaT::operator(), ParamT... > ;
			}
			void connectFunction(ReturnT(*func)(ParamT...))
			{
				mObject = nullptr;
				mFunction = func;
			}
			void reset()
			{
				mObject = nullptr;
				mFunction = nullptr;
			}
			//false for normal function, true for member function / lambda
			bool hasContext() const
			{
				return mObject != nullptr;
			}
			bool connected() const
			{
				return mFunction != nullptr;
			}
		protected:
			template<typename ClassT, typename MemberFuncT, MemberFuncT memberFunc, typename... SuppliedParamT>
			static ReturnT memberFunctionPtrAsFreeFunction(void* object, SuppliedParamT... params)
			{
				return (static_cast<ClassT*>(object)->*memberFunc)(params...);
			}
			void* mObject = nullptr;
			union
			{
				MFuncT mMemberFunction;
				FuncT mFunction;
			};
		};








		template<typename>
		class Callback;
		template<typename... ParamT>
		//Supports nonmember and member functions, lambdas (captured parameters are not stored!) [void return type]
		class Callback<void(ParamT...)> : public CallbackBase < void, ParamT... >
		{
			using CallbackT = Callback<void(ParamT...)>;
		public:
			void connectToStub()
			{
				connectFunction(&stub);
			}
			template<typename... SuppliedParamT>
			void operator()(SuppliedParamT&&... params)
			{
				assert(mFunction != nullptr);
				//Member function or lambda
				if (mObject != nullptr)
				{
					(*mMemberFunction)(mObject, std::forward<SuppliedParamT>(params)...);
				}
				//Nonmember function
				else
				{
					(*mFunction)(std::forward<SuppliedParamT>(params)...);
				}
			}
			explicit operator bool() const { return connected(); }
			bool operator==(const CallbackT& other) const { return mFunction == other.mFunction && mObject == other.mObject; }
			bool operator!=(const CallbackT& other) const { return !((*this) != other); }
		private:
			static void stub(ParamT...)
			{
			}
		};








		template<typename ReturnT, typename... ParamT>
		//Supports nonmember and member functions, lambdas (captured parameters are not stored!) [nonvoid return type]
		class Callback<ReturnT(ParamT...)> : public CallbackBase < ReturnT, ParamT... >
		{
			using CallbackT = Callback<ReturnT(ParamT...)>;
		public:
			template<ReturnT defaultValue = ReturnT()>
			void connectToStub()
			{
				connectFunction(&stub<defaultValue>);
			}
			template<typename... SuppliedParamT>
			ReturnT operator()(SuppliedParamT&&... params)
			{
				assert(mFunction != nullptr);
				//Member function or lambda
				if (mObject != nullptr)
				{
					return std::move((*mMemberFunction)(mObject, std::forward<SuppliedParamT>(params)...));
				}
				//Nonmember function
				else
				{
					return std::move((*mFunction)(std::forward<SuppliedParamT>(params)...));
				}
			}
			explicit operator bool() const { return connected(); }
			bool operator==(const CallbackT& other) const { return mFunction == other.mFunction && mObject == other.mObject; }
			bool operator!=(const CallbackT& other) const { return !((*this) == other); }
		private:
			template<ReturnT defaultValue>
			static ReturnT stub(ParamT...)
			{
				return defaultValue;
			}
		};

Its just a pointer to a function and a pointer to an object (which is null if its free function). Ive only done primitive testing on it so it might be breaking some rule somewhere, but maybe you get ideas.




#5268663 Isolating groups on a board

Posted by on 31 December 2015 - 07:29 PM

You will probably want to

1) find unassigned cell (linear search will work if this isnt a bottleneck - maybe do each search from where previous left off to not search same stuff every time)

2) flood fill from that cell until you find all cells in the connected group of cells (while forming the group which could be by assigning the group ID to each cell, or adding each cell to some group objects list of cells)

3) repeat




#5268385 Raytracer is not working

Posted by on 29 December 2015 - 03:06 PM

What kind of vectors does the raycasting function produce (just grab some random examples)?

 

Does it produce something close to (0,0,-1)?

 

Maybe the sphere intersection only works when it passes directly through (assuming the rays themselves are not complete garbage)




#5268379 Raytracer is not working

Posted by on 29 December 2015 - 02:51 PM

If you fire a ray directly at the sphere (0,0,-1), can you make it work then?

 

If not, problem is probably in sphere intersection.

 

Is the sphere positioned so that camera is not inside it, and its not behind camera (position should have negative z, further than radius)




#5268072 [Advice] 2D Game Engine/Framework w/ Good Networking Support

Posted by on 26 December 2015 - 03:26 PM


Hello GameDev.Net community! I am just an amateur developer and I've been trying to work on this crazy idea of mine for quite some time now. I'm kind of at a point where I might need some guidance from more experienced programmers. I'll try to be as short as I can, straight to the point.

 

What I want: I want a 2D multiplayer rpg game with support of, well, as many client as possible. I do NOT care if it is distributive-based or browser-based, no preference.

 

What I want engine-wise: A non-complicated framework or entire engine with built-in networking tools, primarily 2D-oriented but not limited to. Pretty much any technology language-wise, just as long it is adequate and reasonable to quickly grasp on and dive into.

 

What I know:

* VB & C++ with decent OOP knowledge;

* PHP (Procedural & OOP) + MySQL;

* Some Flash + AS3 skills;

* Basic JavaScript;

* Some scripting in Python & Lua. and don't mind to learn some more.

* C++ and PHP.

 

I do not want to write a game from scratch, i.e. 0-starting in C++ with WinSock and etc. Too much pain and I don't have much desire and time for that. I could do it completely in PHP+MySQL bundle and that would work except that it is almost 2016 and I want dynamic pages without the need to reload them.

 

JavaScript. I've been looking into some JavaScript and I lean more and more towards it but it is way too complicated, honestly with its Node.js and Socket.io and other stuff, I just don't think it's worth the time but I might revise this if you could persuade me. I'd like to keep JS as my last resort.

 

GameMaker & Construct. I also have looked into GameMaker Studio and Construct 2, and have played around a bit but quickly realized that with the provided capabilities it wouldn't be even nearly enough to fulfill my expectations. In addition, I've tried HTML5 and it is also not powerful enough.

 

FLASH & ActionScript 3. A very ugly and old way but hey, it works. I had a more-or-less working thing on PHP+AS3 bundle, however it was too buggy and let's face it, the community is dead. Flash is dead.

 

Look at what I have: Here's a quick example of what I am talking about (Login: Micard, Password: admin):

http://guardsofrhyn.a78.org/

The chat should work, at least it used to, unless I did something to the DB. In the attachment is a quick GMS sketch as well but it does its job and represents what I want as well.

 

CONCLUSION: Please guide me to the direction that will help me achieve my goals. I do not plan to sell this game as a product or anything. I also don't have much time to work on games as I am an Aerospace Engineer but I do it as a hobby and that's why I avoid getting into something too deep like JavaScript. If you have any suggestions, literally, any - I'd very appreciate it!

 

Thank you!

 

There you go




#5267828 Best way to draw voxelized pyramid?

Posted by on 24 December 2015 - 02:33 PM

The primary drawback with that method, is that while the number of vertices drawn goes down, the number of fragments/pixels processed goes up (assuming you do hidden-face elimination which is the most important optimization here!)

 

Reducing to boxes never decreases number of fragments drawn. In practically all situations, it will drastically increase their amount.

 

Doing this would only make sense if doing this vertices-for-fragments trade results in net performance increase.

One possible scenario would be far-away chunks - where each voxel takes just few pixels on screen, shading is cheap because you dont even need textures or proper lighting at extreme distances, and further you dont need to be able to easily edit those chunks because theyre too far for such things to matter.

 

So, the disadvantages in a normal voxel grid scenario with high fragments-to-vertices ratio:

-Overall performance significantly decreases because theres vastly more fragments to shade (even with early depth eliminations and whatnot)

(the problem is hidden face elimination. Reducing to boxes is a limited form of hidden face elimination. Its better than the naive "just render many boxes" approach, but much less effective than complete per-voxel hidden surface elimination.)

-Cost of modifying object increases (need to recalculate the 'optimized' boxes)

-No flexibility with per-voxel/per-vertex changes (like how minecraft renders its lighting with some per-face shadow texture things IIRC). Also you cant make nonlinear transformations on the voxels because this will detach box faces and vertices from each other spatially (with normal voxels there are only vertex-vertex connections as you say)

 

The first one (that its a highly less effective form of hidden surface removal) is the most relevant here (discussing performance).

 

The conclusion would be that AS LONG AS you do not 'break' normal hidden surface elimination, this kind style of optimization helps (still the other disadvantages apply):

-you can apply it to the 2D surfaces surviving hidden surface elimination only, instead of 3D voxel regions (like you seem to have decided to do)

-you can apply it to 3D voxel regions, if most of the resulting box is visible (not hidden)

 

And if you DO decide to still use it, heres a performance tip for making it practical:

 

Perform hidden surface removal on the boxes! Only replace a voxel region with a box, when some faces of the box can be removed such that most of the resulting box surface is visible (not hidden).

Like you could split your pyramid such that each layer is formed by 4 thin and long boxes, with the 'inside' faces removed/hidden. That would be very close to an optimal mesh.




#5267613 Draw only portions of the circle visible to the user

Posted by on 23 December 2015 - 02:54 AM

If your circles dont change significantly over time, and/or if you have many circles that look the same, draw the circle to an image and blit that to the screen, which should perform significantly better (you can update the image, even every frame if theres many circles sharing the same image and thus saving calculations).




#5267552 Compiling and running on different OpenGL versions

Posted by on 22 December 2015 - 04:41 PM

Most of the openGL functions you use, are fetched from at runtime in the form of a function pointer (see openGL wiki on function loading).

 

Usually youd use a helper library like GLEW to automatically do the loading (it declares all the functions as function pointers and attempts to load them I assume).

 

 

So, presumably, if a function is not supported, the function pointer returned when trying to load a GL function at runtime will be nullptr or some other value (not sure what platforms wouldnt return nullptr) that will cause your program to crash if you try to call it...

 

This also means, you can always do checks at runtime to ensure you have the correct opengl version available, and even individual functions. If youre using a lower opengl version, you can try loading some functions not available in your gl version as an extension as well (like if theres something specific you need from the higher version, but you cant ask for full support of that version for some reason)






PARTNERS