MSXgl – A new C game library for MSX

Pagina 17/17
10 | 11 | 12 | 13 | 14 | 15 | 16 |

Van wimpie3

Champion (420)

afbeelding van wimpie3

28-08-2022, 10:51

Book? There is no book on MSXgl as far as I know. Aren't you talking about Fusion-C?

Van aoineko

Hero (540)

afbeelding van aoineko

28-08-2022, 12:09

janghang wrote:

I bought the book from Amazon.

I don't sell books. I think you are confusing with Fusion-C. :)

janghang wrote:

Compared to other assembly-based codes, how's performance or speed of the game created with MSXgl?

It's hard to answer. We would have to redo the same program with different game libraries to be able to compare.
All I can say is that I pay a lot of attention to performance and that the all optimizations I find (on MRC, MAP or in the technical docs) are integrated in MSXgl at some point. For example, the library has built-in fast memory copy functions using 16x unrolled out loops.

janghang wrote:

Using MSXgl, can we create a game running at speed similar to machine codes?

The obvious answer is no. If we are talking about a well thought-out and optimized assembly program, no C program will never be able to compete with its performance.
That said, the most expensive parts (like the VRAM copies) being written in assembler in MSXgl, their performance is close to a well optimized assembler program.
In fact, what can really make the performance of the program decrease is the gameplay code. And it's up to the programmer to be careful with. In C, you can quickly create a slow code without necessarily realizing it. On the other hand, I personally think that it is sometimes easier to write complex algorithms to gain performance in C than in assembler (at least I think that even assembler gurus will admit that C offers a much better code readability).

If I had to summarize, I would say that if you are able to write an optimized assembler code, need 100% performance and are familiar with MSX hardware, there is no debate: do assembler.
Otherwise, I think MSXgl is a good alternative to easily create games on MSX with very good performance.

Van Arsenikum

Supporter (6)

afbeelding van Arsenikum

17-09-2022, 19:28

Hello! Can you give me an advice, what am I doing wrong?
Suppose, I have this code:

const c8* test = "Hello MSX World";
struct InvestPic
{
const c8* Name;
};
const struct InvestPic g_InvestPics[] =
{
{test},
};

If I write in main program
Print_DrawText(g_InvestPics[0].Name);
then compile would be ok, but the screen would show a total mess instead "Hello MSX World".
"const c8* test" part is mandatory, supposed that it will be in another h. file.

Thank you!

Van aoineko

Hero (540)

afbeelding van aoineko

17-09-2022, 20:07

I tested your code in the s_hello sample and the text displays fine.
Is your font initialized correctly?

Both Print_DrawText(g_InvestPics[0].Name); and Print_DrawText(test); display "Hello MSX World".

If you want to have a more direct help, you can contact me on Discord: https://discord.gg/pMeadGfv8E

Van Arsenikum

Supporter (6)

afbeelding van Arsenikum

17-09-2022, 20:30

Thank you, joined to Discord channel.

Van Arsenikum

Supporter (6)

afbeelding van Arsenikum

17-09-2022, 21:33

This works:
Using const c8 test[] = "Hello MSX World";
instead of const c8* test = "Hello MSX World";
Thanks aoineko!

Pagina 17/17
10 | 11 | 12 | 13 | 14 | 15 | 16 |