Skip to content

Python version of FLAME GPU 2 #1034

Closed Answered by Robadob
daniele-baccega asked this question in Q&A
Discussion options

You must be logged in to vote

Transpiling is the process of taking source code written in one language and transforming it into another language that has a similar level of abstraction.

In this case FLAMEGPU2's Python transpiler takes an agent function expressed in a pythonic syntax e.g.

@pyflamegpu.agent_function
def add_func(message_in: pyflamegpu.MessageNone, message_out: pyflamegpu.MessageNone):
    x = pyflamegpu.getVariableInt("x")
    pyflamegpu.setVariableInt("x", x + 20)
    return pyflamegpu.ALIVE

You pass it to the transpiler

        func_translated = pyflamegpu.codegen.translate(add_func)

This will store a string with the C++ equivalent agent function inside func_translated

e.g.

FLAMEGPU_AGENT_FUNCTION(add…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mondus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants