Crowd simulation and spatial layout optimization method and system based on open source engine and related equipment

By creating a collection of scene objects with identifiable attributes in the 3D engine and generating a structured configuration file, the problems of configuration complexity and data consistency in crowd behavior simulation in small and medium-sized institutions are solved, achieving efficient spatial modeling and simulation calculation.

CN121706335APending Publication Date: 2026-03-20何栩辰
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511620294.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies for crowd behavior simulation based on 3D simulation have problems such as complex configuration and difficulty in ensuring data consistency in small and medium-sized institutions. In particular, path errors and unstable object coverage are prone to occur in the stage of defining spatial boundaries and obstacles, making it difficult to meet actual deployment requirements.

Method used

By creating and editing a collection of scene objects with identifiable attributes in the interactive interface of the 3D engine, a structured configuration file is generated by combining crowd behavior parameters, and then input into an open-source crowd simulation framework for simulation calculation, ensuring data consistency and logical closure.

Benefits of technology

It enables efficient spatial modeling and parameter setting even in the absence of professional background, reduces configuration complexity and data consistency issues, and improves the maintainability and efficiency of the simulation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121706335A_ABST
    Figure CN121706335A_ABST
Patent Text Reader

Abstract

The invention provides a crowd simulation and spatial layout optimization method and system based on an open source engine and related equipment. The method comprises the following steps: receiving user input in an interactive interface constructed by a three-dimensional engine, creating and editing three-dimensional scene data, and mapping the three-dimensional scene data into a scene object set with an identification attribute; receiving crowd behavior parameters set by a user based on the scene object set, and associating the crowd behavior parameters to the corresponding scene objects to generate parameter binding information; a configuration generation module is called, a configuration file compatible with an open source crowd simulation framework is generated according to the scene object set and the parameter binding information, and the configuration file comprises structured data describing the relation between scene object space attributes and crowd behavior parameters; and inputting the configuration file into an open source crowd simulation framework, executing simulation calculation of crowd agency behaviors, and generating trajectory data corresponding to the configuration file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer information technology, and more specifically, to a crowd simulation and spatial layout optimization method based on an open-source engine, a crowd simulation and spatial layout optimization system based on an open-source engine, an electronic device, and a storage medium. Background Technology

[0002] In existing technologies, crowd behavior simulation based on 3D simulation has been widely used in the planning and evaluation of public spaces, especially in large venues, commercial complexes, and transportation hubs. By constructing virtual scenarios and simulating crowd movement processes, it assists in capacity estimation, flow design, and safety evacuation analysis. To achieve these goals, current mainstream solutions mostly rely on commercial simulation software platforms. Although these platforms have comprehensive functional integration capabilities, their underlying structure is usually a closed system with complex configuration interfaces. The operation process highly depends on the long-term training and experience of professionals, making it difficult to meet the needs of small and medium-sized institutions in terms of flexibility, transparency, and learning costs.

[0003] On the other hand, although some open-source simulation frameworks exist for simulating individual behavior and group dynamics, they are mostly positioned for low-level algorithm verification and research purposes, lacking high-level interactive mechanisms for building real-world scenarios and managing parameters. Especially in the early stages of modeling, users still need to manually complete a large amount of scenario and parameter file configuration work. This process often involves complex formats, unclear field mappings, and inconsistencies in cross-module data, significantly increasing the probability of errors and severely restricting simulation efficiency and maintainability. Furthermore, in the spatial boundary and obstacle definition stage, current technology does not provide fine-grained object management capabilities, leading to instability issues such as path errors, boundary conflicts, or object overwriting in some scenarios during subsequent simulations, making it difficult to meet the basic requirements for scenario integrity and configuration consistency in actual deployments.

[0004] It should be noted that the statements in the background section above are only used to provide background information related to this application and do not necessarily constitute prior art. Summary of the Invention

[0005] To at least partially overcome the problems existing in the related technologies, this disclosure provides a crowd simulation and spatial layout optimization method based on an open-source engine, a crowd simulation and spatial layout optimization system based on an open-source engine, an electronic device, and a storage medium.

[0006] According to one aspect of this disclosure, a method for crowd simulation and spatial layout optimization based on an open-source engine is provided, comprising:

[0007] The system receives user input in the interactive interface built by the 3D engine, creates and edits 3D scene data representing physical space boundaries, obstacles, entrances, exits and functional areas, and maps the 3D scene data into a set of scene objects with identification attributes.

[0008] Based on the set of scene objects, the system receives user-defined crowd behavior parameters, including crowd size, entry strategy, speed distribution, and dwell time distribution, and associates these crowd behavior parameters with the corresponding scene objects to generate parameter binding information.

[0009] The configuration generation module is invoked to generate a configuration file compatible with the open-source crowd simulation framework based on the set of scene objects and the parameter binding information. The configuration file includes structured data describing the relationship between the spatial attributes of the scene objects and the crowd behavior parameters.

[0010] The configuration file is input into the open-source crowd simulation framework to perform simulation calculations of crowd proxy behavior and generate trajectory data corresponding to the configuration file.

[0011] In one exemplary embodiment of this disclosure, receiving user input in an interactive interface built by a 3D engine, and creating and editing 3D scene data representing physical space boundaries, obstacles, entrances, exits, and functional areas, includes:

