This is my first time building a game engine, albeit a 2D one for Android.
I've decided to build a simple ECS engine. The game I'm trying to *almost* duplicate at the moment is Doodle Jump.
I currently have the following systems running in my update loop, in the given order:
1) Physics (applies gravity)
2) Collision (works by predicting next position based on current position and velocity, and updates the current position on collision)
3) Transform Update (updates all entities based on their current velocities)
4) Render System (Draws to canvas)
I have the following questions: I want to write a manager that generates obstacles at, say, fixed gaps and when the player reaches the middle of the screen. This manager will need the current position and velocity of the player. (It finds the player by quering the ComponentManager for all entities having a PlayerComponent)
1) Where should this manager be placed in the game loop?
2) Should it even be a manager? Can such logic lie in systems?
3) Extending upon 2, what really are Systems supposed to handle?
I'm looking for solutions to a Line of Effect system I'm creating.
Specifically, I'm looking for a real-time algorithm that helps an AI unit find the closest tile in range that has a line of effect to its target
At the moment, I'm using raycasting (in Unity) to determine what tiles have lines of effect (no obstructions) to each other.
This information is then used by the AI to locate an unobstructed targeting position within range.
The end result is that every tile has a list of other tile locations it has a clear line of effect to.
The problem is that it takes forever to scan and makes the map far too static for my needs.
Anyone implement something similar?
A texture rectangle, texture type is RGBA.
the alpha channel like this: (0=0,x=255)
I want a function to picking. now I have a very clumsy solutions:
//pixel buffer to texture....... (texture is handle, a number.cannot get pixel matrix.)
BYTE pixel_alpha;//save alpha channel matrix
texture.draw(30,30);//draw the picture in the window x=30 , y=30
if(picking(GetMouseX,GetMouseY))MessageBox("click!"); // picking functio
bool picking(int x,int y)
int mouse_to_image_x, mouse_to_image_y;//get mouse position in the image
mouse_to_image_x = 30 - x;
mouse_to_image_y = 30 - y;
if((mouse_to_image_x < 0 && mouse_to_image_x > 7) && (mouse_to_image_y < 0 && mouse_to_image_y > 7))return false;//mouse is not in the image
for(int i = 0; i < 7 * 7; i++)
if(pixel_alpha[mouse_to_image_x][mouse_to_image_y] == 255)return true;//in the image and alpha channel is 255
1.an excessive amount of memory in alpha channel matrix.
2.i think efficiency is not high.
so, how to do?
not is ray picking, What is this technology called?
I have a Bachelor project on topic "Implenet 3D Boid's algorithm in OpenGL". All OpenGL issues works fine for me, all rendering etc. But when I started implement the boid's algorithm it was getting worse and worse. I read article (http://natureofcode.com/book/chapter-6-autonomous-agents/) inspirate from another code (here: https://github.com/jyanar/Boids/tree/master/src) but it still doesn't work like in tutorials and videos. For example the main problem: when I apply Cohesion (one of three main laws of boids) it makes some "cycling knot". Second, when some flock touch to another it scary change the coordination or respawn in origin (x: 0, y:0. z:0). Just some streng things.
I followed many tutorials, change a try everything but it isn't so smooth, without lags like in another videos. I really need your help.
My code (optimalizing branch): https://github.com/pr033r/BachelorProject/tree/Optimalizing
Exe file (if you want to look) and models folder (for those who will download the sources):
Thanks for any help...