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"

procedural generated map is random in editor but not in packaged game

Hi,

I've created a game that generates a random map using C++ and the rand() functions and some algorithms. I use event beginplay to call my map generator at startup, and blueprints to spawn the assets. This works great in the editor. The level is random every time I play. However, when I package the game, the stand alone game will have the same level every time I launch the game. If I re-package the game I will get a new static map. Please help. I'm at a complete loss with this problem.

Product Version: Not Selected
Tags:
more ▼

asked Jul 25 '14 at 07:11 AM in Packaging & Deployment

avatar image

RickDangerous
63 12 11 15

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

1 answer: sort voted first

I'm just going to answer my own post here in case somebody else runs into this problem. The reason for this behavior is because I did not use a seed for the random number generator. For some weird reason this will still give random numbers when run in the editor, but it will become static when packaged. I added: srand (time(NULL)); to the code and problem was solved.

Thanks to warlord57 for figuring this out.

more ▼

answered Aug 28 '14 at 11:44 AM

avatar image

RickDangerous
63 12 11 15

avatar image Spishy Feb 18 '17 at 03:56 AM

For those of us who don't understand code, how exactly do I add this into ue4?

(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