[0012] The 3D engine calls the mesh editing plugin to load the base plane and receives user input to define the boundary coordinates of the base plane;

[0013] A set of grid cells with unique identifiers is generated based on the boundary coordinates, and an extensible attribute field that supports subsequent annotation is embedded in the set of grid cells.

[0014] A grid cell is selected based on the user's interaction actions, and a three-dimensional geometric model representing the obstacle is drawn in the selected grid cell;

[0015] Receive user annotation operations and mark the specified boundary grid area as the entrance or exit;

[0016] Based on the region label settings selected by the user, the grid cells are divided into functional regions with different functional attributes.

[0017] In one exemplary embodiment of this disclosure, the step of receiving user-defined crowd behavior parameters based on the scene object set and associating the crowd behavior parameters with corresponding scene objects to generate parameter binding information includes:

[0018] Receive a set of parameters input by the user, representing the number of people and the entry strategy, and establish a mapping relationship between the set of parameters and the entry object;

[0019] The system retrieves the default speed distribution and dwell time distribution templates in the graphical interface and receives user adjustments to the template values.

[0020] The adjusted speed distribution and dwell time distribution data are respectively bound to the channel object and functional area object in the scene object;

[0021] The above mapping and binding relationships are merged to generate the parameter binding information, and stored as a data structure that the configuration generation module can recognize.

[0022] In one exemplary embodiment of this disclosure, wherein:

[0023] The process of receiving a set of parameters representing the number of people and the entry strategy from user input, and establishing a mapping relationship between the parameter set and the entry object, includes:

[0024] Display the property panel of all entry objects in the graphical interface;

[0025] Receive user input regarding the maximum number of people and the entry time window for each entry point;

[0026] Write the maximum number of people and the entry time window parameters into the configuration fields of the corresponding entry object;

[0027] Generate a data structure describing the entry-parameter mapping relationship and store the parameter binding information;

[0028] The step of binding the adjusted speed distribution and dwell time distribution data to the channel object and functional area object in the scene object, respectively, includes:

[0029] The unique identifiers of the channel object and the functional area object are parsed;

[0030] Pair the velocity distribution parameters with the identifier of the channel object;

[0031] Pair the dwell time distribution parameters with the identifiers of the functional area objects;

[0032] Record the pairing relationship and update it in the parameter binding information.

[0033] In one exemplary embodiment of this disclosure, the step of calling the configuration generation module to generate a configuration file compatible with the open-source crowd simulation framework based on the scene object set and the parameter binding information includes:

[0034] Extract the geometric topology and object identification fields contained in the scene object set;

[0035] Extract the behavior parameter values ​​corresponding to each object identifier field from the parameter binding information;

[0036] Based on the preset data structure template, the geometric topology and the behavioral parameter values ​​are filled into the corresponding fields;

[0037] The populated structured data is encoded into XML or JSON format to generate the configuration file.

[0038] In one exemplary embodiment of this disclosure, the step of filling the geometric topology and the behavioral parameter values ​​into the corresponding fields according to a preset data structure template includes:

[0039] Read the field definitions related to scene objects and behavior parameters from the data structure template;

[0040] Analyze the coordinate boundaries, connectivity relationships, and type fields in the scene object collection;

[0041] Parse the distribution parameters and quantity parameters in the parameter binding information;

[0042] According to the field definition rules, fill the coordinate boundaries, connection relationships, distribution parameters, and quantity parameters into the corresponding field positions.

[0043] In one exemplary embodiment of this disclosure, the step of inputting the configuration file into the open-source crowd simulation framework, performing simulation calculations of crowd proxy behavior, and generating trajectory data corresponding to the configuration file includes:

[0044] Invoke the execution process of the locally deployed open-source crowd simulation framework and load the configuration file into the input interface of the simulation framework;

[0045] The simulation process is executed to generate motion trajectories for multiple simulation agents, and a unique agent identifier is assigned to each simulation agent.

[0046] Record the two-dimensional position coordinates of each simulation agent in each simulation time step, and bind the two-dimensional position coordinates with the corresponding timestamp;

[0047] Using the agent identifier as an index, the bound timestamp and two-dimensional coordinate sequence are organized to generate a trajectory log file, which is then written to local storage.

[0048] According to one aspect of this disclosure, a crowd simulation and spatial layout optimization system based on an open-source engine is provided, comprising:

[0049] The 3D scene construction module is configured to receive user input in the interactive interface built by the 3D engine, create and edit 3D scene data representing physical space boundaries, obstacles, entrances, exits and functional areas, and map the 3D scene data into a set of scene objects with identification attributes;

[0050] The parameter acquisition module is configured to receive user-defined crowd behavior parameters based on the set of scene objects. The crowd behavior parameters include the number of people, entry strategy, speed distribution, and dwell time distribution. The module also associates the crowd behavior parameters with the corresponding scene objects to generate parameter binding information.

[0051] The configuration generation module is configured to generate a configuration file compatible with the open-source crowd simulation framework based on the set of scene objects and the parameter binding information. The configuration file includes structured data describing the relationship between the spatial attributes of the scene objects and the crowd behavior parameters.

[0052] The simulation calculation module is configured to input the configuration file into the open-source crowd simulation framework, perform simulation calculations of crowd proxy behavior, and generate trajectory data corresponding to the configuration file.

