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"

Running into issues with large floats?

So I have my game hooked up to a server and I'm working on an inventory system. Basically each item is saved as a 13 digit code, where each number defines a parameter of the item that's being stored. Then that number gets uploaded, and then called when the player accesses their inventory. However, I'm running into some weird issues.

I've been trying to use modulo to isolate each section of the number, and it's been working for the most part, but towards the end when I try to do, say 1123334445566 % 10000, i should be getting 5566, but UE4 is getting 0. Similarly, if I try to do say 1123334445566 % 100, it should be 66, but the engine ends up with a ridiculously large negative number.

I thought it might have something to do with floats, but when I tried to convert the "code" to an integer, it once again turns into a massive negative number out of the blue? Is my number too big for UE4 to handle? And if so, what should I do to get around this?

Product Version: UE 4.20
more ▼

asked Mar 07 '19 at 05:04 AM in Blueprint Scripting

avatar image

Grandpa J0nny
7 4 2 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

UE4 uses 32 bits for an integer / float, so there is no way you're gonna have a 13 digit number.

What is the reason behind using numbers at all? Why not structs? What data are you trying to store?

more ▼

answered Mar 07 '19 at 10:09 AM

avatar image

1.4k 5 5 7

avatar image Grandpa J0nny Mar 07 '19 at 12:28 PM

Im using gamesparks and Im not very good with it yet, so Im not really sure how to upload a structure without turning it into a number first.

avatar image KristofMorva Mar 07 '19 at 12:48 PM

Oh, about GameSparks communication I have no idea, but there are numerous resources available for it, like: https://docs.gamesparks.com/getting-started/using-cloud-code/unreal-cloud-code.html

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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