x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Should i handle all the health, mana on the GameInstance or on the pawn?

Are there any pros or cons storing all the stats like health, mana, stamina on the Game Instance than on the pawn? Like preventing people from hacking and bugs in the future etc ?

Product Version: UE 4.20
Tags:
more ▼

asked Aug 25 '18 at 12:41 PM in Blueprint Scripting

avatar image

G1K777
36 1 3 9

avatar image ThompsonN13 Aug 25 '18 at 01:37 PM

it would eliminate the step of having to save your health between levels, but thats a short sighted argument since it would create more script needed just to apply damage. personally i go with storing the variables in the character. though with multiplayer its a bit different since the values are stored on the server, im not a expert in multiplayer but if i remember right i think its just a replication issue and you have the players exist on both the client and server. since everything exists on the server that makes it the authority and the one that does all the change making, which in turn eliminates the hacks.

avatar image G1K777 Aug 27 '18 at 03:12 PM

I will use different maps and i must store the health. It will be very PVP focused game and it would be bit OP if you could regenerate your Health by just going through a teleport... I'm about to slowly (over few years) revive my fav game that i was nolifing for a very long time :d

avatar image GarnerP57 Aug 27 '18 at 07:08 PM

You can't prevent the clients from changing their variables locally but you can prevent exposing internal server variables and validate input coming from the client before applying it on the server. You should use PlayerState if you want to keep a variable between levels.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

The GameInstance class is an object that represents the instance of your game (if I understood the documentation correctly) To me, I wouldn't place character stats in the GameInstance and would instead place it in a PlayerState (if you plan on making a multiplayer game) or in the class that represents your character.

As for security and cheating protection, a first step would be to validate the input coming from the client.

more ▼

answered Aug 25 '18 at 01:35 PM

avatar image

RadiantWings
66 13 14 18

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question