[0053] According to one aspect of this disclosure, an electronic device is provided, comprising:

[0054] Processor; and

[0055] Memory for storing the executable instructions of the processor;

[0056] The processor is configured to execute any of the methods described above by executing the executable instructions.

[0057] According to one aspect of this disclosure, a computer-readable storage medium is provided that stores a computer object program thereon, which, when executed by a processor, implements the method described in any of the preceding claims.

[0058] The technical solutions provided in the embodiments of this specification may include the following beneficial effects:

[0059] In the exemplary embodiment of this application, the crowd simulation and spatial layout optimization method based on an open-source engine creates and edits scene data with structural attributes in an interactive interface built by the 3D engine, and maps it to a set of scene objects with labels. This allows elements such as spatial boundaries, obstacles, and functional areas to be distinguished and managed in a structured manner during the modeling stage, thus ensuring clear object reference relationships for subsequent behavior parameter settings and configurations. Based on this, behavior parameters such as crowd size, entry strategy, speed distribution, and dwell time distribution are bound to scene elements according to the object dimension, and a structured configuration file is generated using the parameter binding information as input. This ensures consistency of cross-module data structures and avoids format errors and mapping conflicts caused by manual configuration from the source. Furthermore, when the configuration file is input into the open-source simulation framework and triggers agent behavior calculation, the configuration data already contains complete spatial structure and parameter relationships, allowing the simulation process to run in a logical closed loop. This maintains data integrity while reducing reliance on professional configuration experience. This enables the completion of spatial modeling, parameter setting, and behavioral simulation using reusable data structures in application scenarios lacking professional engineering background, avoiding the problems of complex configuration interfaces, rough object definitions, and difficulty in ensuring data consistency in existing technologies.

[0060] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0061] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0062] Figure 1 A system architecture diagram is shown that can be applied to the crowd simulation and spatial layout optimization method based on the open source engine of this disclosure.

[0063] Figure 2 A flowchart illustrating a crowd simulation and spatial layout optimization method based on an open-source engine is shown in an embodiment of this disclosure.

[0064] Figure 3 A schematic diagram of an interactive interface according to an embodiment of this disclosure is shown.

[0065] Figure 4 A schematic diagram of a crowd simulation and spatial layout optimization system based on an open-source engine is shown in an embodiment of this disclosure.

[0066] Figure 5 A schematic diagram of the structure of an electronic device suitable for implementing embodiments of the present disclosure is shown.

[0067] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation

[0068] The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” as used in this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0069] It should be understood that although the terms first, second, third, etc., may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0070] Figure 1 A schematic diagram of a system architecture for a crowd simulation and spatial layout optimization method based on an open-source engine, which can be applied to embodiments of this disclosure, is shown.

[0071] like Figure 1 As shown, system architecture 100 may include one or more terminal devices such as smartphone 101, portable computer 102, and desktop computer 103, network 104, and server 105. Network 104 is used as a medium to provide a communication link between the terminal devices and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0072] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, there can be any number of terminal devices, networks, and servers. For example, server 105 could be a server cluster composed of multiple servers.

[0073] The crowd simulation and spatial layout optimization method based on an open-source engine provided in this embodiment can be executed by a terminal device, and correspondingly, the crowd simulation and spatial layout optimization system based on an open-source engine can be set in the terminal device. However, those skilled in the art will readily understand that the crowd simulation and spatial layout optimization method based on an open-source engine provided in this embodiment can also be executed by a server 105, and correspondingly, the crowd simulation and spatial layout optimization system based on an open-source engine can also be set in the server 105. This exemplary embodiment does not impose any special limitations on this.

[0074] This disclosure first provides a method for crowd simulation and spatial layout optimization based on an open-source engine. The method is then illustrated below using server execution as an example.

[0075] Figure 2 The flowchart illustrating an embodiment of the present disclosure of a crowd simulation and spatial layout optimization method based on an open-source engine is shown. (Reference) Figure 2 As shown, the method may include steps S210 to S240:

[0076] The crowd simulation and spatial layout optimization method based on an open-source engine in this example embodiment will be described in detail below.

[0077] In step S210, as Figure 3 The interactive interface built by the 3D engine shown receives user input, creates and edits 3D scene data representing physical space boundaries, obstacles, entrances, exits and functional areas, and maps the 3D scene data into a set of scene objects with identifier attributes.

[0078] In this example implementation, the 3D engine can be a general-purpose graphics engine that supports programmable scene editing and attribute binding, such as Unity 3D, Unreal Engine, or Godot. Taking Unity 3D as an example, its Scene Editor and scripting interfaces (such as MonoBehaviour) can be used to implement the visual editing workflow for interactive construction and structural annotation in this example implementation.

[0079] In practical implementation, the initial scene can first be loaded by calling the mesh editing plugin in the 3D engine. This plugin can construct editable planar structures based on Unity's Mesh API or custom extensions. For example, loading the base plane can be achieved by calling the following interface:

[0080] Mesh mesh = new Mesh();

[0081] mesh.vertices=GenerateGridVertices(width,height,resolution);

[0082] mesh.triangles=GenerateTriangles(resolution);

[0083] GetComponent <meshfilter>().mesh = mesh;

[0084] The GenerateGridVertices function generates the vertex coordinates of a two-dimensional grid with a specified resolution, and then constructs grid patches using the GenerateTriangles function.

[0085] In this example implementation, the base plane constitutes a reference plane for scene modeling, and its boundary can be completed by the user selecting or plotting points in the graphical interface, such as using mouse events to obtain the click coordinates and converting them into a set of boundary points in the world coordinate system.

[0086] Furthermore, based on the boundary point set, a set of mesh cells with unique identifiers (ObjectIDs) can be constructed. Each mesh cell is a three-dimensional spatial unit with a fixed topological relationship, such as a cube voxel, a hexahedral block, or an arbitrary polygonal mesh block. In this example embodiment, the unique identifier is generated using a hash function based on two-dimensional coordinates to ensure traceability and consistency of location in subsequent configuration and simulation processes.

[0087] In this example implementation, while constructing the set of grid cells, an extensible attribute field can be embedded in each grid cell. This field is maintained in key-value pair format, such as:

[0088]

[0089] Furthermore, the aforementioned attribute structure can be dynamically modified and bound to scripts during subsequent annotation operations. The `type` field represents its structural functional category, the `tags` field is used to attach labels to support region clustering, and `custom_attributes` is a collection of key-value pairs used to store information such as custom behavioral constraints or navigation costs.

[0090] Based on this exemplary embodiment, users can execute 3D modeling commands on selected mesh cells to draw obstacles through interactive operations. Obstacles can be represented as solid geometric shapes (such as cubes, cylinders, or complex polygons). Visualization and simulation of the blocking effect are achieved by overlaying corresponding Mesh objects within the spatial range of the mesh cell and binding their Collider components and rendering materials. Taking Unity as an example, a cube obstacle can be added as follows:

[0091] GameObject wall=GameObject.CreatePrimitive(PrimitiveType.Cube);

[0092] wall.transform.position=GetCellWorldPosition(cell_id);

[0093] wall.AddComponent <boxcollider>();

[0094] wall.GetComponent <renderer>().material=Resources.Load <material>("WallMaterial");

[0095] Next, after receiving the user's annotation operation, a specific boundary grid area can be identified as an entrance or an exit. In this exemplary embodiment, the determination principle of the entrance / exit object can be triggered based on conditions such as the edge position, the number of adjacent opening areas, the user's click behavior, etc.; its identification field can be written as role = "entrance" or role = "exit" in the scene object attribute structure, and visually distinguished by color, arrow or label in the 3D engine.

[0096] Finally, according to the area label settings selected by the user, the grid cells are divided into functional areas with different functional attributes. For example, the classification methods of functional areas can include but are not limited to exhibition areas, rest areas, circulation channels, safety exits, etc., and the division mechanisms can include forms such as checkboxes, area dragging, property panel modification, etc. The area label is bound to the zone_type or semantic_label in the grid cell attribute field to support the setting of the regional distribution of subsequent crowd behavior parameters.

[0097] Step S220: Receive the crowd behavior parameters set by the user based on the scene object set. The crowd behavior parameters include the number of people, entry strategy, speed distribution, and residence time distribution, and associate the crowd behavior parameters with the corresponding scene objects to generate parameter binding information.

[0098] In this exemplary embodiment, first, by screening all objects with the entrance attribute label in the scene object set, an entrance object set that can receive crowd strategy binding is determined. The entrance object is a structural unit located at the boundary in the 3D scene, corresponding to the boundary grid cell or a spatial block with an entrance function, and is represented as an object node with the type = "entrance" mark in the data structure. In the graphical user interface, the configuration panels of the entrance objects can be rendered one by one in a list manner. The configuration panels expose adjustable parameter fields such as the upper limit of the number of people, entry time window, batch interval, etc. Each field is connected to the backend state tree through two-way data binding to ensure the real-time synchronization of the interface and the parameter values.

[0099] After the backend receives the above fields, it first performs a numerical legality check on them. Taking the entry time window as an example, the field must be an ordered pair composed of two monotonically increasing real numbers, and satisfy 0 ≤ t_start < t_end ≤ T_total; where T_total is the total simulation duration. When the parameter passes the verification, in this exemplary embodiment, it is encapsulated into an entrance binding structure and a mapping relationship is established with the unique identifier of the entrance object. The structure can be in the following format:

[0100]

[0101]

[0102] Here, `batch_interval` represents the interval (in seconds) between the generation of each batch of people, used to control the discreteness and intermittency of the generation of people. This structure is inserted into the global parameter binding information (ParameterBindingSet) to identify the entry strategy corresponding to different entry objects in the form of key-value pairs.

[0103] Furthermore, in this example implementation, default parameters for velocity distribution and dwell time distribution are provided through a preset data template. The template can be located in the global directory of the configuration module and represented by a standard mathematical distribution function. For example, it can be as follows:

[0104]

[0105] In this example implementation, the speed distribution follows a normal distribution, for example, with a mean μ of 1.2 m / s and a standard deviation σ of 0.25 m / s; the dwell time follows an exponential distribution with λ of 0.05, meaning the average dwell time is approximately 20 seconds. Users can modify these parameters using sliders, forms, or graphical tools (such as a distribution curve adjuster). In this example implementation, a data observer pattern can be used to continuously monitor modification actions and trigger a backend event update of the corresponding field in the state tree upon completion of the modification.

