Figure out your bottleneck
A few hundred moving objects should not be a problem. However, a few hundred colliding objects might be. It will take some testing, yet I believe the bottleneck you have are the collision.
By the way, about how many objects are we talking? What is the platform? A hundred objects for a mobile game is not the same as a hundred for ...
Very old games used a technique where only those parts of a frame are redrawn that changed on that frame. What I can remember, the game "Little Big Adventure" uses this technique (1994). But you can see that the game has for most of the time a static camera. only when you move out of the visible area the scene is redrawn. If you play the game you would also ...
First of all, that game mechanic looks like it could be super fun, so congrats on thinking of it! Here are two simple solutions that could be used independently or together to solve this particular issue:
Remove Very Small Pieces
There isn't much of a point to keeping around tiny pieces of collision that really won't impede the player or have any real ...
I'd disagree with the accepted answer here.
I'd call this an autotile, and not a 9-slice
"9-Slice" (or 9-patch) is usually used to refer to a system where the content creator slices the image along 4 lines (not necessarily equally-spaced tiles). When rendering a rectangle, the corner slices are displayed at their native size, and the edges/center are ...
Large, open areas do not work very well in top-down 2d. Putting the player in such an area just disorients them. It is much better to use more complex areas which limit the way the player can navigate.
So you need some other way to communicate the scale of the world to the player. A common way to do that is by providing them with a world map they can access ...
There is a very simple way achieving this with shaders, you need three* textures: empty health bar, health bar texture and mask with gradient of health distribution with one extreme(e.g. darkest not black or most transparent alpha value) on one end and the other on other end. It is best shown on image, I am currently unable do draw curved gradient only ...
I was about to post a link to the Asteroid Base blog on the Walker enemy when I noticed karmington already linked to the Gamasutra article in a comment.
It's probably worth giving this a bit more visibility and explanation as an answer in its own right though.
The trick is raycasts. These let your code scan along a line for a collision.
To get the Walker ...
A common way this is done is using an indirect texture lookup in the shader to distort the display texture:
Here I'm using a texture with some low-frequency colour noise (tiling smooth blobs of random colours), and scrolling it across the display geometry over time.
Instead of drawing the colours from this texture, I instead take the red & green ...
A name that will give you actual results in Google is 9-slice.
Another way to call it and ask Google about it is 9-patch.
As per this chat discussion, 9-pane seems to also be used, but the almighty Google will not show you what you need, unless you're into windows or something.
Thanks to Kevin and Josh in chat for that.
My first suggestion would be to just stick with A = Counter-clockwise and D = Clockwise movement. It is not very confusing and is pretty much the "standard" (i.e. most common) choice when it comes to orbital movement like this.
Another way would be to change the way your game moves. Instead of moving the player when they are on a planet you could rotate the ...
X = x*cos(θ) - y*sin(θ)
Y = x*sin(θ) + y*cos(θ)
This will give you the location of a point rotated θ degrees around the origin. Since the corners of the square are rotated around the center of the square and not the origin, a couple of steps need to be added to be able to use this formula. First you need to set the point relative to the origin. Then you ...
One of the best, and most used, algorithms I've seen out there is generating dungeons using Binary Space Partitioning.
The best general explanation I've read is the one found in The Chronicles of Doryen (attached at the end for backup purposes) because explains the procedure without getting into the code, thus leaving the implementation to the reader.
Implemented mathematically, as a pixel shader:
On the CPU, calculate HealthDirection and its' dot product with V2
On the GPU, calculate a normalized direction away from the centerpoint for each pixel. Compare each dot product to HealthDirections' to choose whether to shade "background", or in color.
If you "inverted" this algorithm and worked from the ...
There's a solid overview of different popular tile combination patterns put together by Boris the Brave, building on some earlier work by Sean Howard.
I'll briefly summarize the main categories these authors identify in case the links break in future, along with a few additions of my own. I recommend you read the original articles for the full details.
I think you'll have to take the box's movement into consideration. That is, only crush if the box is moving towards the player.
This is similar to other problems in platformers, where the movement is important. E.g. for platforms that you can jump through and onto from below, don't check collision if the player is moving upwards.
So a block can crush the ...
Planning to grow:
Hard-coded constants are fine for small projects but, eventually, as your software grows in size, you will wish you could change those settings without having to recompile everything. There are many times you will want to change settings while the game is running and you can't do that with hard-coded constants.
Once your project ...
You can't. At least, not as a game developer.
As a gamer, you can purchase more expensive keyboards with "anti-ghosting" features, but otherwise the limitation is part of the hardware itself, so there's nothing you can do in software to solve it.
Check out this demo page to see how keyboard ghosting works, plus a demo: https://web.archive.org/web/...
Your RAM is your limit.
The following tests were performed on a system with these specs:
16 GB RAM
NVIDIA GeForce GTX 1070
Windows 7 Home Premium
Here is a script I ran which grows a tilemap by filling it with a single tile (32x32 pixels). The Method Grow() adds another column and another row to the current map. The method gets called 100 ...
This is Matt, the creator of Trainyard. @DMGregory summoned me here! :)
It sounds like you're working through the same issues I had to deal with. It's a tricky problem where there isn't necessarily a perfect solution.
One thing to consider is the constraints of the problem. I was targeting a 50mm wide screen on the early iPhones, and Apple's recommendation ...
Have you considered that it looks very odd for a person to standing perpendicular to a slope?
You need to be upright to stay in balance.
Treat his feet as a separate object and rotate them to be parallel to the slope. (A raycast will find the angle's normal, as dnk described. The angle for the feet is that + 90°.)
Fake it, by moving ...
I think not overthinking this issue will give the best results so I would just implement a simple key-value saving system into your game that you store along your other save data and then load on-demand when you need to access a previous state.
The flow could look something like this:
Load level from file
Before placing a tile / object check if it has a "...
dot(A,B) = |A| * |B| * cos(angle)
which can be rearranged to
angle = arccos(dot(A,B) / (|A|* |B|)).
With this formula, you can find the smallest angle between the two vectors, which will be between 0 and 180 degrees. If you need it between 0 and 360 degrees this question may help you.
By the way, the angle between two parallel vectors pointing in the same ...
There is a simple way to do exactly what you want.
In addition to a float velocity you'll need to have a second float variable which will contain and accumulate a difference between real velocity and rounded velocity. This difference is then combined with velocity itself.
int pos = 10;
You don't need to adapt A* at all. The only consideration is where you put your nodes and how you connect them. The linked article seems to convert from a platformer-friendly model to a grid based pathfinding model, which I don't think you want.
A* itself is a tree search algorithm which finds the optimal path through your graph and requires some heuristic ...
100 pixels per unit would mean a sprite that's 100 pixels would equal 1 unit in the scene. It's simply a scale to say how many pixels equal one unit. This can affect things like physics. A lower pixels to units setting would require more force to move one unit than a higher pixels to units setting.
Yes, there may be times where you'll want to manipulate ...
I haven't looked at specific implementation of A* by Aaron but with a normal A* you could include the 'block tower' as passable terrain but update the heuristic so that the 'cost' is much higher than a normal tile (so that AI will evaluate whether it is easier to destroy the block and continue or simple go around via the path that is not blocked).
Then you ...
I thought this would be a relatively simple problem to solve but I spent a couple days trying to figure out how the heck to simulate pendulum movement. I didn't want to cheat and just change the x,y position based on sin(theta) and cos(theta) curves. Instead I wanted to deal with the two forces that are applied in real life, Gravity and Tension. The main ...
Assuming that you know what the World Transformation matrix for that object A is, You just need to construct the inverse of that matrix and you will have what you need.
Suppose the rotation, scaling and translation matrices of object A used to get it to Global Space are R, S and T respectively. You will multiply these together like
S * R * T = W
GameDev Meta: Henshin Main!! :D
The code uses a canvas clip region and requestAnimationFrame for
maximum quality and efficiency. (It's better live.)
I assumed you meant HTML canvas! Even if you didn't, other rendering engines (such as Android's 2D rendering pipeline, which you might have meant) also support hardware-accelerated clip regions. The ...