I added some basic path smoothing based on the visibility between nodes. The white line shows the path calculated by A* algorithm. To generate the "smooth" orange path I go trough the original path and check if nodes can see some other nodes further along the way, if so I make a direct connection with it, skipping the nodes between them.
The other thing you can see is adding temporary nodes to the mesh (yellow start, magenta end).
I check what triangle/polygon the cursor is colliding with (pink
triangle) and then make a connection with the nodes in the vertices.
I've read a tutorial
where the guy checks visibility between nodes to make the connections
and build the tree, then this method of smoothing isn't necessary. But
in a map with so many vertices the number of connections would be
insane, and would probably slow down the A* algorithm.
I should do some testing to see which is faster:
- connections based on triangulation + path smoothing that uses B2D raycasting,
- connections based on visibility between nodes,
Working on navigation mesh for AI, this is generated automatically, by selecting an area with a mouse. I'm using Clipper library for this. You can notice the offset from the inner polygons :
Didn't know how to connect vertices in the navigation mesh, so I triangulated it with Poly2Tri and used triangles to form connections. I will have to ditch Poly2Tri for some library that generates polygons instead, and do some "path smoothing"; starting from the yellow node, the node 10 is visible from 5 and should be directly connected in the final path.
In a platformer game this could be used for flying enemies. Triangles/polygons will be used to know in which area the entity and its target is located, so I can quickly get the nodes nearby, connect with them with a temporary node and calculate the final path.
This video shows a "Soldat meets Quake 2 arena" multiplayer prototype I basically made already in January. It took some time to get motivated to fix bugs, add some features and make it look decent.
The first part of the video shows networking based on SDL_net
tutorial by thecplusplusguy. It uses TCP to send data between server and
clients. The data is just plain text. I'm not saying all this works and
is how it should be done, this is just to show what I've been working
on, to do some testing and get some feedback.
for other players in the video, those are not people playing with me.
They are just "bots" who read my stored input commands and send them to
server to move each other.
Only thing that I
try to keep in sync is the player. The client sends input commands to
the server, server updates the game world and players, and sends the
player states and the input commands back to to the clients.
example, player fires a bullet on the client after he gets his own state
and commands back from the server. The bullet on the client and server
have nothing to do with each other, they exist in their own Box2D world,
but only the collision with the players on the server counts:
can happen that the bullet goes trough the player on the client if the
server kills him before the local collision is detected.
- Also ragdolls are not in sync, because they don't get velocity and rotation values from server.
- Explosion force and gibbing are disabled on multiplayer.
The second half of the video(1:30)
shows an offline bot match. As said above there is no real AI, just stored
commands that they read. It doesn't really work, but is good enough for
testing and to have some fun.
HELP WANTED !
I only managed to
make multiplayer work using local IP of computers connected to my
wireless router. When I host a server and try to connect using its public
IP address, it fails. I did port forwarding on my router, but it didn't help. I don't
know if the problem is with my code, or router and firewall settings. I
newer hosted a multiplayer server, so it would be great if someone more
experienced would try to test it out. I downloaded a game called Teeworld to test their server. Sometimes I can connect, sometimes I don't, so I assume it's because of my router or firewall.
Either way, any feedback is welcome. Even letting me know if it started successfully(or not) would be something.