[0106] After the user completes the speed and dwell time settings, the parameter object binding process can begin. In this example implementation, objects with channel semantics are first extracted from the scene object set, which can be represented by objects with the tag "type="corridor". For each channel object, a speed distribution binding entry can be generated based on its unique identifier object_id. Similarly, for functional area objects with the tag "type="zone", the user-selected dwell time distribution parameter can be bound to them to form a dwell time mapping table. In this example implementation, the object-level parameter pairing mapping table, together with the entry strategy structure, constitutes complete parameter binding information, and after verifying the structural correctness via JSON Schema, it is persistently written to the database or cache.

[0107] Further, after completing the initial binding of population quantity and behavior distribution parameters, a unified parameter verification mechanism can be carried out in this exemplary embodiment to ensure the consistency and executability of all input parameters in terms of logic and data structure. The verification mechanism can be implemented based on a predefined set of parameter rules, which includes but is not limited to the following categories:

[0108] Numerical range constraint: For example, the upper limit of the population quantity max_agents must be a positive integer and not exceed the global maximum agent number threshold N_global_max; Legitimacy of the time window: The entry time window should satisfy t_start < t_end and be within the total simulation duration; Consistency of distribution functions: Each distribution function must specify the distribution type (such as "normal", "exponential", "uniform"), and its parameter structure must match the expected format of this type. For example, the normal distribution must contain mu and sigma, and the exponential distribution must contain lambda. Furthermore, the completeness of its fields can be verified through schema matching at the backend.

[0109] To implement the above verification, a structure verification method based on JSON Schema can be adopted in this exemplary embodiment, and combined with assertions (assert) and try-except exception handling mechanisms in runtime Python code to achieve double consistency verification at the semantic layer and the structure layer. If the parameters are illegal, the front end will receive a clear field error prompt and highlight the illegal fields to guide the user to correct them.

[0110] Further, in some exemplary embodiments, multiple entrances can also be divided into two categories: main entrances and auxiliary entrances, and different distribution strategies or quantity limits can be used respectively. In a specific implementation, the parameter binding system can introduce an object tag set (TagSet) mechanism, thereby allowing multiple objects to share a type of semantic tag and binding parameter templates based on this unit. The specific structure is as follows for example:

[0111]

[0112]

[0113] In this exemplary embodiment, when generating the binding mapping, the above structure can be expanded in the direction from tags to object sets to parameters in sequence, and the many-to-one parameter binding operation for all objects can be completed to avoid redundant repeated editing.

[0114] Furthermore, the template mechanism in this example implementation can be designed as a cascadable inheritance structure, allowing parameter definitions to override each other at the global, category, and object levels. The priority is object level > category level > global level. For example, if a functional area does not have a defined dwell time distribution, it can automatically fall back to its corresponding category definition; if that also fails, the global default template is used. This mechanism avoids the tediousness of explicitly specifying parameters across all scenarios, improving efficiency and maintainability.

[0115] After object binding is complete, this example implementation can perform a unified structure archiving operation on all parameter binding information, integrating the entry strategy table, channel-speed distribution table, area-stay time table, and tag inheritance relationship table into a standardized data structure. This structure uses the scene object identifier as the primary key and the distribution function and time strategy as fields, and can be structured as follows:

[0116]

[0117] Step S230: Invoke the configuration generation module to generate a configuration file compatible with the open-source crowd simulation framework based on the set of scene objects and the parameter binding information. The configuration file includes structured data describing the relationship between the spatial attributes of the scene objects and the crowd behavior parameters.

[0118] In this example implementation, the generation module is first configured to call a data interface from the front-end environment or middleware service upon startup to extract the scene object set constructed in step S210. The scene object set is stored in a directed graph structure in a temporary cache or project data directory. Its node set represents physical space elements (such as obstacles, entrances, functional areas, etc.), and its edge set represents spatial connectivity. Each node object includes, but is not limited to, the following fields:

[0119]

[0120]

[0121] The geometry field defines the geometric boundary information of the scene object. In this example implementation, it is a sequence of two-dimensional coordinate points, representing the boundary of a polygon or polyline. When the object type is an obstacle or a wall, a voxel mesh or a bounding box structure can also be used. The specific structure is set according to the analytical capability of the simulation framework.

[0122] Next, this example implementation reads the behavior parameter field corresponding to the object identifier from the parameter binding information generated in step S220. This process is completed by matching the primary key (object_id). After a successful match, the object behavior structure shown below is formed:

[0123]

[0124] The above structure indicates that the user has set an exponential dwell time distribution for the functional area numbered zone_B, with a parameter λ of 0.04, corresponding to an expected dwell time of 25 seconds. If an object is not bound to a specific behavior parameter, you can look up its category tag or fall back to the global default template to populate it.

[0125] Next, a preset data structure template can be read. This template is a standardized description file for configuring generation rules, defining the field structure, type constraints, required fields, and field order required by the simulation framework. Taking the Menge simulation framework as an example, its configuration file can contain the following module fields:

[0126] environment: used to describe the spatial definition of obstacles, areas, and passages; agents: used to describe agent attributes, such as movement model, speed distribution, and target selection strategy; events: used to describe crowd generation strategy, entry schedule, etc.

