Baby steps[python]: Gamejectder

Good day,

Today it’s a big milestone for my trip through the Haikuverse. I finally was able to port Gamejectder, the simple Python app I made with GTK on Linux, to Qt on Haiku, with some improvements (settings, personalized icons). The idea was based on the title of a book “Automate the boring stuff with Python”.
Gamejectder
(don’t know why the image gets cropped in the about window)

The goal of this GUI frontend to some Python code is to automate the creation of all the folders and files I use when I start a Game Project, before with Unity on Linux, now with Godot on Linux, tomorrow with Godot on Haiku… eeer… today??? :astonished: :astonished: :astonished:

Not ready for others to use yet, I know the flaws so I can use this, though need to tweak some stuff, then finally try to package it with Cython. Besides, the folder structure of a project is something somewhat personal :wink:

In the meantime, this is what it does:

screenshot1

It’s far from perfect yet, as it does not use the Haiku native API. But it’s a first step and will allow me to automate the boring task of creating all the folders and the files. Need to check if Godot for Haiku opens the ‘project.godot’ file without issues, as it does in Linux.

Presumably, when I get myself dirty with the Python Haiku API, just will need to change the GUI python file, as it’s independent, as independent as I could achieve, of any other file in the project.

When I fix some issues, will put it on GitLab… er, well, I still need to learn a bit more on using Git. :thinking:

There are new ideas hanging around somewhere too. We’ll get there. Hopefully. And with Godot starting to be usable on my Haikbox, mmmm… :yum: :yum: :yum: :yum: :yum: :yum: :yum: :yum: :yum: :yum:

Regards,
RR

PS: Nope, Panda3D does not work on Haiku, at least not yet.

9 Likes

Blender3D is anyways better… and it runs if I’m not mistaken.

1 Like

You project only created folders and files, or does it useable like a development Editor?

Things like this are easy doable with yab. Looks like haiku, useable like haiku, easy to learn :wink:

Good day @lelldorin,

Right now creates folders and three files, a README.txt, a ‘project.godot’ file to launch Godot game engine (this works on linux, not yet on Haiku, I need to dig into the filetypes stuff), and a database file (SQLite), for project tracking.

And now, if several projects are created, it assings different color to the folder, random color:
screenshot2

Why I don’t use YAB? Well, I started making games on Linux with Unity3D and C#. Thanks to Haiku met Godot, uses GDScript which is similar to Python, so decided to move to Godot and use GDScript there and Python for the software. The first tool I made to automate the game project folder structure was made with Python and GnomeBuilder, so I decided to stay on Python, that way I just need to care about a “single” language… :wink:

With limited time, I must optimize resources. :smiley:

Hopefully there will be some project management tool in the “near future”, understanding “near” according to my slow pace terms… :rofl: :rofl:

Regards,
RR

I does not mean to create games in yab, if you can c# you does not need it, only creating your app for haiku in a different way ;-).

Example: Here a editor for the egsl language (written in yab)

Ok it is without folder creating, because not needed but this is no problem. I create at startup every needed folders, files if they are not available.

Good day @dragon,

I have yet to get Blender working on Haiku 64b. The one in HaikuDepot is not usable on my box. I tried the package provided by @cocobean and some dependencies not yet met.

I’ll keep trying.

Regards,
RR

Good day @lelldorin,

I see your point now :wink: I’ll take a look at it and try to do something. When I finish this Gamejectder… I should be finishing the ARO v1.2 game on Godot on Linux though… delays, delays, delays… :rofl: :rofl: :rofl:

Regards,
RR

Yab can be a solution to create a godot Editor. If you have interest, i can help you by this.

Don’t try to do to many things at the same time, you’ll burn yourself up :wink:

2 Likes
  • Blender 2.79b rebuilt for Haiku R1B2+.
  • Blender 2.80 was built for Haiku R1B1, so need to rebuild for Haiku R1B2+ to work there.
  • Blender 2.90 - currently reviewing for Haiku R1B2+.

.

:smile: :smile: :smile:
Don’t worry, I have a task list and it’s a FIFO with some degree of sideloading, but the sideloading chances are very few unless it is something I’m “extremely”, and extremely is extremely high tag, interested on.

Thanks for your advice @Begasus.
Regards,
RR

2 Likes

I know myself, can be distracted quite easy if someone steps up with some question :wink:

Good day,

After making a complete mess with the code due to lack of Git knowledge, and having to redo things a bit, some weeks out of Haiku due to work issues which always results in forgetting about things, I finally got a bit closer to the final result:

Gamejectder

The image shows the Application Gamejectder with its icon on the Deskbar. Gamejectder is a Python (PyQt) app. Now, this is not perfect as what I did is use Cython to get the Python script turned into C code and then compile it with GCC. I just did this for the ‘main’ script, the one that launches the app. Other scripts are left as is.

As I have no idea on C, nor C++, nor how to properly use GCC, beware of what you are about to read, might harm the minds of the real devs :innocent:. This is what I’ve been doing:

1- I tried to Cythonize the inner parts (core and gui), resulting in .so libraries to be used by the final executable that embeds the Python interpreter.
2- I, with some effort, got to Cythonize multiple modules into a single .so library (got 2 .so libraries instead of one per Python module -8 modules = 8 libraries-).
3- Used GCC to link against that library. It results in an executable too, but this executable complains about the .so not found on the system. I don’t want to have those .so installed on the system because those are just used by this small app. That is not the path to follow here.
4- Then, after quite some tedious search, I found that I could join libraries into a static one. So I did with both .so joining them into a lib.a.
5- Used GCC again linking against the new recently created static library, resulting in another executable. Does not run either:

GamejectderTerm

In fact, I should have tried first to import the .so inside the Python interpreter. Both core.so and guis.so don’t work, as they include all the modules below. Not sure yet why. IIRC, having a .so per module seems to load the module correctly inside the Python interpreter. Need more research and study.

Therefore, Cythonizing the program launcher and compiling it (leaving the other modules untouched) allows the software to integrate with Haiku a bit better than just plain Python script (double click, Deskbar icon, Haiku’s application signature…). It still depends on the other modules (python scripts) that need to be packaged with the executable in order to run.
GamejectderRdef

This is not what I was trying to achieve:

  • Make a simple Python application for Haiku (done)
  • Use Haiku API (not done. Used PyQt)
  • Make the Application as close as possible to single file (not achieved)
  • Make the Application integrate with Haiku (partial?)

I still need to do some research and study on how to get the whole thing into let’s say, the executable file and a library or two, if that is possible.

The easy part now is the packaging. Making a .hpkg. Before that, I have to do some clean up and update the Git repo with the changes (hope won’t mess it again :rofl: :rofl: :rofl: ). I made some backups, just in case, because I still have to learn how not to mess Git.

Any further improvement on the topic will be added here.

As a side result, I found out that changing the color of an icon (by code) is possible if the icon is properly designed. Gamejectder picks a different random color for each project folder and sets all folders for that project with that color.

I forgot, I checked with PyInstaller, Nuitka, Briefcase. None of them work to “freeze” the Python code into an executable on Haiku. That was one of the goals of this tiny project. Maybe could get one of them to work properly, and that would be a big leap forward, I presume. I checked, iirc, the code of Briefcase, and got it to see Haiku as a platform, but not much more, as they require X11, also iirc. Of course if one of those options end up working on Haiku as a viable way to freeze Python code and distribute software, my time on this would have been wasted :joy: :joy: :joy:

I also found out that to do things on Haiku, one needs to know a lot more than, let’s say i.e., Gnome. The more I dig, the more I know that I don’t know anything yet… :dizzy_face: :dizzy_face: :dizzy_face:

Regards,
RR

2 Likes

You can put the libs in a folder named “lib” next to the executable. Haiku will search there and find them.

1 Like

Good day,

Well, as @PulkoMandy said, putting the .so files in the ‘lib’ folder next to the executable solves the “missing libraries” issue. Thanks for the tip!!

After solving that prior issue, a bigger one came out. This I am certain is related to my skills(lack of them). Need to better understand setup.py and modules and how to better deal with them in Cython. I might be doing plenty of things wrong when making the modules and turning them into .so files.
[edited]: Yes, the problem is in the setup.py and building the libs. Need better understanding, study more :joy: :joy: :joy:

Need more time to do research. We’ll get there though. Hopefully I can come up with a solution and a way to automate the whole process.

Regards,
RR

1 Like

Good day,

Well, I finally sort of got it half way:

Files

As the less .so files approach didn’t work yet, we will see if it does in the future, I went the multi .so files way.

Funny thing is, launching the application from the Terminal, everything works. Launching the application with double click, it launches though showing issues:

From Terminal:
Terminal

By double click:
DoubleClick

As we see here, the application .png image is not shown. Also, with double click, the app crashes when creating the project. It seems to miss where to find the icon resources in the ‘xtra’ folder, while launching from Terminal completes the process without issues. Any hint will be appreciated.

I presume there are issues with my ‘setup.py’ file. I let Haiku write a report when the app crashed, but I don’t understand a single thing :rofl: :rofl: :rofl: :rofl:

When I solve the double click issue, I could call this ‘done’, though far from the desired goal. Next step will be to replicate the process with another simple app in order to get a default ‘method’.

Regards,
RR

1 Like

Not sure if it’s related, but maybe you could have a look like similar patches?

I assume that when you launch it in a terminal you are in the right directory already.
Did you try to call it from a random directory? Do you have the png showing then?

Good day,

Thanks @Begasus, I’ll take a look at it this weekend, as soon as I get some Haiku time.

@Starcrasher, will do that test too. I have the feeling it will fail. I still need to understand how to properly reference data, inside the code and inside the setup.py file.

Thanks both.
Regards,
RR

When Python crashes properly, it’s supposed to spew out a traceback that illuminates the nature and location of the cause.

An application that’s built to be invoked from the graphic interface via an icon, might ought to redirect its “stderr” output (POSIX unit 2) to a log file. You’d be able to view the traceback there - along with any other diagnostic output, like perhaps complaints about image files not found.