Download

Server and Client separate classes

Is it possible to make separate classes for server and client files?

The game I am currently working on wont have any listen server just dedicated servers. So are there any ways in which I can write sever variables and functions in a different place/class?

Another related questions. Can variables in server and clients be used independently? Like I have a variable


 float LastFiringTime;

I am using it to store when the firing takes place in client side in the client side functions. And when the firing takes place on the server side for the severer side functions. Obviously the client side functions are only being called on the client and the server side functions are only being called on the servers. Will there be any problems with something like that?

If you’ve built the source for a dedicated server, the easiest route to take would just be to wrap Server-Specific functions and variables in a #if UE_SERVER or whatever the define is for the dedicated servers.