[0127] In this example implementation, the configuration generation module can utilize the template to perform field parsing and logical mapping on the scene object set and parameter binding information. During the mapping process, the configuration generation module first parses the geometry and type fields in the scene objects, identifies the spatial semantics they represent (such as wall, gate, obstacle), and then calls the field insertion function to populate them into the environment module of the target structure. For the behavior parameters, values ​​such as speed distribution and dwell time distribution can be inserted into the corresponding object structure using object_id as the index. In addition, if the parameters are non-standard distributions (such as user-uploaded custom sampling distributions), they can be discretely sampled and interpolated for reconstruction, and the distribution nodes can be inserted in tabular form. After the structure is populated, the configuration generation module can combine all modules into a unified document object model (DOM) and call the encoder for formatted output.

[0128] Furthermore, after completing the initial field filling and structured coding, in order to enhance the applicability and reusability of the configuration file across multiple scenarios and simulation frameworks, in this example implementation, the configuration generation module can use a template inheritance mechanism to achieve layer-by-layer coverage and local overloading of parameter templates based on the inheritance tree construction method, thereby allowing developers or advanced users to preset multi-level templates and automatically match them according to object type and tags.

[0129] For example, a template tree structure can be as follows:

[0130]

[0131] In the above structure, the `zone.gallery` template inherits from `corridor`, and `corridor` inherits from `default`. Each layer only needs to declare newly added or overridden fields. In this example implementation, when generating the configuration, the template chain can be parsed from bottom to top, and the fields at each level can be merged into the final configuration body, thereby ensuring that all necessary fields are defined.

[0132] Furthermore, considering the inconsistencies in configuration file structure and parameter semantics among different open-source simulation frameworks (such as Menge, uCrowds, and MassMotionCommunity), the configuration generation module in this example implementation also includes a multi-backend adapter strategy. Specifically, all scene objects and parameter binding information are first standardized and converted into an intermediate representation (IR) structure. Each object node in this IR structure has a unified field name (such as position, tags, behavior_model, distribution, etc.). For example:

[0133]

[0134] Subsequently, the configuration generation module loads the corresponding adapter based on the target simulation framework selected by the user during the task initialization phase. Each adapter implements a set of field mapping rules, output templates, and an encoder, translating the intermediate structure into the final configuration file supported by the framework. Adapters are dynamically scheduled through a strategy registry, enabling hot-swappable expansion and cross-version compatibility.

[0135] Step S240: Input the configuration file into the open-source crowd simulation framework, perform simulation calculations of crowd proxy behavior, and generate trajectory data corresponding to the configuration file.

[0136] In this example implementation, the simulation system first calls a locally deployed open-source crowd simulation framework instance during the loading phase. The simulation framework can be Menge, uCrowds, Vadere, or other proxy model computing systems with programmable scheduling interfaces. The configuration file can contain scene topology, input parameters, crowd generation strategies, and proxy attribute settings. Upon startup, the simulation framework performs syntax validation, path parsing, and memory structure mapping operations on this file, and outputs logs to the console and log files.

[0137] After the simulation starts, the simulation system can schedule the generation of simulation agents according to the crowd generation strategy defined in the configuration file, and assign a unique agent ID to each agent object. The ID can be an auto-incrementing integer sequence, for example:

[0138] AgentID = {0, 1, 2, ..., N-1}

[0139] Where N represents the total number of agents actually generated in the simulation. To avoid conflicts and duplication, this example implementation can also maintain a globally unique ID allocator in the agent generation module and allocate them in the following way:

[0140] unsignedint nextAgentID=0;

[0141] Agent*newAgent=new Agent(nextAgentID++);

[0142] Furthermore, after the simulation agents are generated, in each simulation time step (i.e., tick), the system performs a state update operation on all active agents, updating their two-dimensional spatial position, velocity, and goal state. The simulation time step Δt is a configurable parameter, which can be 0.1 seconds or 0.05 seconds to balance accuracy and computational efficiency. At each tick, the system calls the agent behavior model to calculate the position update.

[0143] P i (t+Δt)=P i (t)+V i (t)·Δt

[0144] Among them, P i (t) represents the position of agent i at time t, V i (t) is its velocity vector. The velocity vector is calculated by the behavior model (such as Social Forces, ORCA, Velocity Obstacle, etc.) bound to the agent, and combined with the states of other agents and obstacles in the local neighborhood for obstacle avoidance and navigation.

[0145] After each time step is completed, the simulation system samples and records the location information of all agents. The recorded data structure is as follows:

[0146]

[0147] In this example implementation, the simulation system stores this structure in a trajectory buffer pool. The trajectory buffer pool establishes a hash mapping table with the agent ID as the primary key, and maintains an array of time-series coordinates for each agent.

[0148]

[0149] The above process continues until the simulation termination condition is triggered. For example, the termination condition may include all agents reaching the target region, the simulation time exceeding the maximum allowable value T_max, or the system detecting a non-convergent state in the simulation. When the simulation process ends, the simulation system can call the trajectory writing module to perform structured organization and persistent output of the above trajectory buffer pool.

