Re: Reflection in game engine (c++)
Alen Ladavac <[email protected]> Thu, 14 Mar 2013 23:45:29 +0100
| Newsgroups | gmane.games.devel.sweng |
|---|---|
| Organization | Croteam |
| Message-ID | <[email protected]> |
--===============0248174250== Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <html><head><title>Re: [Sweng-Gamedev] Reflection in game engine (c++)</tit= le> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1"> </head> <body> <span style=3D" font-family:'Courier New'; font-size: 9pt;">We've been usin= g #4 in our projects for a decade already and it works a treat. And... why = couldn't you invoke methods? :)<br> <br> That method is the only really fully portable (AFAIK), as it doesn't really= care what compiler/toolset you have. It is also very light in terms of run= time requirements, and very easy to use (not much extra typing for each cla= ss, member or function). <br> <br> Though it is rather involved to implement.<br> <br> JM2C,<br> Alen<br> <br> Thursday, March 14, 2013, 7:09:30 PM, you wrote:<br> <br> </span><table> <tr> <td width=3D15 bgcolor=3D #0000ff><br> </td> <td width=3D1142><span style=3D" font-family:'courier new'; font-size: 9pt;= ">Hello gents,<br> I wanted to experiment with reflection and I found different w= ay to obtain it:<br> <br> 1) Invasive macro based registration<br> 2) Reflection visitor pattern<br> 3) Parsing pdb/clang stuff and create a manual table of what you wan= t/need<br> 4) c++ custom parser that uses tags to create reflection information= s (like a comment near a member, ...) (exuberant ctags???)<br> 5) create serializable/reflected classes in a data format, then run = a tool that generates headers and cpps<br> <br> I am trying to figure out flaws and merits of each kind, and even if there = are other solutions.<br> I love the idea to have the possibility to serialize in and out structures,= access fields and change values, stream in/out stuff from network ,and may= be link with scripting.<br> <br> My goal is to have fast iteration times, both artists and programmers, and = I achieved it for rendering programmers already with having json binarized = configurable rendering, but still there are code stuff that are not easy to= achieve.<br> <br> Here are my thoughts, but I would like to hear your ideas and experiences!<= br> <br> 1) Very precise on what you can register/serialize, but painful to maintain= or plug into an existing codebase<br> 2) Less precise but you just need one method per class, that you can use to= serialize/reflect. Still bad in maintaining, but better in plugging in.<br> 3) You make the compiler do the work, then translate the informations you n= eed in your format. Easy to maintain, to plug...maybe slow in parsing? Slow= your build pipeline?<br> 4) maybe easier than using pdbs, but less powerful (you cannot invoke metho= ds on objects). should be faster than 3.<br> 5) crazy idea. requires generation of code from outside...powerful like 4, = so data reflection, but you cannot invoke methods if you want.<br> <br> What are your experiences/thoughts?<br> <br> Thanks to everyone that read this mail!<br> <br> Gabriel<br> </td> </tr> </table> <br><br> <br> <br> <span style=3D" font-family:'arial'; color: #c0c0c0;"><i>-- <br> Best regards,<br> Alen &= nbsp; </i></span><a style=3D" font-style: normal= ;" href=3D"mailto:[email protected]">mailto:[email protected]</a></bo= dy> --===============0248174250== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Sweng-Gamedev mailing list [email protected] http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com --===============0248174250==--