• Welcome to SC4 Devotion Forum Archives.

Region level system, draft

Started by croxis, October 28, 2009, 12:08:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

croxis

Here is a draft of how regions will work, and client server interaction.

In an attempt to improve region level play there will be a departure from the isolated cities found in SC4. The player will be able to set custom sizes and positions of their cities (within limits). In order to do so the entire region will need to be loaded into memory, even though some parts will be inactive and not simulated. This will enable higher levels of interactions between cities. The performance cost is unknown.

Workflow

A player with admin access to the server requests a list of region maps (this is a separate directory from the generated regions [saved games]). The server checks authorizations (not started), scans the region folder (complete), encodes the image maps into base64 strings and sends them over the wire (complete). The client will generate a gui with thumbnail shots of the heightmaps (incomplete) which the player selects and a new ui for region name and any options, client responds (in progress) and the server generates the new region (started).

(None of the following has been started)
The server will generate a new folder with the region name (auto appends some prefix or sufix to prevent name collison as needed). The heightmap is copied over and the base details are added based on the options. This can inclued fauna, flora, and any initial infrastructure such as unincorperated farms and houses, transportation, power, etc. Starter cities can be added, or a sc4 style square cities that are empty. Server then saves the region. After all needed simulation data is generated the server then sends the game state to all connected clients.(None started)

Because the server may be dealing with clients such as top down 2d it makes no sense for the server to store a 3d mesh object. Instead the server will modify the heightmap saved in the region folder. Heightmap will be in memory and will only save to file on region save.

A quadtree will be generated for a region, with the smallest threshold at 10mx10m. At a defined level in the quadtree (hopefully player selected?) is where city ownership is defined. When that city is active the simulation will activate for anything in those quads. [For discussion. Should the simulation be synced for all active quads or not? If possible I say no, it will help stagger computation load. It might also make threading more easy. On the other hand it may lead to "buggy" behaviors if two adjacent cities are active.] This does not mean the simulation can't effect inactive quads. This allows spatial influences such as pollution and land value to influence other cities.

A similar effect will be done within cities. For example, upon pollution updates the simulation will go through the quad tree to see if any new buildings have been created or lost [will work better if we have slower changes in buildings then the predecessors, tangent on that later.]. If so, run updatePollution on that structure. [This may not be how it works, may just use a list of new buildings or some such]

Saving the region will involve serializing the data, possibly an extension of the game state in the protocol buffer

Client side will be an interesting case. To render the entire region in 3d would be very expensive. To go around this any city the player is not controlling will be rendered similar to the region view in sim city 4, as a flat texture with a screenshot of the city. This might be top down (like the sat views on Google maps) or at an angle (SC4).  Client side players will then be able to control how much extra outside of the city can be rendered. The official clients will render and periodically send back these screenshots to be saved. (We can also make a small command line only version of the client that can be called to connect and do this, or integrate it into the server itself.) (Also the Panda engine has some code in place to do this with this class.

Clients will be sent updates on any changes that happen on the simulation, even if it isn't the city they are playing.

In theory the client can zoom in and out seamlessly from region view to city view.

Client can also be set up to a full region (not real time) render for screenhots or movies. It might also be possible to export the entire region into a platform neutral format for 3d modeling.

croxis

Question to the programmers out there. What is the best way to store and manage the tiles?

tomkeus

Tiles aren't reallocated during the game, so using arrays will suffice.

In a day or two I'm submitting that god damned paper and I will be able to do some actual work.
#define TRUE FALSE /*Happy debugging suckers*/

croxis


tomkeus

Topological excitations in superconductors.
#define TRUE FALSE /*Happy debugging suckers*/

JoeST

Copperminds and Cuddleswarms