[0150] In the exemplary embodiment of this application, the crowd simulation and spatial layout optimization method based on an open-source engine creates and edits scene data with structural attributes in an interactive interface built by the 3D engine, and maps it to a set of scene objects with labels. This allows elements such as spatial boundaries, obstacles, and functional areas to be distinguished and managed in a structured manner during the modeling stage, thus ensuring clear object reference relationships for subsequent behavior parameter settings and configurations. Based on this, behavior parameters such as crowd size, entry strategy, speed distribution, and dwell time distribution are bound to scene elements according to the object dimension, and a structured configuration file is generated using the parameter binding information as input. This ensures consistency of cross-module data structures and avoids format errors and mapping conflicts caused by manual configuration from the source. Furthermore, when the configuration file is input into the open-source simulation framework and triggers agent behavior calculation, the configuration data already contains complete spatial structure and parameter relationships, allowing the simulation process to run in a logical closed loop. This maintains data integrity while reducing reliance on professional configuration experience. This enables the completion of spatial modeling, parameter setting, and behavioral simulation using reusable data structures in application scenarios lacking professional engineering background, avoiding the problems of complex configuration interfaces, rough object definitions, and difficulty in ensuring data consistency in existing technologies.

[0151] This example implementation also provides a crowd simulation and spatial layout optimization system based on an open-source engine. (See reference...) Figure 4 As shown, the crowd simulation and spatial layout optimization system 400 may include a 3D scene construction module 410, a parameter acquisition module 420, a configuration generation module 430, and a simulation calculation module 440. Wherein:

[0152] The 3D scene construction module 410 is configured to receive user input in the interactive interface built by the 3D engine, create and edit 3D scene data representing physical space boundaries, obstacles, entrances, exits and functional areas, and map the 3D scene data into a set of scene objects with identification attributes;

[0153] The parameter acquisition module 420 is configured to receive user-defined crowd behavior parameters based on the set of scene objects. The crowd behavior parameters include the number of people, entry strategy, speed distribution, and dwell time distribution. The module also associates the crowd behavior parameters with the corresponding scene objects to generate parameter binding information.

[0154] The configuration generation module 430 is configured to generate a configuration file compatible with the open-source crowd simulation framework based on the set of scene objects and the parameter binding information. The configuration file includes structured data describing the relationship between the spatial attributes of the scene objects and the crowd behavior parameters.

[0155] The simulation calculation module 440 is configured to input the configuration file into the open-source crowd simulation framework, perform simulation calculations of crowd proxy behavior, and generate trajectory data corresponding to the configuration file.

[0156] The specific details of each module of the crowd simulation and spatial layout optimization system based on the open source engine have been described in detail in the corresponding crowd simulation and spatial layout optimization method based on the open source engine, so they will not be repeated here.

[0157] Exemplary embodiments of this disclosure also provide a computer-readable storage medium having a program product stored thereon capable of implementing the methods described above in this specification. In some possible embodiments, various aspects of this disclosure may also be implemented as a program product including program code that, when the program product is run on an electronic device, causes the electronic device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.

[0158] The program product may be a portable compact disc read-only memory (CD-ROM) and include program code, and may run on an electronic device, such as a personal computer. However, the program product disclosed herein is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0159] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0160] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0161] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0162] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C#, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0163] Furthermore, exemplary embodiments of this disclosure also provide an electronic device capable of implementing the above-described crowd simulation and spatial layout optimization method based on an open-source engine.

[0164] The following reference Figure 5 To describe an electronic device 500 according to such an embodiment of the present disclosure. Figure 5 The electronic device 500 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0165] like Figure 5 As shown, the electronic device 500 is manifested in the form of a general-purpose computing device. The components of the electronic device 500 may include, but are not limited to: at least one processing unit 510, at least one storage unit 520, a bus 530 connecting different system components (including storage unit 520 and processing unit 510), and a display unit 540.

[0166] Storage unit 520 stores program code that can be executed by processing unit 510, causing processing unit 510 to perform the steps described in the "Exemplary Methods" section above according to various exemplary embodiments of this disclosure. For example, processing unit 510 can perform method steps in exemplary embodiments of this disclosure.

[0167] Storage unit 520 may include readable media in the form of volatile storage units, such as random access memory (RAM) 521 and / or cache memory (Cache) 522, and may further include read-only memory (ROM) 523.

[0168] Storage unit 520 may also include a program / utility 524 having a set (at least one) program module 525, such program module 525 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0169] Bus 530 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0170] Electronic device 500 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 500, and / or with any device that enables electronic device 500 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 550. Furthermore, electronic device 500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 560. As shown, network adapter 560 communicates with other modules of electronic device 500 via bus 530. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0171] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0172] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0173] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0174] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0175] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.< / material> < / renderer> < / boxcollider> < / meshfilter>

Claims

1. A method for crowd simulation and spatial layout optimization based on an open-source engine, characterized in that, include: The system receives user input in the interactive interface built by the 3D engine, creates and edits 3D scene data representing physical space boundaries, obstacles, entrances, exits and functional areas, and maps the 3D scene data into a set of scene objects with identification attributes. Based on the set of scene objects, the system receives user-defined crowd behavior parameters, including crowd size, entry strategy, speed distribution, and dwell time distribution, and associates these crowd behavior parameters with the corresponding scene objects to generate parameter binding information. The configuration generation module is invoked to generate a configuration file compatible with the open-source crowd simulation framework based on the set of scene objects and the parameter binding information. The configuration file includes structured data describing the relationship between the spatial attributes of the scene objects and the crowd behavior parameters. The configuration file is input into the open-source crowd simulation framework to perform simulation calculations of crowd proxy behavior and generate trajectory data corresponding to the configuration file.

