1 (edited by maydjin 2013-03-31 17:31:32)

Topic: Code generation

Some code (src/game/generate) is generated at compile time, is there way to prevent it, or is it realy needed? Can  anybody explain what it serves(not a code, but its generation) and what profit it makes here?

2

Re: Code generation

It's really needed, it's all the repetitive data loading stuff that is C code generated from python.

Not Luck, Just Magic.

3 (edited by maydjin 2013-03-31 18:51:01)

Re: Code generation

But why it can not be just hardcoded? If it realy must be configurable looks like runtime better place then compile time? Is there generated some stuff except game resources?
It all looks like, that python scripts introduced only to make resource loading code little readable, but it may be implemented throught json or xml which will be compiled in?
I ask because i try to make port for another build system, which more scallable and ide friendly, so at current moment only thouse files realy blocks.

4

Re: Code generation

Don't ask me why, I didn't conceive Teeworlds and noone here did. It probably can be done in a different way, but it's the way it is and it's necessary.

Not Luck, Just Magic.

5

Re: Code generation

It was done for the sake of security iirc
Generating the netmsg, data, netversion etc. is safer than writing everything by hand
(e.g preventing conflicts in the network protocol, etc.)

6

Re: Code generation

Ok, so if it will be loaded in runtime from built in xml or json data it still will be ok? Or there is some stuff which must be calculated in build time anyway ?

7

Re: Code generation

The email you sent got sucked up by the spam filter. I have marked it as an email that I will reply to.
EDIT: or come talk to us on IRC like Dune said.

Sign up with comptia a+ pdf ccna for getting security+ practice test online testking courses artinstitutesmiami and www.tabor.edu

8

Re: Code generation

It's needed for tools, and it is faster to generate it at compile time rather than load it from XML (xml parser overload + data overload etc.)

then security points also...

<<< Don't touch it unless you are one of the main developpers and the feature has been accepted by most others...

9

Re: Code generation

maydjin wrote:

Ok, so if it will be loaded in runtime from built in xml or json data it still will be ok? Or there is some stuff which must be calculated in build time anyway ?

Yea, it would be theoretically fine to do it at run-time, but I imagine it's quite a bit harder to do so.