A kind of system and method that changes the outfit of playing
Technical field
The present invention relates to a kind of system and method that changes the outfit of playing, belong to computer game field.
Background technology
In 3D game, model especially character has generally required the system of changing the outfit, and can replace the model on character physical
Parts, material or weapon etc..Player can replace old body part in gaming and more be obtained in that into clothing
Just sense and gratification, more preferable body part is the most also along with player role growth in gaming, player angle in fight
Color is replaced different weapon body parts and is coordinated technical ability can get the effect more extremely dazzled, and therefore often has one in 3D plays
The set system of changing the outfit meets changes parts body part demand.In the game that changes the outfit the system of changing the outfit also need to replace different suit,
The demands such as clothes color, clothes decorative pattern.Design a set of system that changes the outfit meeting demand and conveniently use extension and optimize the heaviest
Want.
The replacement material of the system that changes the outfit employing of general existing game, pinup picture, add and the technology of case-deleted models, with reference to figure
1, prior art used basic procedure scheme is as follows:
Scheme one: all can add skeleton cartoon due to general game object, so this interpolation and the mode of deletion game the other side
Inapplicable because the model after Ti Huaning to need again to refresh skeleton list the most permissible.Add and the mode of case-deleted models is suitable for replacing
Change the model not having eyelid covering information, be relatively specific for the common system that changes the outfit;
Scheme two: add or activate new model, this mode can cause the face number rendered to increase, take apart not enter due to model
Row mesh update and material merge, and cause not optimized in drawcall and performance, and wherein drawcall represents that exploitation is drawn
Hold up and preparing data and notifying that graphic process unit carries out the process rendered.
Summary of the invention
For the deficiencies in the prior art, technical scheme provides a kind of system and method that changes the outfit of playing.
Technical scheme includes a kind of system that changes the outfit of playing, it is characterised in that this system includes: memory module,
For using tables of data to store the body part information of game role and body part information to be replaced, create one simultaneously
The individual empty object role corresponding with this game role;Preparation module, for obtaining the command information that game role manipulator sends,
Instruction is resolved, obtains game role body part to be replaced tables of data, corresponding treating under called data table store path
Change body part information;Change the outfit module, for traversal game role body part information, obtaining game role parts mould
Type, further obtaining widget model meshes, partial model skeleton list and partial model pinup picture, and perform partial model grid
And partial model pinup picture performs merging, also with traveling through skeleton list and generating skeleton array;Rendering module, for changing the outfit described
Partial model grid, partial model skeleton and partial model pinup picture that module obtains send to skin mesh renderer, further
Perform empty object role is rendered according to the parts data obtained.
Changing the outfit system according to described game, described memory module includes: tables of data module, for by game role
Body part information and body part information to be replaced use tables of data to store, wherein the storage of body part information data table
There are corresponding bone information, gridding information and the material information of body part information and carry, wherein body part information data table
Also include that pinup picture path, described body part information to be replaced include the corresponding skeleton of body part carry correspondence carry to be replaced
Information, gridding information and material information and pinup picture path;Empty object module, for creating one and game role pair in gaming
The empty object role answered, this sky role is mounted with the bone information corresponding with game role.
Changing the outfit system according to described game, described preparation module also includes: for sending game role effector
Instruction, to instruction resolve obtain body part information to be changed, transfer to described body part information data table to be replaced
The information of body part to be replaced.
Changing the outfit system according to described game, the described module that changes the outfit includes: mesh module, for described preparation module
Body part model to be replaced travel through, obtain body part information, obtain further corresponding with body part information
Gridding information, transfers the body part information of role and performs the merging to grid;Skeleton module, for described preparation module
Body part model to be replaced travel through, obtain the skeleton list that each body part is corresponding, according to skeleton list information
Obtain skeleton list correspondence body part information, and this body part is added to newly created skeleton array;Pinup picture module, uses
In the body part model to be replaced of described preparation module is traveled through, obtain the pinup picture that each body part is corresponding, enter one
Step, transfers the pinup picture information of the body part information of role and uses tinter that pinup picture is merged process, generating further
Game model material ball.
Changing the outfit system according to described game, described rendering module includes: for the net merged by described mesh module
Lattice information obtains, and obtains the skeleton dope vector of described skeleton module creation, generates described pinup picture module
Game model material ball information obtains, and the information of acquisition is transferred in skin mesh renderer, further, makes
With skin mesh renderer, the skeleton dope vector of described skeleton module creation is added to empty object role's bone information, and tie
The game model material ball information of the gridding information and the generation of described pinup picture module that close the merging of described mesh module carries out wash with watercolours
Dye, game model after being changed the outfit.
Technical scheme also includes a kind of game costume changing method, including: by the body part information of game role
And body part information to be replaced uses tables of data to store, create a sky corresponding with this game role to image angle simultaneously
Color;Obtain the command information that game role manipulator sends, instruction is resolved, obtain game role body part to be replaced
Tables of data, body part information to be replaced corresponding under called data table store path;To traversal game role body part letter
Breath, obtains game role partial model, further obtaining widget model meshes, partial model skeleton list and partial model patch
Figure, and perform partial model grid and partial model pinup picture are performed merging, also with traveling through skeleton list and generating skeleton array;
The partial model grid, partial model skeleton and the transmission of partial model pinup picture that the described module that changes the outfit are obtained render to skin mesh
Device, performs to render empty object role according to the parts data obtained further.
Further, the method also includes: body part information and the body part information to be replaced of game role are used
Tables of data stores, wherein the storage of body part information data table have body part information and the corresponding bone information of carry,
Gridding information and material information, wherein body part information data table also includes pinup picture path, and described body part to be replaced is believed
Breath includes corresponding bone information, gridding information and material information and the pinup picture path of body part carry correspondence carry to be replaced;
Creating an empty object role corresponding with game role in gaming, this sky role is mounted with the skeleton corresponding with game role
Information.
Further, the method also includes: the instruction sending game role effector, resolves instruction and obtains and to change
Body part information, transfers the information of body part to be replaced to described body part information data table to be replaced.
Further, the method also includes: travel through the body part model to be replaced of described preparation module, obtains body
Body component information, obtains the gridding information corresponding with body part information further, transfers the body part information of role and hold
The row merging to grid;The body part model to be replaced of described preparation module is traveled through, obtains each body part pair
The skeleton list answered, obtains skeleton list correspondence body part information according to skeleton list information, and is added by this body part
To newly created skeleton array;The body part model to be replaced of described preparation module is traveled through, obtains each body
The pinup picture that part is corresponding, further, transfers the pinup picture information of the body part information of role and uses tinter to close pinup picture
And process, generate game model material ball further.
Further, the method also includes: obtained by the gridding information that described mesh module merges, to described skeleton mould
The skeleton dope vector that block creates obtains, and the game model material ball information generating described pinup picture module obtains
Take, and the information of acquisition is transferred in skin mesh renderer, further, use skin mesh renderer by described skeleton mould
The skeleton dope vector that block creates is added to empty object role's bone information, and combines the gridding information that described mesh module merges
And the game model material ball information that described pinup picture module generates renders, game model after being changed the outfit.
Use a skin mesh renderer to draw after the invention have the benefit that merging grid and improve drafting effect
Rate;By reducing the quantity of drawcall after merging material, improve the efficiency that changes the outfit, combine skeleton cartoon easily and use and expand
Exhibition.
Accompanying drawing explanation
Fig. 1 show prior art enforcement figure;
Fig. 2 show the tables of data figure that changes the outfit according to embodiment of the present invention;
Fig. 3 show the flow chart according to embodiment of the present invention.
Detailed description of the invention
In order to make the object, technical solutions and advantages of the present invention clearer, below in conjunction with the accompanying drawings with specific embodiment pair
The present invention is described in detail.The game system of changing the outfit of the present invention is applicable to the game such as single-play game, mobile phone games, web game
Exploitation, be particularly suited for the process that changes the outfit of game realized in control role plays the part of class game.
Fig. 2 show the tables of data figure that changes the outfit according to embodiment of the present invention;The parts table that changes the outfit is elaborated as follows:
The parts table the first row that changes the outfit is row name (content being used for taking respective column uses), and the second row is the data class of storage data
Type, character string type varchar represents, the third line is the use annotation implication of these row, will not lead the when of derived table data
Go out and annotate implication, fourth line content be 1 represent these row field using the keyword key as this table, after fourth line just
It it is the content in table data.
After fourth line, every a line stores the character name of corresponding personage id, the relevant letter of the body part that can replace
Breath, if content is empty, represents the body part that can not replace correspondence.Such as personage 1, name is called david and may only replace
Change shoes and trousers, but clothes, face, hair are unable to replace.The content of the shoes storage that David can replace is as follows:
{[1]={["name"]="shoe1",["texture"]="Texture/shoe1",["model"]="Model/
shoe1"},[2]={["name"]="shoe2",["texture"]="Texture/shoe2",["model"]="Model/
shoe2"}}
The convenient lua table of directly deriving of these row, in a program, contains the type of two kinds of shoes in content.Every kind of shoe inside
Storing the relevant information of shoes, including shoes name, the pinup picture path that shoes are used is (convenient followed by material conjunction
And), the model path that shoes are used, contains grid in model and skeleton data (is conveniently carried out followed by after being loaded into
Mesh update).
Fig. 3 show the flow chart according to embodiment of the present invention.Its step such as S301 ~ S304:
S301, the most first will add a new game object gameobject(sky character object), below carry
The skeleton bones of the personage of correspondence.
S302, replaces the event of certain body part, such as replaces shoes, just go by current people according to the input of player
Id go to read personage and change the outfit parts table, obtain footwear component and be correlated with all information, obtain other a pair of shoes according to demand
Information.Such as take message structure such as:
[2]={["name"]="shoe2",["texture"]="Texture/shoe2",["model"]="Model/
shoe2"}。
S303, goes to carry out subassembly mesh update according to certain order and skeleton list array generates, also have and generate newly
Personage's material ball.Such as go to travel through the model (road of model of each parts according to hair, face, clothes, trousers, the order of shoes
Footpath is obtained by table message structure model), obtain corresponding grid and carry out mesh update.Go to obtain according to same order simultaneously
Take the skeleton list arrived cited in each partial model, then go to obtain personage's bone according to each skeleton name in skeleton list
These objects are added in skeleton array by object in bone bones the most in order.Finally or by same order go to obtain
The pinup picture (path of pinup picture is obtained by table message structure texture) of each parts, these pinup pictures revest at a merging
The material ball of whole person model is generated in the shader managed.The net of personage newly-generated after so having replaced footwear component
The data of lattice, skeleton and material are the most all ready to complete.
S304, adds skin mesh renderer (just adding if without) for new game object gameobject,
The grid that step 3 generated, material, the data of skeleton are delivered separately to skin mesh renderer, such skin mesh renderer
Will go to render whole personage according to new data.
Further, technical scheme also proposed the system of changing the outfit of newly change the outfit system and old scheme and combines and make
With.Specific as follows:
1, owing to for personage with skeleton cartoon, merging grid and merging the optimization consideration that material is brought, the body of personage
Point technical solution of the present invention is used to change the outfit system schema.
2, for not having the personage of eyelid covering information to equip, still use old scheme to process relatively more flexible, i.e. at corresponding bone
Adding hanging point on bone, equipment weapon directly adds and is substituted into the hanging point of correspondence up.
3, have only to again in model assembly table add, for having only to replace the mode of pinup picture, a line that corresponding component is new, fill out
Write such as new pinup picture.
The above, simply presently preferred embodiments of the present invention, the invention is not limited in above-mentioned embodiment, as long as
It reaches the technique effect of the present invention with identical means, all should belong to protection scope of the present invention.Protection model in the present invention
In enclosing, its technical scheme and/or embodiment can have various different modifications and variations.