cocon

Forum Replies Created

Viewing 15 posts - 211 through 225 (of 342 total)
  • Author
    Posts
  • in reply to: Capturing screen #8070

    cocon
    Participant

    This is as far I as go with it, now I need to figure out the datatype conversions. Whoever can continue it, will help a lot. 🙂

    in reply to: Translation hanging with nested struct templates #8052

    cocon
    Participant

    Hi Aaron we had a talk about Classes VS Structs here.
    http://monkey2.monkey-x.com/forums/topic/struct-goofiness/#post-7734

    In C the concept of reference/value is about how you want to pass your structs into mutator functions. If you pass a struct by value it is made into a copy, but if you pass it by reference it means that you pass the address of the struct – not the actual struct.

    In object oriented programming languages it’s something else, it means that objects are something like virtual datatypes which have meaning inside the language runtime, but not 100% direct meaning to the operating system overall. For example in C if you declare an integer it means 4 bytes of memory, but in an object oriented language it means an object that is an integer datatype.

    In Monkey i found that if you want to mutate structs you need to do something like this:

     

    in reply to: Monkey2 #7996

    cocon
    Participant

    For the record monkey2 has a Vector2 class, unless you want to increase your experience and writing it yourself. 🙂

    in reply to: Does monkey have macros? #7995

    cocon
    Participant

    Also I found today that with the powers of reflection you can literally change the objects at runtime. See reflectiontest.monkey2 example.

    in reply to: Image mask #7994

    cocon
    Participant

    Most common case is to load images is as PNGs, like you load the graphic in Krita and delete the background, alternatively there would be a case that you create the image in memory from scratch. You load the source image, and then read each pixel by pixel – depending on what masked pixels you want to make transparent, you simply won’t draw it. It seems possibly a good idea that it would work, and it would be reusable. 🙂

    in reply to: Fiber confusion (SOLVED?) #7984

    cocon
    Participant

    From Mark’s blog…
    http://monkey2.monkey-x.com/
    “However, unlike real threads, fibers don’t run ‘in parallel’.”

     

    I had tried also some stuff with fibers a while ago and I found that their usage is quite limited, but it’s very specific. From what I found in practical terms, fibers are more useful in event oriented applications (like Ted2Go) where you don’t want your application run in a 60fps loop but neither you want intense loops to freeze your user interface. For example if you have an intense loop, you can throw it in a thread, to let your main app – the gui mostly – be responsive.

     

     

    Generally if your game runs at 60fps you won’t have any problems to use fibers, unless you want to do even more intense calculations (like lightmapping).

    in reply to: Does monkey have macros? #7917

    cocon
    Participant

    You need macros for processor logic or for generating code?

    in reply to: i_editor #7888

    cocon
    Participant

    Hi, the code seems very simple but it is very minified, seems hard to examine. Perhaps I could use a lua IDE and start to rename the variables a bit just to clear things out. However it is impressive. 🙂

    in reply to: smartbuild – A tool for updating the modules. #7868

    cocon
    Participant

    I had also an idea about squeezing it in Ted2Go, perhaps in the summer I will go for it. 🙂

    in reply to: Github : Syntax to highlight Monkey Code here #7853

    cocon
    Participant

    Perhaps there could be a chance that they accept this syntax.

    https://help.github.com/articles/creating-and-highlighting-code-blocks/

    in reply to: Four different ways to iterate. #7783

    cocon
    Participant

    I did a measurement to see for real, time is in millisecs.

     

    Some back story behind this test.
    In real circumstances someone would go for the option A which is the most obvious and well understood concept. So this means that it’s end of story. 🙂 ____ All of the other ways are most close to the concept of internal DSLs (I learnt about it these days) it’s about how you can utilize these techniques to create a very smooth API.  ____ Option B converts your list to array, Option D proves how Monkey can use the To operator effectively to convert from List to List<B>. However option C is my favorite because it provides this smooth API transition, this way you can bypass internal class contents and let the object present itself according to how it is called (To operator in action).

     

    Regarding the benchmarks
    One striking thing to note in these benchmarks is that I never expected that array iteration (B) would be this fast. I had a subconscious fear for this due to this array conversion, (from the point I have a list ready to use – I see no reason to convert it to a list and iterate it) – however as it seems there is some compiler logic that make this happen. As far as I see this conversion happens only once, then the compiler will have to jump straight into array blocks. On the other hand option (A) as it involves objects and pointers, makes accessing the memory much more complicated.

    in reply to: Struct goofiness #7734

    cocon
    Participant

    In the world of C structs technically are a collection of variables, where this is the only way that the data of the program can be modeled.

    However in other object oriented languages, usage of structs has been limited to some very specific purposes. You have to be totally responsible why you need to use structs. Perhaps you might need, compatibility with native C libraries, or having some binary memory alignment, or have some “structs” with very precise lifescope.

    Elevating the features of structs is a trap that high level programming languages make. Perhaps other programming languages as C# want to make life easier and provide some useful features. But in the end it only makes things complicated, because makes design choices ambiguous.

    In practical terms, it’s not about gaining any benefits in speed or efficiency. One user in this forum created some benchmarks to see the difference in speed between classes and structs and the difference is less than 30% (structs are faster).

    in reply to: Is there a concept of Virtual Resolution? #7672

    cocon
    Participant

    I had created a few weeks a test on this, however this is very unpolished and not tested. In the future once I come up with better ideas and a nice API for this I will post the results. For example autofit, change from portrait to landscape, dynamically, zooming, etc…

    My inspiration comes mostly from the 3D rendering and not from exactly from “virtual drawing”. In essence this might go for something like a “camera” approach. The essence is to consider that your game takes place in a “virtual space” and not on actual screen pixels (either real pixels or virtual pixels). For example lets say that you want to render the environment for basketball game, you might put instead of a pixel resolution the actual dimensions of the arena. This is a clever way to abstract your thinking from screen pixels.

    in reply to: Static Lib Hell #7667

    cocon
    Participant

    See here: http://stackoverflow.com/questions/9000485/how-to-compile-a-directx-11-app-in-mingw

    in reply to: English Premier League #7541

    cocon
    Participant

    Hi, welcome to the community, when I started learning Monkey2 was only about anything related to syntax, I could transfer my skills from C# easily, however the only thing that I found trouble was the syntax. Many information can be found in the previous MonkeyX, the languages share lots of similarities.
    https://www.monkey-x.com/docs/html/Home.html

Viewing 15 posts - 211 through 225 (of 342 total)