Thursday, April 18, 2013

Multiplayer, multiprayer

Over the weekend, I finally got the time to delve into the multiplayer functionalities of the Unreal Engine from chapter 8 of my book. I was happy to discover that the general way of things is kind of similar to Unity's way, where server and client code are shared, but clearer in a way; instead of RPC calls, just add the keyword 'client' or 'server' in the function prototype and you're done, every call to it will be sent over the network.

For the variables it's even simpler; instead of having your network view tracking some component, you can just add the variables you want replicated in the 'replication' block and have them being automatically replicated under some conditions. Things get more complicated from there, but it's overall pretty logical.

It all looks nice and easy, but setting up the multiplayer was a bit of a pain for a first time user. Of course, there was the regular mistake of forgetting to call the parent class' version of functions in the reeimplementation (in this case, PostBeginPlay(), which is a pretty big deal since the server crashes at that point), which is still as frustrating as the first time ("How could I have been so dumb!"). Once that was done, my next 4 hours were dedicated to dig in the Unreal API and find out why my weapon wasn't firing. As it turns out, a function I had copied from the PhysicsGun class was not necessarily meant to be taken in a multiplayer setting, at least not the way I was doing it. Just changing its name (StartFire to ServerStartFire) did the trick.

Of course, after doing all this it looks *only* like what it did when it was single player. Which means there's no video this time. Still, I'm really happy. The biggest achievements are not necessarily the most visible ones.

Sunday, April 7, 2013

Phun with Physics

Following up on my last post, I played around with the physics gun class. I also figured out how to add actors influenced by physics (KActors, thanks to the example map that helped me figure it out). Not too long after... voilĂ ! I managed to use the physics gun class properly, as the picture here tries to show (but it kinda fails at it, a video would be better).

Box flying thanks to the awesome gun (I used the rocket launcher visuals)

Now I just have to customize the functionality to have the guns I need... and then I can move on to The Rest!

Thursday, April 4, 2013

After GDC, attacking again!

Last week was crazy. GDC is as much a networking ground as it is an old friend's reunion and party place. That said, now is the time to go back to what makes it all worth it: making games!

After some consideration, I decided to ditch my first pass at a level altogether. A purely vertical level was presenting challenges that I wasn't sure I had the time to address; therefore, I opted for a horizontal disposition, as you can see in the following image.

View from above


My goal is to make a small 3D tic tac toe FPS with physics combat elements. Which means, instead of shooting each other in the face, the players will each have a gun each applying a different force on the target (one attractive, one repulsive). The goal for the players is same as in tic-tac-toe, but in order to place a symbol somewhere they will have to use their gun to manipulate it. Of course, you can also hinder the movements of the other player by shooting your gun at him/her, by blocking critical corridors...

To make it all happen, I've started digging around the API to see which classes I can extend and which functions I can use. I've found a physics gun class, which seems like it would be a good starting point.