Game Logic, Variable processing & file IO


Question 1: Game Logic processing
What would be the best way to tack game logic in a game which has a lot of user defined/created content/paramaters which change over time by the game logic with level streaming?

So if I had a level streaming grid (50x50 levels), say player creates an object in level x1,y1 (will use x,y for level position calculation) and then moves to level x50,y14 and creates another object both of these objects are let’s say for example a resource collector or sorts, how would I go about doing that? Don’t all the blueprints and classes get unloaded?

I need to process a potentially large amount of game data which will be iterated over frequently for every user created object for value increases or decreases, apply AI actions such as is built, is damaged, is under attack, move unit of type, is attack feasible, is attack logical, if available / if not available / random events / etc etc, kind of basic automated gameplay but without the player being there.

Question 2: CPU & GPU Load
Also any ideas how much of this kind of logic processing I can get away with, with active gameplay? I foresee a possible max dynamic variable count of about 5,000 variables for each level, with 50x50 levels = 50x50x5,000 = 12,500,000 vars for logic to be processed by. (very doubtful a gamer would hit this amount but it’s a max best guess).

Question 3: Game save / State machine / Persistent data
Any tips on saving game data? EG Create XML, Save XML, Edit XML? Where would I save game data? How would I save game data? What would be the best way of doing this?
Does UE4 have file writing capabilities? XML capabilities? or some other method of storing data, game save positions or is there another format in use other than XML? JSON? Other? Custom DB?
And for large amounts of say XML data, is there a compressor / decompressor or encoder / decoder (so people don’t edit their worlds in a text editor) or would I have to write one in C++?

Any ideas? Tips? Pointers?



For me this looks too much; you should activate logic only on entities on the same map and some kilometer around the player.

I need to build an AI Economy that spans many levels. EG:

Game data object

  • Game object generic
    • money, health
  • Resources
    • resource 1, resource 2, resource 3, resource 10 (all auto increment over time, environment variables define if resource has a limit to how much there is)
  • Transport routes
    • is vehicle destroyed, damaged, under attack
    • cargo size
    • amount of each type of resource in each
    • unit x,y,vector, target destination, stage on user defined route
    • unit no & id
  • Offensive & Defensive units / building
    • auto re-build / regeneration enabled
  • AI resource market
    • is resource available
    • is resource expensive
    • are funds available
    • is auto budget on (is for computer AI players)

and more… I still need to get to this part for full details of how many variables there are. Each system expands, shrinks, fights, dies and so on via AI processing.

This would be a basic game object which may be created upto 10 times per a level with a very large seamless map thus a streaming level loader of 50x50 (may be a bit much, but not far off), but at the very least I need to calculate this data when that level is no longer available.