Special effect generation method and device, electronic equipment, program product and storage medium
By dividing the special effect files into special effect definition files and special effect resource files, and allowing game developers to edit special effect components and parameters in the special effect definition files, the problems of poor special effect scalability and low development efficiency in the existing technology are solved, and the efficient expansion of special effect resources and the improvement of game development efficiency are achieved.
Patent Information
- Application Number
- CN202311379175.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-23
- Publication Date
- 2025-04-25
AI Technical Summary
When adding new special effects parameters or special effects components in the prior art, a large amount of code is required to write in the creation engine, UI layer and data reading layer, resulting in poor scalability of special effects and inefficient game development.
A special effect generation method is proposed, which divides the special effect file into a special effect definition file and a special effect resource file. The adjustable special effect components and special effect parameters in the special effect resource file are generated from the special effect definition file. Game developers can expand the special effect components and special effect parameters of the special effect resource file by editing the special effect definition file.
It improves the scalability of special effects resources and game development efficiency, simplifies the special effects development process, and reduces the time and energy of writing code.
Smart Images

Figure CN119868934A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a special effects production method, device, electronic device, program product and storage medium. Background Art
[0002] With the development of computer technology, games have gradually become an important form of entertainment in life. In general, a large number of special effects need to be added to the game scenes.
[0003] In the related art, users use the Unity creation engine to edit the parameter values of various parameters of special effects. After editing, users can save the edited special effects to special effect files and load them directly from the special effect files the next time they are used. However, when adding new special effect parameters or special effect components, this method requires writing a large amount of code for displaying UI and reading parameters in the creation engine, UI (User Interface) layer, and data reading layer, resulting in poor scalability of special effects and low game development efficiency. Summary of the invention
[0004] The embodiments of the present application provide a special effect production method, device, electronic device, program product and storage medium, which can improve the scalability of special effect resources and improve game development efficiency.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application provides a method for generating special effects, the method comprising:
[0007] In response to the received game start request, a plurality of special effect definition files corresponding to the game are obtained;
[0008] Loading the plurality of special effect definition files, wherein the special effect definition files include component identifiers of special effect components and default values of special effect parameters;
[0009] During the running of the game, in response to a request for generating a target special effect, a target special effect resource file corresponding to the target special effect is obtained;
[0010] Loading the target special effect resource file, wherein the target special effect resource file includes a component identifier of a target special effect component and a parameter value of a first special effect parameter corresponding to the target special effect component, wherein the parameter value of the first special effect parameter is obtained by editing the first special effect parameter in a target special effect definition file corresponding to the target special effect component;
[0011] The target special effect is generated based on the special effect definition file and the target special effect resource file.
[0012] An embodiment of the present application provides a special effect generation device, including: a definition file acquisition module, which is used to respond to a received game startup request and obtain multiple special effect definition files corresponding to the game; a definition file loading module, which is used to load the multiple special effect definition files, wherein the special effect definition file includes a component identifier of the special effect component and a default value of a special effect parameter; a resource file acquisition module, which is used to respond to a generation request for a target special effect during the running of the game and obtain a target special effect resource file corresponding to the target special effect; a resource file loading module, which is used to load the target special effect resource file, wherein the target special effect resource file includes a component identifier of the target special effect component and a parameter value of a first special effect parameter corresponding to the target special effect component, wherein the parameter value of the first special effect parameter is obtained by editing the first special effect parameter in the target special effect definition file corresponding to the target special effect component; and a special effect generation module, which is used to generate the target special effect based on the target special effect definition file and the target special effect resource file.
[0013] In some embodiments, the special effect generation module is also used to obtain a second special effect parameter from the target special effect definition file, where the second special effect parameter is a special effect parameter that does not exist in the target special effect resource file; determine the default value of the second special effect parameter in the target special effect definition file as the parameter value of the second special effect parameter; and generate the target special effect based on the parameter value of the first special effect parameter and the parameter value of the second special effect parameter.
[0014] In some embodiments, the special effect generating device also includes a definition file generating module, which is used to obtain the component identification of the special effect component, the special effect parameters corresponding to the special effect component and the default values of the special effect parameters in response to the creation operation of the special effect definition file for the special effect component; determine the special effect parameter group based on the parameter category to which the special effect parameters belong; the special effect parameters in the special effect parameter group have the same parameter category; and generate a special effect definition file corresponding to the special effect component based on the component identification of the special effect component, the special effect parameter group and the default values of the special effect parameters.
[0015] In some embodiments, the definition file generation module is also used to obtain the parent-child relationship between the special effect parameter groups; based on the parent-child relationship between the special effect parameter groups, obtain the name of the parent parameter group to which the special effect parameter group belongs; based on the component identifier of the special effect component, the special effect parameter group, the name of the parent parameter group to which the special effect parameter group belongs, and the default value of the special effect parameter, generate a special effect definition file corresponding to the special effect component.
[0016] In some embodiments, the special effect generating device also includes a definition file editing module, which is used to obtain the special effect parameters to be added and the default values of the special effect parameters to be added in response to the parameter addition operation on the special effect definition file; obtain the parameter category to which the special effect parameters to be added belong; based on the parameter category to which the special effect parameters to be added belong, add the special effect parameters to be added and the default values of the special effect parameters to be added to the corresponding special effect parameter group to obtain the edited special effect definition file.
[0017] In some embodiments, the definition file editing module is also used to obtain special effect parameters to be added; when the special effect parameters to be added are special effect identifiers, obtain the file path of the special effect resource file corresponding to the special effect identifier; and determine the character string corresponding to the file path as the default value of the parameter to be added.
[0018] In some embodiments, the special effect generating device also includes a resource file generating module, which is used to obtain at least one special effect definition file required for the special effect to be created from multiple special effect definition files corresponding to the game in response to a received special effect creation request; load at least one special effect definition file required for the special effect to be created, and display the special effect parameters in the special effect definition file; in response to a received parameter editing operation for at least one of the special effect parameters, obtain the modified parameter value of the special effect parameter; in response to a received parameter saving request, generate a special effect resource file corresponding to the special effect to be created based on the modified parameter value of the special effect parameter.
[0019] In some embodiments, the resource file generation module is also used to obtain the special effect start time and special effect end time of the special effect component in response to a received parameter saving request; obtain the parameter path of the special effect parameter corresponding to the special effect component; the parameter path is used to characterize the special effect parameter group to which the special effect parameter belongs; based on the component identifier of the special effect component, the special effect start time and special effect end time of the special effect component, and the modified parameter value and parameter path of the special effect parameter corresponding to the special effect component, generate the special effect resource file corresponding to the special effect to be created.
[0020] An embodiment of the present application provides an electronic device, the electronic device comprising:
[0021] A memory for storing computer executable instructions;
[0022] The processor is used to implement the special effect generation method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0023] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the special effect generation method provided in the embodiment of the present application when executed by a processor.
[0024] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, the special effect generation method provided in the embodiment of the present application is implemented.
[0025] The embodiments of the present application have the following beneficial effects:
[0026] After the game is started, the embodiment of the present application generates a target special effect in the game by loading all the special effect definition files and the target special effect resource files corresponding to the target special effect into the game. Among them, the special effect definition file includes the component identification of the special effect component and the default value of the special effect parameter. The target special effect resource file includes the component identification of the target special effect component and the parameter value of the first special effect parameter corresponding to the target special effect component. The parameter value of the first special effect parameter is obtained by editing the first special effect parameter in the target special effect definition file corresponding to the target special effect component. The game developer can edit the special effect component and the related special effect parameters in the target special effect definition file to modify the first special effect parameter in the target special effect resource file, and then change the target special effect corresponding to the target special effect resource file. It can be seen that compared with the special effect file in the traditional technology, the embodiment of the present application provides a new game special effect resource format, which divides the traditional special effect file into a special effect definition file and a special effect resource file. The adjustable special effect components and special effect parameters in the special effect resource file are generated from the special effect definition file, and the special effect components and special effect parameters of the special effect resource file can be easily expanded by editing the special effect definition file, thereby improving the efficiency of game development. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of the interface of the Unity editor in the related art;
[0028] Figure 2 It is a structural diagram of the special effects generation system architecture provided in an embodiment of the present application;
[0029] Figure 3 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0030] Figure 4A It is a flowchart of a special effect generation method provided in an embodiment of the present application;
[0031] Figure 4B It is a flowchart of a special effect generation method provided in an embodiment of the present application;
[0032] Figure 5A It is a flowchart of a special effect generation method provided in an embodiment of the present application;
[0033] Figure 5BIt is a flowchart of a special effect generation method provided in an embodiment of the present application;
[0034] Figure 5C It is a flowchart of a special effect generation method provided in an embodiment of the present application;
[0035] Figure 5D It is a flowchart of a special effect generation method provided in an embodiment of the present application;
[0036] Figure 6 This is an example diagram showing the special effect parameters of the editor interface provided in the embodiment of the present application;
[0037] Figure 7 It is a schematic diagram of special effects generated after the special effects provided in the embodiment of the present application are reused;
[0038] Fig. 8A It is a flowchart of a special effect generation method provided in an embodiment of the present application;
[0039] Figure 8B It is a flowchart of a special effect generation method provided in an embodiment of the present application;
[0040] Fig. 9 This is an example diagram of the editor interface provided in the embodiment of the present application;
[0041] Fig.10 This is an example diagram of special effects developed by the special effects generation system provided in the embodiment of the present application;
[0042] Fig.11 It is a flowchart of the special effects generation method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0044] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0045] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0046] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0047] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0048] 1) Rendering: Also known as drawing, it refers to the process of displaying three-dimensional scenes and objects on the screen through a series of program algorithms in the game.
[0049] 2) Simulation: A computer program that simulates the process of a phenomenon changing over time. Common examples include simulations of force changes, water flow, wind fields, etc.
[0050] 3) Model: A static resource that can be used to represent various three-dimensional objects in the game. Generally, models without animation are static.
[0051] 4) Texture: In games, texture refers to 2D (2-dimension) images that add color, texture, lighting and other effects to the surface of 3D (3-dimension) models. Textures can make objects in the game look more realistic and detailed, and enhance the visual effects of the game.
[0052] 5) Effect: An art resource in the game, used to express various special visual effects in the game, such as flames, smoke, lightning, knife light, etc. Special effect resources are often based on a combination of model resources, texture resources, and various rendering, simulation algorithms and parameters. Compared with models, special effects are more dynamic and bring more shocking effects. Special effect resources are widely used in various games.
[0053] 6) Particle System: Also known as particle emitter, particle system is a technology widely used in computer graphics and game development. The core of particle system is particles. Each particle is an independent object with its own properties, such as position, speed, life cycle, color, size, etc. Particle system can generate special effects to simulate natural phenomena in various games, such as fire, smoke, flowing water, etc.
[0054] 7) Serialization / deserialization: Serialization refers to the technology of converting game objects, data structures, etc. into binary or text format for easy storage, transmission and loading. Deserialization, on the contrary, refers to the technology of loading resource files into game objects or related data structures.
[0055] 8) Unity: is a creative engine and platform for real-time 3D interactive content creation. The Unity platform provides a complete set of software solutions that can be used to create, operate and monetize any real-time interactive 2D and 3D content, supporting platforms including mobile phones, tablets, game consoles, augmented reality and virtual reality devices.
[0056] Users generally use Unity to edit the parameter values of various special effect parameters to obtain special effect resources. Special effects in Unity are mainly divided into three categories: particles, ribbons, and lines. Figure 1 It is the display interface of the particle effects module in the Unity editor. Figure 1 As shown in the figure, game developers can edit the parameter values of various special effect parameters of particles (such as position, speed, life cycle, color, size, etc.) on the right panel, and preview the adjusted special effect visual performance in the editor scene interface on the left. After editing the parameter values, game developers can save the edited special effects to the special effect file and load it directly from the special effect file next time. The use and editing of special effects such as strips and segments is similar to the editing process of the above particle special effects.
[0057] Although Unity can be used to create and edit special effects, there are still the following problems: (1) Poor scalability. Game developers can only edit the parameter values of various special effect parameters (such as position, speed, life cycle, color, size, etc.) of special effect components on the right panel of Unity, but cannot edit which special effect parameters and special effect components are contained in the special effect file. If a game developer wants to add new special effect parameters and special effect components to a special effect file (for example, if he wants to add a new component type to particles, strips, and segments), in addition to writing the code to implement this function in the creation engine (this code is indispensable), he also needs to write a large amount of code for displaying UI and reading special effect parameters in the UI layer and data reading layer, which wastes a lot of time and energy. (2) Poor reusability. After a game developer creates a special effect file, the special effect file can only be used to generate the corresponding special effect in the game and cannot be reused in other special effect files. For example, suppose in a particle special effect, it is planned to make the particles it emits reference the special effect loaded by another special effect file. This cannot be achieved with the above method and a new special effect file needs to be created to achieve this.
[0058] Based on at least one of the above-mentioned problems existing in the related technology, an embodiment of the present application provides a new game special effect resource format, which divides traditional special effect files into special effect definition files and special effect resource files. The adjustable special effect components and special effect parameters in the special effect resource files are generated from the special effect definition files. Game developers can very conveniently expand the special effect components and special effect parameters of the special effect resource files by editing the special effect definition files, thereby improving the efficiency of game development.
[0059] The embodiments of the present application provide a special effect production method, device, electronic device, program product and storage medium, which can improve the scalability of special effect resources and improve the efficiency of game development. The exemplary application of the electronic device provided by the embodiments of the present application is described below. The electronic device provided by the embodiments of the present application can be implemented as a laptop, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), a smart phone, a smart speaker, a smart watch, a smart TV, a vehicle-mounted terminal and other types of user terminals, and can also be implemented as a server. Below, an exemplary application when the electronic device is implemented as a terminal or a server will be described.
[0060] See also Figure 2 , Figure 2 It is an optional architecture diagram of the special effect generation system provided in the embodiment of the present application. In order to realize supporting any game application (or game special effect generation application), the special effects in the game are generated by the game application, thereby enriching the game scene during the game operation. At least the game application is installed on the terminal of the embodiment of the present application. The special effect generation system 10 includes at least a terminal 100, a network 200 and a server 300, wherein the server 300 is a server of the game application. The server 300 can constitute the electronic device of the embodiment of the present application, that is, the special effect generation method of the embodiment of the present application is implemented by the server 300. The terminal 100 is connected to the server 300 via the network 200, and the network 200 can be a wide area network or a local area network, or a combination of the two.
[0061] When generating special effects in the game, the user can trigger the game start operation through the game application running on the terminal 100, and the terminal 100 generates a game start request in response to the game start operation, and sends the game start request to the server 300 through the network 200. After receiving the game start request, the server 300 responds to the game start request to obtain multiple special effect definition files corresponding to the game; loads multiple special effect definition files, and the special effect definition files include the component identification of the special effect component and the default value of the special effect parameter; during the game running process, in response to the generation request for the target special effect, obtains the target special effect resource file corresponding to the target special effect; loads the target special effect resource file, and the target special effect resource file includes the component identification of the target special effect component and the parameter value of the first special effect parameter corresponding to the target special effect component, and the parameter value of the first special effect parameter is obtained by editing the first special effect parameter in the target special effect definition file corresponding to the target special effect component; generates the target special effect based on the special effect definition file and the target special effect resource file. At the same time, after obtaining the target special effect, the server 300 can also send the target special effect to the terminal 100, and the terminal 100 displays the target special effect on the game interface.
[0062] In some embodiments, the terminal 100 can also execute the special effect generation method of the embodiment of the present application, that is, after the user initiates the game startup operation through the game application running on the terminal 100, the terminal 100 obtains multiple special effect definition files corresponding to the game in response to the game startup operation; loads multiple special effect definition files; during the game running process, the terminal 100 responds to the generation request for the target special effect and obtains the target special effect resource file corresponding to the target special effect; the terminal 100 loads the target special effect resource file, the target special effect resource file includes the component identifier of the target special effect component, and the parameter value of the first special effect parameter corresponding to the target special effect component, the parameter value of the first special effect parameter is obtained by editing the first special effect parameter in the target special effect definition file corresponding to the target special effect component; the target special effect is generated based on the special effect definition file and the target special effect resource file.
[0063] In some embodiments, the server 300 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal 100 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a car terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
[0064] See also Figure 3 , Figure 3 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 3 The electronic device shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the electronic device are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 3 Various buses are labeled as bus system 440 .
[0065] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0066] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0067] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0068] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0069] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0070] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0071] A network communication module 452, used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;
[0072] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);
[0073] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.
[0074] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 3 The special effect generating device 455 stored in the memory 450 is shown, which can be software in the form of a program and a plug-in, etc., and includes the following software modules: a definition file acquisition module 4551, a definition file loading module 4552, a resource file acquisition module 4553, a resource file loading module 4554 and a special effect generating module 4555. These modules are logical, and therefore can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0075] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the special effect generation method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (Application Specific Integrated Circuit, ASIC), digital signal processors (Digital Signal Processor, DSP), programmable logic devices (Programmable Logic Device, PLD), complex programmable logic devices (Complex Programmable Logic Device, CPLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other electronic components.
[0076] The special effects generation method provided in each embodiment of the present application can be executed by an electronic device, wherein the electronic device can be a server or a terminal, that is, the special effects generation method provided in each embodiment of the present application can be executed by a server, or by a terminal, or can be executed through interaction between a server and a terminal.
[0077] Figure 4A is a flow chart of the special effect generation method provided in the embodiment of the present application, which will be combined with Figure 4A The steps shown are explained as Figure 4A As shown, the execution subject of the special effect generation method is taken as an example to illustrate that the method includes the following steps S101 to S105:
[0078] Step S101, responding to a received game start request, obtaining a plurality of special effect definition files corresponding to the game.
[0079] In the embodiment of the present application, the special effect definition file is also called a Def (define) file. The special effect definition file is a parameter specification file that is created in advance and stored in the game directory. The special effect definition file is used to record the special effect components (Component) that can be used when creating special effects in the special effect system and the special effect parameters contained in each special effect component. The special effect component constitutes the visual expression of the special effect based on the motion trajectory of the special effect parameters in space. Each type of special effect component corresponds to a special effect definition file. After the user triggers the game startup operation, in response to the received game startup request, multiple special effect definition files corresponding to the game can be directly obtained from the game directory of the game.
[0080] Exemplarily, the special effect system of the game includes three types of special effect components: Particle component (responsible for emitting particles), Model component (responsible for displaying models), and Ribbon component (responsible for emitting strips). The game directory of the game includes three special effect definition files: special effect definition file a corresponding to the Particle component, special effect definition file b corresponding to the Model component, and special effect definition file c corresponding to the Ribbon component. In response to the received game start request, special effect definition file a, special effect definition file b, and special effect definition file c can be obtained from the game directory of the game.
[0081] Step S102, loading a plurality of special effect definition files, wherein the special effect definition files include component identifiers of special effect components and default values of special effect parameters.
[0082] In the embodiment of the present application, the special effect definition file is loaded by default when the game is started, and it works during the entire game running stage. As a text format file, the special effect definition file can be converted into a game object or a related data structure by deserialization technology and loaded into the game memory. The special effect definition file can include the component identification of the special effect component, the special effect parameters related to the special effect component, and the default values of the special effect parameters. The component identification of the special effect component is a unique identification used to distinguish the type of the special effect component, which can be directly represented by its type. For example, the component identification of the Particle component can be a particle. It should be noted that the component identification of the special effect component can also be represented in other ways, such as numbers, letters, etc., as long as the type of the special effect component can be distinguished. The special effect parameters corresponding to the special effect component are parameters that can be used by the special effect component, which are used to affect the properties of the special effect component in the special effect, such as position, speed, life cycle, color, size, etc. The default value of the special effect parameter is the parameter value entered when the special effect definition file is created.
[0083] The embodiment of the present application can automatically load the special effect definition file into the game memory through the deserialization technology, which can save the code work of parsing the special effect definition file part, simplify the special effect development process, save time and energy, and improve the efficiency of game development.
[0084] Step S103, during the running of the game, in response to a request for generating a target special effect, obtaining a target special effect resource file corresponding to the target special effect.
[0085] In the embodiment of the present application, the special effect resource file is a file used to define a specific special effect. The special effect resource file is created in advance and stored in the game directory. Each different special effect corresponds to a different special effect resource file. The storage location of the special effect resource file in the game directory is different from the storage location of the special effect definition file in the game directory. During the running of the game, as the user operates, the game scene in the game changes, which may trigger a request to generate a target special effect. In response to the request to generate a target special effect, the target special effect resource file corresponding to the target special effect can be directly obtained from the game directory of the game.
[0086] Step S104, load the target special effect resource file, the target special effect resource file includes the component identifier of the target special effect component and the parameter value of the first special effect parameter corresponding to the target special effect component, the parameter value of the first special effect parameter is obtained by editing the first special effect parameter in the target special effect definition file corresponding to the target special effect component.
[0087] In an embodiment of the present application, the target special effect resource file may include a component identifier of a target special effect component, a component name of the target special effect component, a first special effect parameter related to the target special effect component, and a parameter value of the first special effect parameter. The target special effect resource file may include at least one target special effect component, and each target special effect component may have a corresponding plurality of first special effect parameters. The target special effect components included in the target special effect resource file are all the special effect components required to generate the target special effect. The component identifier of the target special effect component is used to indicate the type of the target special effect component, such as "Particle particle". Multiple target special effect components may have the same component identifier. The component name of the target special effect component is used to distinguish each target special effect component, and its expression includes but is not limited to numbers, letters, etc. For any target special effect component, the component identifier in the target special effect definition file corresponding to the target special effect component is the same as the component identifier of the target special effect component. The first special effect parameter corresponding to the target special effect component may be all the special effect parameters in the target special effect definition file, or may be part of the special effect parameters. The first special effect parameter of the target special effect component is a special effect parameter obtained by editing the parameter value of at least one special effect parameter in the target special effect definition file corresponding to the target special effect component when creating the target special effect resource file. That is, the parameter value of the first special effect parameter in the target special effect resource file is different from its default value in the corresponding target special effect definition file.
[0088] Exemplarily, the target special effect resource file includes a target special effect component 1 and a target special effect component 2. Target special effect component 1 and target special effect component 2 are respective component names, and the component identifiers of target special effect component 1 and target special effect component 2 are both "Particle particle". The target special effect definition files corresponding to target special effect component 1 and target special effect component 2 are both special effect definition files a. The target special effect definition file includes two special effect parameters A and special effect parameter B. The default value of special effect parameter A is 0, and the default value of special effect parameter B is 1. When the target special effect resource file is created, only the parameter value of special effect parameter A of target special effect component 1 is edited to 1, and the parameter value of special effect parameter B of target special effect component 2 is edited to 0. Then the target special effect resource file only includes the first special effect parameter A corresponding to target special effect component 1, whose parameter value is 1; and the first special effect parameter B corresponding to target special effect component 2, whose parameter value is 0.
[0089] In some embodiments, the target special effect resource file is a text format file, and the target special effect resource file can be read into the data structure corresponding to the target special effect resource file in the game memory through deserialization technology. The content structure of the data structure corresponding to the target special effect resource file in the game memory is consistent with the content structure of the target special effect resource file. Each target special effect resource file includes at least one target special effect component and the start time and end time of each target special effect component of the target special effect. After the target special effect is loaded in the game, the start time and end time of the target special effect will have corresponding visual performance according to the difference between the target component and the corresponding first special effect parameter.
[0090] The embodiment of the present application can automatically load the target special effect resource file into the game memory through the deserialization technology, which can save the code work of parsing the target special effect resource file part, simplify the special effect development process, save time and energy, and improve the efficiency of game development.
[0091] Step S105 , generating a target special effect based on the target special effect definition file and the target special effect resource file.
[0092] In the embodiment of the present application, after loading the target special effect definition file and the target special effect resource file, the target special effect definition file corresponding to each target special effect component can be traversed for each target special effect component. Based on the default values of each special effect parameter in the target special effect definition file corresponding to each target special effect component and the reference value of the first special effect parameter corresponding to each target special effect component, the target special effect is generated.
[0093] Compared with the special effects files in traditional technologies, the embodiments of the present application provide a new game special effects resource format, which divides traditional special effects files into special effects definition files and special effects resource files. The adjustable special effects components and special effects parameters in the special effects resource files are generated from the special effects definition files. The special effects components and special effects parameters of the special effects resource files can be expanded very conveniently by editing the special effects definition files, thereby improving the efficiency of game development.
[0094] In some embodiments, see Figure 4B , Figure 4A The illustrated step S105 can be implemented by following the steps S1051 to S1053, which are described in detail below.
[0095] Step S1051, obtaining a second special effect parameter from the target special effect definition file, where the second special effect parameter is a special effect parameter that does not exist in the target special effect resource file.
[0096] In an embodiment of the present application, the component identification of each target special effect component in the target special effect resource file corresponding to the target special effect can be obtained. Based on the component identification of each target special effect component, the target special effect definition file required to generate the target special effect is obtained from multiple special effect definition files. For any target special effect component, the component identification of the target special effect component is the same as the component identification in the target special effect definition file required by it. For any target special effect definition file, all special effect parameters recorded in the target special effect definition file can be traversed, and each special effect parameter can be detected whether it exists in the target special effect resource file, and the detection result of each special effect parameter can be obtained. If the detection result of the special effect parameter indicates that the special effect parameter exists in the target special effect resource file, then the special effect parameter is the first special effect parameter. Alternatively, if the detection result of the special effect parameter indicates that the special effect parameter does not exist in the target special effect resource file, then the special effect parameter is the second special effect parameter.
[0097] Step S1052: determine the default value of the second special effect parameter in the target special effect definition file as the parameter value of the second special effect parameter.
[0098] In the embodiment of the present application, since the second special effect parameter does not exist in the target special effect resource file, there is naturally no corresponding parameter value. The default value of the second special effect parameter in the target special effect definition file can be determined as the parameter value of the second special effect parameter.
[0099] Exemplarily, the target special effect definition file a includes a special effect component: Particle component, which has special effect parameters A and special effect parameters B, and their default values are 0 and 1 respectively. Assuming that the target special effect resource file also includes target special effect component 1: Particle component, but the first special effect parameter corresponding to the target special effect component 1 does not include special effect parameters A and special effect parameters B, then special effect parameters A and special effect parameters B are the second special effect parameters. After the target special effect is read into the game, the values of special effect parameters A and special effect parameters B adopt the default values 0 and 1 in the target special effect definition file a respectively. Alternatively, assuming that the first special effect parameter corresponding to the target special effect component 1 includes special effect parameters A and special effect parameters B, and their reference values are 1 and 1 respectively, then the values of special effect parameters A and special effect parameters B after being read into the game are 1 and 1.
[0100] Step S1053: Generate a target special effect based on the parameter value of the first special effect parameter and the parameter value of the second special effect parameter.
[0101] In the embodiment of the present application, the target special effect can be generated based on the parameter value of the first special effect parameter corresponding to each target special effect component in the target special effect resource file and the parameter value of the second special effect parameter corresponding to each target special effect component through the preset execution logic and display logic code. It should be noted that the embodiment of the present application does not limit the preset execution logic and display logic code, as long as the function of special effect generation can be realized.
[0102] The embodiment of the present application uses the default value of the second special effect parameter in the target special effect definition file to complete the reference value of the special effect parameter missing in the target special effect resource file, reduces the data required when creating the target special effect resource file, and thus improves game development efficiency.
[0103] Figure 5A is a flow chart of the special effect generation method provided in the embodiment of the present application, which will be combined with Figure 5A The steps shown are explained in the following sections. Figure 5A ,exist Figure 4A Before step S101 shown, steps S201 to S203 may also be performed, which are described in detail below.
[0104] Step S201, in response to a creation operation of a special effect definition file for a special effect component, obtain a component identifier of the special effect component, special effect parameters corresponding to the special effect component, and default values of the special effect parameters.
[0105] In an embodiment of the present application, a user can trigger the creation operation of a special effect definition file for a special effect component, and enter the component identification of the special effect component, at least one special effect parameter corresponding to the special effect component, and the default value of each special effect parameter through an external input device. It should be noted that the embodiment of the present application does not limit the special effect component, the special effect parameters of the special effect component, and the default value of the special effect parameters. The specific effect component, special effect parameters, and default value can be defined by the user himself. In response to the creation operation of the special effect definition file for the special effect component, the component identification of the special effect component entered by the external input device, at least one special effect parameter corresponding to the special effect component, and the default value of each special effect parameter can be obtained.
[0106] Each special effect definition file and special effect resource file includes multiple special effect parameters, which constitute the core of the special effect. In order to allow users to customize special effect parameters, special effect parameters can be divided into the following types: Bool type: parameter value can only be True or False; Integer type: parameter value is an integer; Float type: parameter value is a floating point number, which can be extended to Float2 and Float3 types (parameter value consists of a finite number of floating point numbers); Macro (Enum) type: parameter value is 0-N, N is an integer, and the name of each value of 0-N can be defined by the user; String type: parameter value is a string, often used for file paths; FloatCurve type: parameter value is a series of floating point sequence frames. When the time is entered, the floating point value at this time will be interpolated and calculated based on the value recorded in the sequence frame; Color Curve type: parameter value is a series of sequence frames representing colors. When the time is entered, the color at this time will be interpolated and calculated based on the value in the sequence frame. By defining the types of the above special effect parameters, we can basically cover the variables needed in the special effect generation process.
[0107] Step S202: determining a special effect parameter group based on the parameter category to which the special effect parameter belongs, wherein the special effect parameters in the special effect parameter group have the same parameter category.
[0108] In an embodiment of the present application, after obtaining at least one special effect parameter corresponding to a special effect component, each special effect parameter can be divided into a plurality of special effect parameter groups based on the parameter category to which each special effect parameter belongs. A special effect parameter group may include one special effect parameter or multiple special effect parameters. If there are multiple special effect parameters in a special effect parameter group, the parameter categories of the multiple special effect parameters are the same. The parameter category to which the special effect parameter belongs can be divided based on the expression form of the special effect in the game. For example, the parameter category to which the special effect parameter belongs can be material, and each special effect parameter related to the material is divided into a special effect parameter group, and the special effect parameter group is named Material.
[0109] In some embodiments, for any special effect parameter group, if there are multiple special effect parameters in the special effect parameter group, the special effect parameters can be arranged based on the type combination of each special effect parameter. For example, the special effect parameters of the special effect parameter group whose type is Float1 are arranged together, the special effect parameters of the special effect parameter group whose type is Bool are arranged together, and so on.
[0110] Step S203, generating a special effect definition file corresponding to the special effect component based on the component identifier of the special effect component, the special effect parameter group and the default values of the special effect parameters.
[0111] In the embodiment of the present application, a special effect definition file corresponding to the special effect component can be generated according to the component identifier of the special effect component and the order of multiple special effect parameter groups. Each special effect parameter group includes at least one special effect parameter and a default value of the special effect parameter. The generated special effect definition file can be saved in the game directory.
[0112] When generating a special effect definition file, the embodiment of the present application divides the special effect parameters of the same parameter category into the same special effect parameter group, which can facilitate user query and editing, and improve the processing efficiency of the special effect definition file. The user can directly edit the special effect components and special effect parameters in the special effect definition file, which greatly improves the scalability of special effect resources, saves time and cost, and thus improves the efficiency of game development.
[0113] In some embodiments, see Figure 5B , Figure 5A The illustrated step S203 can be implemented by following the steps S2031 to S2033, which are described in detail below.
[0114] Step S2031, obtaining the parent-child relationship between special effect parameter groups.
[0115] In the embodiment of the present application, there may be a concept of a parent-child relationship between special effect parameter groups. If there is a parent-child relationship between two special effect parameter groups, then the child special effect parameter group may belong to the parent special effect parameter group. After the editor reads the special effect definition file, the special effect parameter groups with a parent-child relationship in the special effect definition file are displayed in a tree structure, and the child special effect parameter group will be displayed under the parent special effect parameter group.
[0116] For example, if there are special effect parameter groups Material and Diffuse (diffuse reflection) in the special effect definition file, there is a parent-child relationship between the special effect parameter group Material and the special effect parameter group Diffuse. The parent special effect parameter group is Material, and the child special effect parameter group is Diffuse. Diffuse represents the Diffuse sub-item under the special effect parameter group Material. Figure 6This is an example of displaying special effect parameters in an editor interface, such as Figure 6 As shown, in the editor interface, the special effect parameter group Material and the special effect parameter group Diffuse will also be displayed in a tree diagram according to the parent-child relationship.
[0117] Step S2032: based on the parent-child relationship between the special effect parameter groups, obtain the name of the parent parameter group to which the special effect parameter group belongs.
[0118] In the embodiment of the present application, for any special effect parameter group, if there is a parent-child relationship between the special effect parameter group and other special effect parameter groups, and the special effect parameter group is a child special effect parameter group in the parent-child relationship, the name of the other special effect parameter group in the parent-child relationship is obtained as the name of the parent parameter group to which it belongs. For example, the parent parameter group name of the special effect parameter group Diffuse is Material. The parent-child relationship of the special effect parameter group can be queried by the parent parameter group name of the special effect parameter group.
[0119] Step S2033, generating a special effect definition file corresponding to the special effect component based on the component identifier of the special effect component, the special effect parameter group, the name of the parent parameter group to which the special effect parameter group belongs, and the default value of the special effect parameter.
[0120] In an embodiment of the present application, multiple special effect parameter groups can be placed in a special effect parameter group list, and a special effect definition file corresponding to the special effect component is generated in the order of the component identifier of the special effect component and the special effect parameter group list. Each special effect parameter group includes a special effect parameter group name, a parent parameter group name, at least one special effect parameter, and a default value of the special effect parameter. The generated special effect definition file can be saved in the game directory. The generated special effect definition file is shown in Table 1.
[0121] Table 1 Special effects definition files The embodiment of the present application generates a special effect definition file based on the parent-child relationship between special effect parameter groups, which facilitates users to search for specific special effect parameters, and further facilitates editing of special effect definition files, thereby improving the scalability and expansion efficiency of special effect resources.
[0122] Figure 5C is a flow chart of the special effect generation method provided in the embodiment of the present application, which will be combined with Figure 5A The steps shown are explained in the following sections. Figure 5C ,exist Figure 5A After step S203 shown, steps S204 to S206 may also be performed, which are described in detail below.
[0123] Step S204, in response to the parameter adding operation on the special effect definition file, obtaining the special effect parameters to be added and the default values of the special effect parameters to be added.
[0124] In the embodiment of the present application, after generating the special effect definition file, the user can also edit the special effect definition file. The editing operation can include a parameter adding operation. In response to the parameter adding operation on the special effect definition file, the parameter name of the special effect parameter to be added and the default value of the special effect parameter to be added entered by the external input device can be obtained.
[0125] In some embodiments, see Figure 5D , Figure 5C The illustrated step S204 can be implemented by following the steps S2041 to S2043, which are described in detail below.
[0126] Step S2041, obtaining the special effect parameters to be added.
[0127] In the embodiment of the present application, the parameter name of the special effect parameter to be added entered by the external input device can be obtained.
[0128] Step S2042: when the special effect parameter to be added is a special effect identifier, obtain the file path of the special effect resource file corresponding to the special effect identifier.
[0129] In the embodiment of the present application, the special effect identifier is a unique identifier used to distinguish each special effect, and its expression includes but is not limited to numbers, letters, Chinese characters, etc. After obtaining the parameter name of the special effect parameter to be added, it can be queried in the game directory whether there is a special effect resource file with the same special effect identifier as the parameter name. If they are the same, the parameter name is the special effect identifier. When the parameter name of the special effect parameter to be added is the special effect identifier, the file path of the special effect resource file corresponding to the special effect identifier can be obtained. The parameter type of the special effect parameter to be added can be a String parameter.
[0130] Step S2043: determine the character string corresponding to the file path as the default value of the parameter to be added.
[0131] In the embodiment of the present application, the parameter type of the parameter to be added is a String parameter. The string corresponding to the file path of the special effect resource file corresponding to the special effect identifier can be used as the default value of the parameter to be added, so that the parameter name and default value of the parameter to be added can be added to the special effect definition file.
[0132] For example, in the special effect definition file corresponding to the Particle component, add a parameter to be added, the parameter name of the parameter to be added is special effect 2, which is a special effect identifier. The string corresponding to the file path of the special effect resource file corresponding to special effect 2 is used as the default value of the parameter to be added. After the parameter to be added, special effect 2, and the default value of the parameter to be added are added to the special effect definition file, each particle emitted by the Particle component is the special effect corresponding to the parameter to be added, special effect 2. Figure 7As shown, special effect 2 is a separately produced special effect resource file. Special effect 2 is referenced in special effect 1, so that each particle emitted by the Particle component in special effect 1 is special effect 2, which realizes the reuse of special effect resources and is also conducive to the modular development of special effect resources.
[0133] In another embodiment, a special effect parameter to be added can be defined, whose parameter name is FxName and whose parameter type is String. The special effect parameter to be added is added to the special effect definition file. If the default value of the special effect parameter to be added is empty, the special effect parameter to be added has no effect on the special effect generation. If in response to the operation of adding parameters to the special effect definition file, the value of the special effect parameter FxName to be added obtained from the external input is a string corresponding to the file path of a special effect resource file, and the string corresponding to the file path of the special effect resource file is used as the default value of the special effect parameter FxName to be added. At this time, the default value of the special effect parameter to be added is not empty. The special effect component corresponding to the special effect definition file uses the special effect pointed to by the default value of the special effect parameter to be added when generating special effects, so as to realize the logic of special effect reuse.
[0134] The embodiment of the present application can directly realize the reuse of special effects by adding special effect parameters to the special effect identifier and using the character string corresponding to the file path of the special effect resource file corresponding to the special effect identifier as the default value of the special effect parameter to be added, which is conducive to the modular development of special effect resources and saves the time cost of repeated development.
[0135] Continue to see Figure 5C , then step S204 is described.
[0136] Step S205, obtaining the parameter category to which the special effect parameter to be added belongs.
[0137] In the embodiment of the present application, after obtaining the special effect parameter to be added, the parameter category to which the special effect parameter to be added belongs can be determined. For example, the parameter category to which the special effect parameter to be added belongs is Material.
[0138] Step S206, based on the parameter category to which the special effect parameter to be added belongs, the special effect parameter to be added and the default value of the special effect parameter to be added are added to the corresponding special effect parameter group to obtain an edited special effect definition file.
[0139] In an embodiment of the present application, based on the parameter category to which the special effect parameter to be added belongs, the special effect parameter group corresponding to the same parameter category can be located, and the parameter name of the special effect parameter to be added and the default value of the special effect parameter to be added can be added to the corresponding special effect parameter group to obtain the edited special effect definition file.
[0140] In some embodiments, after determining the special effect parameter group corresponding to the special effect parameter to be added, the parameter type of the special effect parameter to be added can also be obtained, and the special effect parameter to be added and the default value of the special effect parameter to be added are added to the corresponding position based on the parameter type. For example, if the parameter category of the special effect parameter to be added is Material and the parameter type is Float1, the special effect parameter to be added and the default value are added to the Float1 parameter in the special effect parameter group Material.
[0141] According to the embodiment of the present application, users can expand the special effect parameters available to the special effect component by adding new special effect parameters in the special effect definition file, thereby changing the overall special effect visual effect, improving the scalability of special effect resources, liberating the creativity and productivity of game developers, and saving development time costs.
[0142] In some embodiments, the editing operation may also include a parameter modification or deletion operation. In response to a parameter modification operation for a special effect definition file, the parameter name of the special effect parameter to be modified, the default value, and the parameter name of the modified special effect parameter that needs to be modified entered by an external input device can be obtained. Based on the parameter name of the modified special effect parameter, the modified special effect parameter is filtered out from the special effect parameters of the special effect definition file. The special effect parameter to be modified is replaced with the modified special effect parameter, and the default value of the special effect parameter to be modified is replaced with the default value of the modified special effect parameter, to obtain the edited special effect definition file. In response to a parameter deletion operation for a special effect definition file, the parameter name of the special effect parameter to be deleted that needs to be deleted entered by an external input device can be obtained. Based on the parameter name of the special effect parameter to be deleted, the special effect parameter to be deleted is filtered out from the special effect parameters of the special effect definition file, and the parameter name and default value of the special effect parameter to be deleted are deleted to obtain the edited special effect definition file.
[0143] Fig. 8A is a flow chart of the special effect generation method provided in the embodiment of the present application, which will be combined with Fig. 8A The steps shown are explained in the following sections. Fig. 8A The special effect generation method can also execute step S301 to step S304, which is described in detail below.
[0144] Step S301, in response to a received special effect creation request, obtaining at least one special effect definition file required for creating a special effect from a plurality of special effect definition files corresponding to the game.
[0145] In the present application embodiment, Fig. 9 As shown in the figure, an editor interface for creating and reading special effect definition files and special effect resource files is shown. Users can use this editor interface to build a variety of custom component types, such as Fig.10, such as the ray, model, particle, etc. component types shown in . A user can trigger a special effect creation operation for a special effect to be created in the editor interface. In response to a special effect creation request received for the special effect creation operation, a special effect component required for the special effect to be created can be obtained. Based on the component identifier of the special effect component required for the special effect to be created, at least one special effect definition file corresponding to the special effect to be created is obtained from the game directory.
[0146] Step S302, loading at least one special effect definition file required for the special effect to be created, and displaying the special effect parameters in the special effect definition file.
[0147] In the embodiment of the present application, at least one special effect definition file required for creating the special effect is loaded, and Fig. 9 The editor interface displays the special effect components and the special effect parameters corresponding to the special effect components in the special effect definition file. Fig. 9 As shown in the figure, the editor interface can display the corresponding special effect parameters of all special effect components included in the special effect to be created. The viewer panel on the right displays the special effect parameters and parameter values automatically generated after loading the special effect definition file or special effect resource file. The component window in the middle displays the special effect components included in the special effect to be created. The left panel displays the preview effect of the special effect to be created.
[0148] Step S303 , in response to the received parameter editing operation for at least one special effect parameter, obtaining a modified parameter value of the special effect parameter.
[0149] In the embodiment of the present application, the user can trigger a parameter editing operation for at least one special effect parameter on the viewer panel. In response to the received parameter editing operation for at least one special effect parameter, a modified parameter value of the special effect parameter input from the outside is obtained.
[0150] Step S304 , in response to the received parameter saving request, generating a special effect resource file corresponding to the special effect to be created based on the modified parameter values of the special effect parameters.
[0151] In an embodiment of the present application, a user can trigger a parameter saving operation on the editor interface. In response to a received parameter saving request for the parameter saving operation, a special effect resource file corresponding to the special effect to be created can be generated based on the component name of each special effect component, the special effect parameters corresponding to each special effect component, and the modified parameter values.
[0152] The embodiment of the present application can generate a special effect resource file based on the special effect definition file, and then create the required special effects. Therefore, the final special effect generation result can be changed by changing the special effect components and special effect parameters in the special effect definition file, thereby improving the scalability of the special effect resources.
[0153] In some embodiments, see Figure 8B , Figure 8B The illustrated step S304 can be implemented by following the steps S3041 to S3043, which are described in detail below.
[0154] Step S3041, in response to the received parameter saving request, obtain the special effect start time and special effect end time of the special effect component.
[0155] In the embodiment of the present application, the user can set the special effect start time and the special effect end time for each special effect component on the editor interface. In response to the received parameter saving request, the special effect start time and the special effect end time of each special effect component can be directly obtained. The special effect start time and the special effect end time of the special effect to be created can also be obtained. The special effect start time and the special effect end time of each special effect component are within the interval of the special effect start time and the special effect end time of the special effect to be created.
[0156] Step S3042, obtaining the parameter path of the special effect parameter corresponding to the special effect component, wherein the parameter path is used to represent the special effect parameter group to which the special effect parameter belongs.
[0157] In the embodiment of the present application, the parameter path of the special effect parameter is used to characterize the special effect parameter group to which the special effect parameter belongs. The parameter path of the special effect parameter corresponding to the special effect component can be obtained based on the special effect definition file.
[0158] Exemplarily, the special effect parameter group Diffuse includes the special effect parameter DiffuseMap. The parent special effect parameter group of the special effect parameter group Diffuse is the special effect parameter group Material. Therefore, the parameter path of the special effect parameter DiffuseMap is: Material.Diffuse.DiffuseMap, which is also the path that can uniquely index the specific special effect parameter.
[0159] Step S3043, based on the component identifier of the special effect component, the special effect start time and the special effect end time of the special effect component, and the modified parameter value and parameter path of the special effect parameter corresponding to the special effect component, generate a special effect resource file corresponding to the special effect to be created.
[0160] In an embodiment of the present application, a special effect resource file corresponding to the special effect to be created can be generated according to the special effect identifier of the special effect to be created, the special effect start time and the special effect end time of the special effect to be created, and the order of the component list. Among them, the parameter path of the special effect parameter is used as the parameter name of the special effect parameter in the special effect resource file. The component list includes the component identifier of each special effect component, the special effect start time and the special effect end time of each special effect component, and the parameter name and parameter value of the special effect parameter corresponding to each special effect component. The generated special effect resource file can be shown in Table 2.
[0161] Table 2 Special effects resource files The embodiment of the present application can respond to a received parameter saving request and generate a special effect resource file corresponding to the special effect to be created based on the special effect start time and special effect end time of the special effect component, and the modified parameter value and parameter path of the special effect parameter corresponding to the special effect component, thereby simplifying the special effect development process and improving game development efficiency.
[0162] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.
[0163] In the application scenario of game development, different special effects can be created according to the needs of game developers. The special effect generation method provided in the embodiment of the present application divides the special effect files corresponding to each special effect into two categories: "special effect definition file" and "special effect resource file". The special effect definition file and the special effect resource file are respectively stored in different locations of the game directory, and together constitute the definition of the special effect. The core component of the special effect is the special effect parameters, and each special effect resource file or special effect definition file includes multiple special effect parameters. The special effect parameters are defined as the following types: Bool type: the parameter value can only be True or False; Integer type: the parameter value is an integer; Float type: the parameter value is a floating point number, which can be extended to Float2 and Float3 types (the parameter value is composed of a finite number of floating point numbers); Enum type: the parameter value is 0-N, N is an integer, and the name of each value of 0-N can be defined by the user; String type: the parameter value is a string, which is often used for file paths; FloatCurve type: the parameter value is a series of floating point sequence frames. When the time is entered, the floating point value at this time will be interpolated and calculated based on the value recorded in the sequence frame; ColorCurve type: the parameter value is a series of sequence frames representing colors. When the time is entered, the color at this time will be interpolated and calculated based on the value in the sequence frame. By defining the types of the above special effect parameters, the variables needed in the special effect generation process can be basically covered, allowing users to customize special effect parameters.
[0164] The following describes how to create a special effect definition file.
[0165] The special effect definition file is also called the Def file, which records the special effect components (Component) that can be used by the special effect generation system and the special effect parameters contained in each special effect component. The specific special effect components and special effect parameters can be defined by the user. Each type of special effect component (such as particles) is a special effect definition file, which records the special effect parameters that can be used in the special effect component. The format of the special effect definition file is shown in Table 1. Among them, the special effect parameter group is a combination of multiple special effect parameters. In the editor interface, the special effect parameters belonging to the same special effect parameter group will be arranged together as a combination to facilitate user search. For example, you can create a special effect parameter group related to materials and name it Material. All special effect parameters related to materials are added to the special effect parameter group Material. Special effect parameter groups can have the concept of parent-child relationships, which can be queried by recording the name of their father's special effect parameter group. The child parameter group will be displayed under the parent parameter group in a tree structure. For example, you can define a Diffuse special effect parameter group, and its parent is Material, then it represents the Diffuse child item under Material, and it will also be displayed in the editor according to the tree diagram of the parent-child relationship. Each special effect parameter group records the various types of special effect parameters it contains, and is arranged in categories according to the parameter types defined above, with Float special effect parameters placed together, Integer special effect parameters placed together, etc., to facilitate subsequent programs to read special effect definition files. Each special effect parameter records the parameter name and default value.
[0166] In response to the creation operation of the special effect definition file, the component identification of the special effect component entered by the game developer through the input device, the multiple special effect parameters used by the special effect component, and the default value of each special effect parameter are obtained. In one embodiment, the parameter category of each special effect parameter can be determined based on a preset rule, and the multiple special effect parameters can be divided into multiple special effect parameter groups according to the parameter category of each special effect parameter. The parent-child relationship between the two special effect parameter groups is determined based on the preset rules, and the name of the parent parameter group to which each special effect parameter group belongs (if any) is obtained. The special effect parameters in each special effect parameter group are classified and sorted according to the parameter type. Each processed special effect parameter group constitutes a special effect parameter group list, and the special effect definition file is generated in the order of the component identification and the special effect parameter group list. In another embodiment, the parameter category of each special effect parameter given by the game developer through the input device and the parent-child relationship between the two special effect parameter groups can be obtained. By creating a special effect definition file for each type of special effect component, all the special effect parameters used by all special effect components in the special effect generation system can be listed. For example, the special effects generation system of Game A includes Particle components (responsible for emitting particles), Model components (responsible for displaying models), and Ribbon components (responsible for emitting ribbons). Each type of component has its corresponding special effects definition file. These special effects definition files are the "meta-resources" of the special effects generation system, which define the rules of the special effects generation system.
[0167] The following describes how to create special effect resource files.
[0168] The special effect resource file is a file that defines a specific special effect, and its format is shown in Table 2. Among them, each special effect resource file is composed of special effect components defined by the special effect definition file. The special effect corresponding to each special effect resource file has a special effect start time and a special effect end time. Each special effect component in the special effect also has its start time and end time in the special effect. After the special effect is loaded in the game, during the special effect start time and special effect end time of the special effect, it will have corresponding visual performance according to the difference between the special effect component and the special effect parameters. The special effect resource price is the same as the special effect definition file, which records the parameter path (parameter name) and parameter value of the special effect parameter of each parameter category. This special effect parameter can correspond to the specific special effect parameter recorded in the special effect definition file. The parameter path is used to indicate which special effect parameter group the special effect parameter belongs to. For example, under the special effect parameter group Diffuse, there is a special effect parameter DiffuseMap. Since the parent parameter group name of the special effect parameter group Diffuse is Material, the full parameter path of the special effect parameter DiffuseMap is: Material.Diffuse.DiffuseMap, which is also the path that can uniquely index the specific special effect parameter.
[0169] At the same time, the embodiment of the present application provides an editor for reading special effect definition files and special effect resource files. Fig. 9 , showing the editor interface for reading a special effect resource file. The editor displays the special effect components and corresponding special effect parameters contained in the special effect. On the right panel, the display UI of these parameters is automatically generated by directly reading the special effect resource file. Game developers can modify the value of a special effect parameter on the parameter panel, and the special effect will also change its visual performance in the preview interface on the left. Fig.10 For the special effect examples developed using the special effect generation system provided in the embodiment of the present application, since the special effect definition file has good scalability, a variety of user-defined component types can be constructed, such as Fig.10 The rays, models, particles and other components in the displayed special effects are all customized by users.
[0170] In one embodiment, in response to a creation operation of a special effect to be created triggered by a game developer on an editor interface, if there is no corresponding special effect resource file before the special effect to be created, at least one special effect definition file required for the special effect to be created is obtained from the game directory based on the special effect identifiers of each special effect component used by the special effect to be created. The above-mentioned special effect definition file is loaded, and each special effect component required for the special effect to be created and the special effect parameters corresponding to each special effect component are displayed on the editor interface. The game developer can edit and input the parameter value of any special effect parameter on the editor. The change of the parameter value of any special effect parameter in the editor will cause a visual change in the special effect preview effect on the left side of the editor interface. In response to a parameter save request, a special effect resource file can be generated based on the special effect start time, special effect end time, each special effect component, the component start time and component end time of each special effect component in the special effect to be created on the editor, and the special effect parameters of the edited parameter values corresponding to each special effect component. Among them, the special effect parameters whose parameter values have not been edited are not recorded in the special effect resource file. In another embodiment, in response to a creation operation of a special effect to be created triggered by a game developer on an editor interface, if a special effect resource file saved before the special effect to be created exists, the special effect resource file can be directly loaded, and then the parameter values of the special effect parameters can be modified using the editor to obtain a modified special effect resource file.
[0171] After creating the special effect definition file and special effect resource file, you also need to implement the execution logic and display logic code of each special effect component and each special effect parameter. This part of the code cannot be omitted in every special effect generation system. However, you can use serialization technology to automatically parse the special effect definition file and special effect resource file into the game memory, saving the workload of parsing the file part. The following is an explanation of the special effect generation method during game operation.
[0172] The special effect definition file of the special effect is loaded by default when the game is started, and it works during the entire game running stage. When a specific special effect is to be used in the game, load the corresponding special effect resource file into the game. The running process is as follows Fig.11 As shown below. Fig.11 Provide explanation.
[0173] Step S401, deserialize the special effect resource file into memory.
[0174] Through the deserialization technology, the definition of the special effect in the special effect resource file is read into the corresponding data structure in the memory, and the content of the data structure is consistent with the information recorded in Table 2.
[0175] Step S402: for each special effect component, traverse the special effect parameters recorded in the special effect definition file.
[0176] After obtaining the data structure, when the special effect is referenced in the game, for each special effect component used by the special effect, the special effect parameters recorded in the special effect definition file of the special effect component are traversed.
[0177] Step S403, detecting whether the special effect parameter is recorded in the special effect resource file.
[0178] If the special effect parameter is recorded in the special effect resource file, go to step S404; if the special effect parameter is not recorded in the special effect resource file, go to step S405.
[0179] Step S404: The value of the special effect parameter is obtained from the value recorded in the special effect resource file.
[0180] Step S405: The parameter value of the special effect parameter takes the default value in the special effect definition file.
[0181] Step S406, generating runtime effects according to the readjusted special effects.
[0182] Run again according to the adjusted special effect parameters to obtain specific special effect performance results.
[0183] The parameter values recorded in the special effect resource file will overwrite the default values of the corresponding special effect parameters in the special effect definition file. It should be noted that the special effect parameters recorded in the special effect definition file will always be saved in the special effect component. If the special effect parameter is not recorded in the special effect resource file, the special effect parameter will obtain the default value of the special effect parameter from the corresponding special effect definition file; otherwise, the parameter value recorded in the special effect resource file is directly taken. For example, there are two special effect parameters A and B under Material.Diffuse of the Particle component recorded in the special effect definition file, and their default values are 0 and 1 respectively. Assuming that a special effect resource file also has a Particle component, even if there are no special effect parameters A and B in the special effect component, after the special effect is read into the game, the values of the two special effect parameters A and B are the default values 0 and 1 respectively. Assuming that the values of A and B recorded in the special effect resource file are 1,1, then the values of the two special effect parameters read into the game will overwrite the default values and become 1,1.
[0184] The following describes how to reuse special effect resources.
[0185] Since the special effect generation system is highly scalable, the special effect resources can be reused by adding special effect parameters in the special effect definition file. For example, a special effect parameter FxName of type String can be added to the Particle component. The parameter value of the special effect parameter FxName is the path of the special effect resource file of another special effect. When FxName is not empty, each particle emitted by the Particle is the special effect pointed to by the special effect parameter FxName, which can easily realize the logic of special effect reuse. The above method is impossible for a relatively closed special effect system such as Unity in traditional technology.
[0186] The embodiment of the present application greatly improves the scalability and reusability of the special effect generation system, liberates the creativity and productivity of game developers, and saves the time cost of repeated development. The special effect file format proposed in the embodiment of the present application records the special effect components and special effect parameters in a text file (special effect definition file). Game developers can easily edit the parameters and component types of special effects in the text file. The program is directly read and serialized into the corresponding data structure in the game and editor, which can be easily displayed on the UI of the special effect editor, saving the code for writing UI display. At the same time, based on the above function of expandable parameters, it is also possible to easily realize the reference to existing special effect resources, saving the time cost of repeated development.
[0187] The following is a description of an exemplary structure of the special effect generating device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 3As shown, the software modules stored in the special effect generating device 455 of the memory 440 may include:
[0188] The definition file acquisition module 4551 is used to respond to the received game startup request and obtain multiple special effect definition files corresponding to the game. The definition file loading module 4552 is used to load multiple special effect definition files, and the special effect definition file includes the component identification of the special effect component and the default value of the special effect parameter. The resource file acquisition module 4553 is used to obtain the target special effect resource file corresponding to the target special effect in response to the generation request for the target special effect during the game operation. The resource file loading module 4554 is used to load the target special effect resource file, and the target special effect resource file includes the component identification of the target special effect component and the parameter value of the first special effect parameter corresponding to the target special effect component. The parameter value of the first special effect parameter is obtained by editing the first special effect parameter in the target special effect definition file corresponding to the target special effect component. The special effect generation module 4555 is used to generate the target special effect based on the target special effect definition file and the target special effect resource file.
[0189] In some embodiments, the special effect generation module 4555 is also used to obtain a second special effect parameter from the target special effect definition file, where the second special effect parameter is a special effect parameter that does not exist in the target special effect resource file; determine the default value of the second special effect parameter in the target special effect definition file as the parameter value of the second special effect parameter; and generate the target special effect based on the parameter value of the first special effect parameter and the parameter value of the second special effect parameter.
[0190] In some embodiments, the special effect generating device also includes a definition file generating module, which is used to obtain the component identification of the special effect component, the special effect parameters corresponding to the special effect component, and the default values of the special effect parameters in response to the creation operation of the special effect definition file for the special effect component; determine the special effect parameter group based on the parameter category to which the special effect parameter belongs; the special effect parameters in the special effect parameter group have the same parameter category; and generate a special effect definition file corresponding to the special effect component based on the component identification of the special effect component, the special effect parameter group, and the default values of the special effect parameters.
[0191] In some embodiments, the definition file generation module is also used to obtain the parent-child relationship between special effect parameter groups; based on the parent-child relationship between special effect parameter groups, obtain the name of the parent parameter group to which the special effect parameter group belongs; based on the component identifier of the special effect component, the special effect parameter group, the name of the parent parameter group to which the special effect parameter group belongs, and the default value of the special effect parameter, generate a special effect definition file corresponding to the special effect component.
[0192] In some embodiments, the special effect generating device also includes a definition file editing module, which is used to obtain the special effect parameters to be added and the default values of the special effect parameters to be added in response to the new parameter operation on the special effect definition file; obtain the parameter category to which the special effect parameters to be added belong; based on the parameter category to which the special effect parameters to be added belong, add the special effect parameters to be added and the default values of the special effect parameters to be added to the corresponding special effect parameter group to obtain the edited special effect definition file.
[0193] In some embodiments, the definition file editing module is also used to obtain the special effect parameters to be added; when the special effect parameters to be added are special effect identifiers, the file path of the special effect resource file corresponding to the special effect identifier is obtained; and the character string corresponding to the file path is determined as the default value of the parameter to be added.
[0194] In some embodiments, the special effect generation device also includes a resource file generation module, which is used to respond to a received special effect creation request, obtain at least one special effect definition file required for the special effect to be created from multiple special effect definition files corresponding to the game; load at least one special effect definition file required for the special effect to be created, and display the special effect parameters in the special effect definition file; respond to a received parameter editing operation for at least one special effect parameter, obtain the modified parameter value of the special effect parameter; respond to a received parameter save request, and generate a special effect resource file corresponding to the special effect to be created based on the modified parameter value of the special effect parameter.
[0195] In some embodiments, the resource file generation module is also used to obtain the special effect start time and special effect end time of the special effect component in response to a received parameter save request; obtain the parameter path of the special effect parameter corresponding to the special effect component; the parameter path is used to characterize the special effect parameter group to which the special effect parameter belongs; based on the component identifier of the special effect component, the special effect start time and special effect end time of the special effect component, and the modified parameter value and parameter path of the special effect parameter corresponding to the special effect component, generate a special effect resource file corresponding to the special effect to be created.
[0196] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the special effect generation method described in the embodiment of the present application.
[0197] The present application embodiment provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will execute the special effect generation method provided by the present application embodiment, for example, Figure 4AThe special effect generation method shown.
[0198] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0199] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0200] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0201] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0202] In summary, the present application provides a new game special effects resource format, which divides special effects files into two categories: "special effects definition files" and "special effects resource files". Game developers can easily set the special effects components and related special effects parameters used by the special effects generation system in the "special effects definition file", and develop and generate specific special effects resource files through the editor. The adjustable special effects components and special effects parameters in the editor are generated from the "special effects definition file". Through serialization and deserialization technology, the "special effects definition file" and "special effects resource file" are loaded into the memory when the game starts, and related programs are executed to generate special effects. By designing special effects files in this way, the special effects components and special effects parameters of special effects resources can be expanded very conveniently, and it is easy to reuse existing special effects resources, which greatly simplifies the development process and improves the efficiency of game development.
[0203] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A special effect generation method, characterized in that: The method comprises: In response to the received game start request, a plurality of special effect definition files corresponding to the game are obtained; Loading the plurality of special effect definition files, wherein the special effect definition files include component identifiers of special effect components and default values of special effect parameters; During the running of the game, in response to a request for generating a target special effect, a target special effect resource file corresponding to the target special effect is obtained; Loading the target special effect resource file, wherein the target special effect resource file includes a component identifier of a target special effect component and a parameter value of a first special effect parameter corresponding to the target special effect component, wherein the parameter value of the first special effect parameter is obtained by editing the first special effect parameter in a target special effect definition file corresponding to the target special effect component; The target special effect is generated based on the target special effect definition file and the target special effect resource file.
2. The method according to claim 1, characterized in that The generating the target special effect based on the target special effect definition file and the target special effect resource file comprises: Acquire a second special effect parameter from the target special effect definition file, where the second special effect parameter is a special effect parameter that does not exist in the target special effect resource file; Determine the default value of the second special effect parameter in the target special effect definition file as the parameter value of the second special effect parameter; The target special effect is generated based on the parameter value of the first special effect parameter and the parameter value of the second special effect parameter.
3. The method according to claim 1, characterized in that The method further comprises: In response to a creation operation of a special effect definition file for a special effect component, obtaining a component identifier of the special effect component, special effect parameters corresponding to the special effect component, and default values of the special effect parameters; Determining a special effect parameter group based on the parameter category to which the special effect parameter belongs; the special effect parameters in the special effect parameter group have the same parameter category; Based on the component identification of the special effect component, the special effect parameter group and the default values of the special effect parameters, a special effect definition file corresponding to the special effect component is generated.
4. The method according to claim 3, characterized in that The generating a special effect definition file corresponding to the special effect component based on the component identifier of the special effect component, the special effect parameter group and the default value of the special effect parameter comprises: Obtain the parent-child relationship between the special effect parameter groups; Based on the parent-child relationship between the special effect parameter groups, obtaining the name of the parent parameter group to which the special effect parameter group belongs; A special effect definition file corresponding to the special effect component is generated based on the component identifier of the special effect component, the special effect parameter group, the name of the parent parameter group to which the special effect parameter group belongs, and the default value of the special effect parameter.
5. The method according to claim 3, characterized in that The method further comprises: In response to a parameter adding operation on the special effect definition file, obtaining a special effect parameter to be added and a default value of the special effect parameter to be added; Obtain the parameter category to which the special effect parameter to be added belongs; Based on the parameter category to which the special effect parameter to be added belongs, the special effect parameter to be added and the default value of the special effect parameter to be added are added to the corresponding special effect parameter group to obtain an edited special effect definition file.
6. The method according to claim 5, characterized in that The obtaining of the special effect parameters to be added and the default values of the special effect parameters to be added includes: Get the parameters of the special effects to be added; When the special effect parameter to be added is a special effect identifier, obtaining a file path of a special effect resource file corresponding to the special effect identifier; The character string corresponding to the file path is determined as the default value of the parameter to be added.
7. The method according to claim 5, characterized in that The method further comprises: In response to the received special effect creation request, obtaining at least one special effect definition file required for creating the special effect from a plurality of special effect definition files corresponding to the game; Loading at least one special effect definition file required for the special effect to be created, and displaying the special effect parameters in the special effect definition file; In response to a received parameter editing operation for at least one of the special effect parameters, obtaining a modified parameter value of the special effect parameter; In response to the received parameter saving request, a special effect resource file corresponding to the special effect to be created is generated based on the modified parameter value of the special effect parameter.
8. The method according to claim 7, characterized in that The step of generating, in response to the received parameter saving request, a special effect resource file corresponding to the special effect to be created based on the modified parameter value of the special effect parameter, comprises: In response to the received parameter saving request, obtaining the special effect start time and the special effect end time of the special effect component; Obtaining a parameter path of the special effect parameter corresponding to the special effect component; the parameter path is used to characterize the special effect parameter group to which the special effect parameter belongs; Based on the component identifier of the special effect component, the special effect start time and the special effect end time of the special effect component, and the modified parameter value and parameter path of the special effect parameter corresponding to the special effect component, a special effect resource file corresponding to the special effect to be created is generated.
9. A special effect generating device, characterized in that: The device comprises: A definition file acquisition module, used to respond to a received game start request and acquire a plurality of special effect definition files corresponding to the game; A definition file loading module, used for loading the plurality of special effect definition files, wherein the special effect definition files include component identifiers of special effect components and default values of special effect parameters; A resource file acquisition module, used to obtain a target special effect resource file corresponding to the target special effect in response to a request for generating the target special effect during the running of the game; A resource file loading module, used to load the target special effect resource file, wherein the target special effect resource file includes a component identifier of a target special effect component and a parameter value of a first special effect parameter corresponding to the target special effect component, wherein the parameter value of the first special effect parameter is obtained by editing the first special effect parameter in a target special effect definition file corresponding to the target special effect component; A special effect generation module is used to generate the target special effect based on the special effect definition file and the target special effect resource file.
10. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions; A processor, used to implement the special effect generation method described in any one of claims 1 to 8 when executing the computer executable instructions or computer programs stored in the memory.
11. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the special effect generation method according to any one of claims 1 to 8 is implemented.
12. A computer program product comprising computer executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the special effect generation method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Entity special effect configuration method and device, equipment and medium
CN121490400A