2. The method according to claim 1, characterized in that, The process of receiving user input in the interactive interface built by the 3D engine, and creating and editing 3D scene data representing physical space boundaries, obstacles, entrances, exits, and functional areas, includes: The 3D engine calls the mesh editing plugin to load the base plane and receives user input to define the boundary coordinates of the base plane; A set of grid cells with unique identifiers is generated based on the boundary coordinates, and an extensible attribute field that supports subsequent annotation is embedded in the set of grid cells. A grid cell is selected based on the user's interaction actions, and a three-dimensional geometric model representing the obstacle is drawn in the selected grid cell; Receive user annotation operations and mark the specified boundary grid area as the entrance or exit; Based on the region label settings selected by the user, the grid cells are divided into functional regions with different functional attributes.

3. The method according to claim 1, characterized in that, The step of receiving user-defined crowd behavior parameters based on the set of scene objects and associating the crowd behavior parameters with the corresponding scene objects to generate parameter binding information includes: Receive a set of parameters input by the user, representing the number of people and the entry strategy, and establish a mapping relationship between the set of parameters and the entry object; The system retrieves the default speed distribution and dwell time distribution templates in the graphical interface and receives user adjustments to the template values. The adjusted speed distribution and dwell time distribution data are respectively bound to the channel object and functional area object in the scene object; The above mapping and binding relationships are merged to generate the parameter binding information, and stored as a data structure that the configuration generation module can recognize.

4. The method according to claim 3, characterized in that, in: The process of receiving a set of parameters representing the number of people and the entry strategy from user input, and establishing a mapping relationship between the parameter set and the entry object, includes: Display the property panel of all entry objects in the graphical interface; Receive user input regarding the maximum number of people and the entry time window for each entry point; Write the maximum number of people and the entry time window parameters into the configuration fields of the corresponding entry object; Generate a data structure describing the entry-parameter mapping relationship and store the parameter binding information; The step of binding the adjusted speed distribution and dwell time distribution data to the channel object and functional area object in the scene object, respectively, includes: The unique identifiers of the channel object and the functional area object are parsed; Pair the velocity distribution parameters with the identifier of the channel object; Pair the dwell time distribution parameters with the identifiers of the functional area objects; Record the pairing relationship and update it in the parameter binding information.

5. The method according to claim 1, characterized in that, The configuration generation module generates a configuration file compatible with the open-source crowd simulation framework based on the scene object set and the parameter binding information, including: Extract the geometric topology and object identification fields contained in the scene object set; Extract the behavior parameter values ​​corresponding to each object identifier field from the parameter binding information; Based on the preset data structure template, the geometric topology and the behavioral parameter values ​​are filled into the corresponding fields; The populated structured data is encoded into XML or JSON format to generate the configuration file.

6. The method according to claim 5, characterized in that, The step of filling the geometric topology and behavioral parameter values ​​into the corresponding fields according to the preset data structure template includes: Read the field definitions related to scene objects and behavior parameters from the data structure template; Analyze the coordinate boundaries, connectivity relationships, and type fields in the scene object collection; Parse the distribution parameters and quantity parameters in the parameter binding information; According to the field definition rules, fill the coordinate boundaries, connection relationships, distribution parameters, and quantity parameters into the corresponding field positions.

7. The method according to claim 1, characterized in that, The step of inputting the configuration file into the open-source crowd simulation framework, performing simulation calculations of crowd proxy behavior, and generating trajectory data corresponding to the configuration file includes: Invoke the execution process of the locally deployed open-source crowd simulation framework and load the configuration file into the input interface of the simulation framework; The simulation process is executed to generate motion trajectories for multiple simulation agents, and a unique agent identifier is assigned to each simulation agent. Record the two-dimensional position coordinates of each simulation agent in each simulation time step, and bind the two-dimensional position coordinates with the corresponding timestamp; Using the agent identifier as an index, the bound timestamp and two-dimensional coordinate sequence are organized to generate a trajectory log file, which is then written to local storage.

8. A crowd simulation and spatial layout optimization system based on an open-source engine, characterized in that, include: The 3D scene construction module is configured to receive user input in the interactive interface built by the 3D engine, create and edit 3D scene data representing physical space boundaries, obstacles, entrances, exits and functional areas, and map the 3D scene data into a set of scene objects with identification attributes; The parameter acquisition module is configured to receive user-defined crowd behavior parameters based on the set of scene objects. The crowd behavior parameters include the number of people, entry strategy, speed distribution, and dwell time distribution. The module also associates the crowd behavior parameters with the corresponding scene objects to generate parameter binding information. The configuration generation module is configured to generate a configuration file compatible with the open-source crowd simulation framework based on the set of scene objects and the parameter binding information. The configuration file includes structured data describing the relationship between the spatial attributes of the scene objects and the crowd behavior parameters. The simulation calculation module is configured to input the configuration file into the open-source crowd simulation framework, perform simulation calculations of crowd proxy behavior, and generate trajectory data corresponding to the configuration file.

9. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1-7 by executing the executable instructions.

10. A computer-readable storage medium having a computer object program stored thereon, characterized in that, When the computer target program is executed by the processor, it implements the method described in any one of claims 1-7.