Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reflections+thoughts] modular programming #2668

Open
atesin opened this issue Sep 2, 2024 · 3 comments
Open

[reflections+thoughts] modular programming #2668

atesin opened this issue Sep 2, 2024 · 3 comments

Comments

@atesin
Copy link

atesin commented Sep 2, 2024

Hello, I hope this message were understood, I know it is a bit long so for my convenience I wrote it in Spanish (I am Chilean) and translated mostly with Google Translate, I hope @nesbox and @oblerion read it since it has to do with TIC-80 and code development

Let's be honest, I love TIC-80, it looks like the Atari I had when I was a kid, and although it is used by many people with low-level programming knowledge (assembler, memory maps, etc.), because of its simplicity it has also been chosen by more beginners to learn to program, although interface could be a little "harsh".

Lua ​​may be a powerful language but it is simple, and that is why it is generally not the favorite option when developing "serious" programs, for these generally C++, C#, Java, or some well-known engine is used. so don't expect many proffessional developers doing AAA applications in TIC-80, i see is mostly used for experiments, amateur programs or little games.

I am trying to learn to code by programming games using TIC-80, I find it more motivating this way. As I am writing, I realize that the program must perform many repetitive tasks, which I group into functions. Many of these functions can be common between several projects, such as creating objects, drawing sprites or reading inputs, which are grouped into libraries (I even published a "library" cartridge to read the joystick vectorially, see my profile https://tic80.com/dev?id=8725 ).

I think that grouping and reusing code is an important part of development: it keeps ideas organized, saves time, facilitates abstract thinking, and in general makes the whole process easier. But when you can't and you have to keep all the code in a single view, fluid development becomes hard.

That's why I've started several issues asking for code editor in tabs, including multiple files or using external IDEs, or enhance website in browsing projects; all of them are related to the same idea of ​​grouping functions/objects into libraries and reusing them abstractly. I think letting TIC-80 allow development in this way is essential to help beginners in learning (like me) and to experts to develop more agile, please get involved in letting use require(), importing code, and/or external ides on standard release.

@atesin atesin changed the title [reflections] modular programming [reflections+thoughts] modular programming Sep 2, 2024
@oblerion
Copy link

oblerion commented Sep 4, 2024

please get involved in letting use require(), importing code, and/or external ides on standard release.

I'm an engine developer (C / lua).
And it's complex to use more than one script.

Why is that?

    1. You have memory space for a single cartridge,
      if you import too many scripts, it's easy to saturate.
    1. If a player modifies your library.
      You have no control over what he can change in your game.
      Lua can write/read files, which can be dangerous.
    1. how do external script interact with export game ?

The TIC-80 needs more security and a dynamic memory cartridge for that.

Or you need to make a custom require() to import functions/tables with limited Lua functionality.
And test the space for the cartridge code.

It's huge edit for fantasy computer.

@oblerion
Copy link

oblerion commented Sep 4, 2024

I wrote it in Spanish (I am Chilean) and translated mostly with Google Translate

it's more powerful than google => https://www.deepl.com

@atesin
Copy link
Author

atesin commented Sep 4, 2024

please get involved in letting use require(), importing code, and/or external ides on standard release.

I'm an engine developer (C / lua). And it's complex to use more than one script.

Why is that?

* 1. You have memory space for a single cartridge,
     if you import too many scripts, it's easy to saturate.

* 2. If a player modifies your library.
     You have no control over what he can change in your game.
     Lua can write/read files, which can be dangerous.

* 3. how do external script interact with export game ?

The TIC-80 needs more security and a dynamic memory cartridge for that.

Or you need to make a custom require() to import functions/tables with limited Lua functionality. And test the space for the cartridge code.

It's huge edit for fantasy computer.

i agree with you mostly, but i mean in development stage... in packaged cart files we have to merge all code inside obviously, but maybe we can make your fantastic tic80 package for zerobrane do all the work for us everytime

i posted a solution here but better keep with analisys and let technical questions in tic80 for zeropbrane repo here: oblerion/ZeroBrane-Studio-with-TIC-80#8

i remark that would be only for development process not for cart packaging and distribution, for that we can rely on tools like mentioned... for libraries the final user should copy related functions and paste in their own lua files himself one time to be used

if file lua code size exceeds tic80 code editor space then i think tic80 will print an alert right?... or not? o_Ô

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants