Recent

Author Topic: General other OS question  (Read 3415 times)

dLm

  • Newbie
  • Posts: 4
General other OS question
« on: October 10, 2023, 06:07:39 pm »
I am new to pascal and Lazarus. Generally speaking how hard is it to optimize a windows program to run on android/iphone ?

Thaddy

  • Hero Member
  • *****
  • Posts: 14382
  • Sensorship about opinions does not belong here.
Re: General other OS question
« Reply #1 on: October 10, 2023, 07:03:15 pm »
Very hard... It is a bit of an exception.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: General other OS question
« Reply #2 on: October 10, 2023, 07:11:18 pm »
Hello dLm,
Welcome to the forum.

Basically it is not hard to rewrite a Windows program to target Android platform if:
- You are the programmer who wrote that Windows program
- The program does not use any Windows specific commands/libraries
- You ever write multi-platforms programs

Reasons that I said it is not hard:
Pascal is relatively easy to learn, if you can write programs in other languages you should not have problem learning Pascal. Lazarus is very powerful IDE for rapid application development (RAD). To be able to develop programs to run on Android, you can use Lazarus Android Module Wizard (LAMW). LAMW integrates nicely into Lazarus. Although you cannot use the default visual components provided by Lazarus, LAMW offers its alternative visual components, which are relatively easy to use.

But it is not fair if I do not tell you the disadvantages of using Lazarus:
Pascal is quite verbose. I heard some users complained about Pascal, one even abandoned it because he could type less in C++. The documentation of Pascal is well written unfortunately the documentation of Lazarus needs some improvements.

If you interested to see Lazarus short demos, you can download them here:
https://wiki.freepascal.org/Portal:HowTo_Demos

You should have some understanding on how Pascal/Lazarus works before you start learning LAMW. Using LAMW is not hard but before you can use it you need to do some preparations, and that is not easy. This is the documentation of LAMW:
https://wiki.lazarus.freepascal.org/LAMW

Because of man power issue, the documentation of LAMW does not offer much detail. The good things is, you can find plenty of demos after you install LAMW. They are really helpful. And if you have problems using LAMW/Lazarus/Pascal, many users in the forum will give very helpful answers.

I am not a skilled user in LAMW but I ever used it to write my Linux/Win/Android cross platform graphics library. Things run smoothly, unfortunately I had to stop it because I became busy working on other things and I found bugs in LAMW's OpenGL components.
« Last Edit: October 10, 2023, 08:33:22 pm by Handoko »

dLm

  • Newbie
  • Posts: 4
Re: General other OS question
« Reply #3 on: October 10, 2023, 10:17:12 pm »
Thanks for the warm welcome...

Hmm.. I obviously have more research to do. I used to program in visual basic back in the early 2000s and more recently wordpress websites. The project I am working on is for a mobile game that I play Puzzles and Survival. There is a mini game water sorter in game that I found an open source example for but it wouldn't correctly work when you add 12 or more colors. I sorted through the code and I got it working for up to 14 colors, which is currently the max in the mini game in PNS. However, with it being a mobile game offered on PC not too many play on PC and I was hoping to be able to optimize it for mobile so my guild mates could use it, not just myself.

Also would LAMW include working on apple OS as well?
« Last Edit: October 10, 2023, 10:53:37 pm by dLm »

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: General other OS question
« Reply #4 on: October 11, 2023, 12:41:49 pm »
I haven't used LAMW for quite a long time but I remember the last time I used it, LAMW didn't support Apple OS.

If your goal is building games you should consider the tools that are specialized for game development first, like Unreal Engine, Unity, CryEngine, RPG Maker, Stencyl, Construct 2, GDevelop. I ever spent some time learning Construct Classic (Construct version 1) and GDevelop. Impressive, free and very easy to use you can build simple games after half an hour trying it. Unfortunately their later versions are no longer free.

When I was kid I was very curious how video game hardware and software work and I enjoy problem solving, so Lazarus suits me. Although the tools specialized for game development really offer more features for building games than Lazarus but that isn't my main goal.

If you're not willing to spend much money on the tools like those I mentioned, you can try ZGameEditor. It is open source, you write only once and it can generate Linux, Mac OS X and Android binaries for you.
http://www.zgameeditor.org/index.php/Main/Features

ZGameEditor script language is Pascal, which is a plus for me. I really put some efforts learning it. Later I realized, their development was mainly on Windows but I was a Linux user, so I stopped using it.

And the best of the free game development tool is Godot Engine:
https://godotengine.org/

I tried Godot Engine, downloaded some demos and generated binaries for Linux, Windows and Android. I was speechless. I never known I could build multi-platform games so easy. I can be sure to tell you, you can build games for Windows, Linux and Android using Lazarus and with LAMW. But Godot is the king, because for the multi-platform export features, it just as easy as clicking some settings.

Game development tools will surely make you more productive. But I am not a very creative person, I prefer a general purpose tool. So far Lazarus is the best (for me)
« Last Edit: October 11, 2023, 02:03:13 pm by Handoko »

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: General other OS question
« Reply #5 on: October 11, 2023, 01:59:20 pm »
I almost forget. You may want to consider:
https://castle-engine.io/

The development was a bit slow but since some years it has been financially supported using Patreon, many new features have been added.

I tried it long ago before it could be used for developing Android games and visual editor have not been implemented yet, etc, not much I can say about it.
« Last Edit: October 11, 2023, 03:18:56 pm by Handoko »

Seenkao

  • Hero Member
  • *****
  • Posts: 550
    • New ZenGL.
Re: General other OS question
« Reply #6 on: October 11, 2023, 02:25:27 pm »
Если вы сами писали код программы, то вы можете попробовать использовать ZenGL.
Его проблемы - это:
- собирать надо под каждую платформу отдельно.
- нет автономного сборщика проектов, потому настраивать проекты надо самому (на данное время).

Плюсы:
- достаточно знать Паскаль для написания программы и не обязательно знать OpenGL, DirectX или что-то подобное.
- есть демонстрационные примеры для начальной работы.
- не малая собственная функциональность.

Если вы в самом деле решите попробовать, то для Android вы можете использовать одну из демок под свой проект, чтоб не задумываться как изначально собрать проект. И здесь информация по подготовке к сборке проекта под Android.

Проверьте демонстрационные примеры, а потом попробуйте собрать свой проект.
Успехов!

---------------------------------------------------------------
Google translate:
If you wrote the program code yourself, then you can try using ZenGL.
His problems are:
- you need to assemble it separately for each platform.
- there is no autonomous project collector, so you need to configure projects yourself (at this time).

Pros:
- it is enough to know Pascal to write a program and it is not necessary to know OpenGL, DirectX or anything like that.
- there are demo examples for initial work.
- not a small functionality of its own.

If you really decide to try, then for Android you can use one of the demos for your project, so as not to think about how to initially assemble the project. And here is information on preparing to build a project for Android.

Check out the demos and then try building your own project.
Good luck!  ;)
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

jcmontherock

  • Full Member
  • ***
  • Posts: 236
Re: General other OS question
« Reply #7 on: October 11, 2023, 04:15:53 pm »
You can see b4x.com...
Windows 11 UTF8-64 - Lazarus 3.2-64 - FPC 3.2.2

dLm

  • Newbie
  • Posts: 4
Re: General other OS question
« Reply #8 on: October 11, 2023, 05:58:47 pm »
So in order to get this thing to work for mobile I would have to write and compile a PC version, an android version and an iOS version?

loaded

  • Hero Member
  • *****
  • Posts: 825
Re: General other OS question
« Reply #9 on: October 11, 2023, 06:27:33 pm »
So in order to get this thing to work for mobile I would have to write and compile a PC version, an android version and an iOS version?

If your goal is to write a game and you want to run it smoothly on the following platforms;
Web, Windows, Android, iOS, Nintendo , PlayStation, Xbox, VR ...
I think you should try Unity.

I remember that in a study I did 5~6 years ago, multi-platform compilations worked quickly and smoothly. I think he's in better shape now.

A made example;
https://www.youtube.com/watch?v=GXI0l3yqBrA&list=RDCMUCG08EqOAXJk_YXPDsAvReSg&index=2&ab_channel=Unity
« Last Edit: October 11, 2023, 06:30:59 pm by loaded »
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

Seenkao

  • Hero Member
  • *****
  • Posts: 550
    • New ZenGL.
Re: General other OS question
« Reply #10 on: October 11, 2023, 06:56:37 pm »
So in order to get this thing to work for mobile I would have to write and compile a PC version, an android version and an iOS version?
Да, это наиболее правильное понимание происходящего. Для каждой платформы должно быть своё приложение. Универсальное приложение собой ни чего хорошего не несёт, кроме того, что оно универсальное.
И, я не видел ещё ни одной программы на FPC/Lazarus где было сделано универсальное приложение.

Если программы должны общаться между собой через интернет, то компиляция под определённую ОС ни как не должна повлиять на работу приложения. Одно и то же приложение, скомпилированное под разные ОС передаёт одни и те же данные для взаимодействия на разных устройствах.

Google translate:
Yes, this is the most correct understanding of what is happening. Each platform should have its own application. A universal application does not bring anything good, except that it is universal.
And, I have not yet seen a single program on FPC/Lazarus where a universal application was made.

If programs must communicate with each other via the Internet, then compilation for a specific OS should not in any way affect the operation of the application. The same application compiled for different OS transmits the same data for interaction on different devices.
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

dLm

  • Newbie
  • Posts: 4
Re: General other OS question
« Reply #11 on: October 11, 2023, 07:23:26 pm »
Here is a sample of the program that I am trying to optimize for android and iOS. Like i said it was an open source application but it stopped working correctly when color counts got higher. I got it working through my max colors (14) but now I am looking to optimize it for android and iOS

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: General other OS question
« Reply #12 on: October 11, 2023, 07:40:44 pm »
So in order to get this thing to work for mobile I would have to write and compile a PC version, an android version and an iOS version?

Which one you're asking about?

I haven't tested all the game development tools I mentioned above. But most of the them allow you to just write one code and generate binaries for Windows, Linux, Android, etc. For Construct Classic and GDevelop the same code can be used to generate binaries for Windows and Linux but their newer versions can also produce Android APKs.

As I said I haven't tested them all but the most impressive one I've tested so far is Godot Engine. It's free, I run the simple game demo on my desktop computer and that same code could be easily to be exported to Android APK. And I was amazed the same game code, which was running on my wide screen monitor then could be fit on my tall screen Android phone. No need to change any code, it worked like magic.

Most game development tools provide you a good visual editor, you can drag and drop items to design the game world. I said write code, well, that's not actually correct. Some of them allow you to design games without write a single line of code. Some call this kind of development tools game builder.

Building games using Lazarus is very different than all of them. Lazarus and Lazarus+LAMW is not game builder. Not sure but Castle Game Engine, which can be used with Lazarus, has its own game editor.

If you're good in Lazarus, same code you write can be targeted to both Windows and Linux (I don't use MacOS, I can't say anything about it). But to target Android platform you need to rewrite the code, as I said previously all the default visual components provided by Lazarus can't be used in LAMW. The good thing is you can write units (or non-Pascal users may call it modules), which can be used and shared for Windows, Linux and Android. So the core engine, game calculations, and many things can be write only once and be shared for multiple platforms. Then you just need to write the graphics engine unit for each of the targeted platforms. And if you know how, the Windows and Linux graphics engines can be merged into a single code. It may sound difficult, actually it can be easily done in Lazarus if you have the knowledge and time for studying it.

For ZenGL, I haven't really tested it, I can't say much about. It has less non-game related features compare to LAMW. For example in LAMW you can have ready to used components like jMenu, jEditText, jButton, jCheckBox, jProgressBar, jCustomDialog, jChronometer,  jDatePickerDialog, jDownloadManager, jCamera, jLocation, jBluetooth, etc. But ZenGL provides you a powerful graphics tool, in LAMW you need to write your own graphics engine first before you can write game using it. In short, ZenGL is a graphics engine that can be used to develop Android programs, LAMW is a tool to allow you to generate Android program using Lazarus. To write a complete game using Lazarus, usually you need game engine + graphics engine.

If you just want create games, don't use Lazarus. Because the default installation of Lazarus does not provide you any game engines and graphics engine. Yes you can install them yourself but it needs time to study it. Game engines and graphics engines can have overlap features, it is a bit hard to categorized which it is belong to.
https://wiki.freepascal.org/Game_Engine
https://wiki.freepascal.org/Choosing_a_Game_Engine
https://wiki.freepascal.org/Game_framework
https://wiki.freepascal.org/Developing_with_Graphics
« Last Edit: October 12, 2023, 11:25:32 am by Handoko »

Seenkao

  • Hero Member
  • *****
  • Posts: 550
    • New ZenGL.
Re: General other OS question
« Reply #13 on: October 11, 2023, 08:31:34 pm »
Here is a sample of the program that I am trying to optimize for android and iOS.
Данное приложение нельзя просто взять и перенести на мобильные платформы. Уже писали, что у Lazarus не совместимые графические компоненты с мобильными платформами.

Google translate:
This application cannot simply be taken and transferred to mobile platforms. It has already been written that Lazarus has incompatible graphic components with mobile platforms.
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

 

TinyPortal © 2005-2018