I wrote several versions from scratch of the program core until spending time to delve deeper into the Design Patterns..
I also watched the organization of 2 excellent existing video game engines: Godot Engine and Defold.
Following that, I started everything again from scratch and began to use GIT locally while writing the Java version and javascript in parallel.
I ensure that the two versions are as identical as possible for the user in order to facilitate the translation of the code from one version to another.
The organization of my code seems consistent now with what I wish to implement.
I’m really trying to have a modular and coherent code to be able to extend it without it becoming incomprehensible!
That’s why I spent so much time doing and redoing the core of the program!
N.B. I expect to have to do quite a few refactorizations when I handle the physics engine but... everything in its own time!: )
The "heart of the program"
Tree of "Nodes" similar in spirit to Godot Engine with a component system similar to Defold!
Particular graphics nodes for the graphical interface in the same tree (so there, not like in Defold at all)
I will give a more thorough explanation at the beginning of the documentation but this tries to respond to criticisms that I would have to make both in Godot and Defold
It’s logical: since I’m doing a new thing!
GUI system with a management of themes that can be changed at any time (all widgets update automatically).
Visualization of the tree of nodes and components in progress (same principle in the spirit as in Godot)
The output is in the console for now but will be in a widget when it is available.
Error messages for debugging in a particular function (same as above).
Functions pLoad...(or methods)
(automatic waiting for file loading with a scroll bar)
Management of keyboard entries with possible modifications during the program’s progress
(notably to manage the different keyboards / languages).
User language detection (Javascript)
Date (day/month/year)
9/4/25 - #21. Preload Java and JS ok
21/4/25 - #21.4. Keyboard inputs
Project on hold: I had to take care of other things for a while!
4/8/25 - #22.4. & #22.5.: Responsiveness of Java code with the same method as Javascript.
Not ok without windowRatio() in Java because width and height don’t seem to update in Java!
Reported in the Processing Forum
5/8/25 - #22.6. : JAVA-JS compatibility / language detection in the browser in JS
5/8/25 - #22.7. : removeItem() removed from JS specific code
11/8/25: #22.9. use of instanceof, remove NodeType, create WidgetType
12/8/25 - #22.10 prepaAI: Responsive now works without windowRatio() with P2D (thanks to the Processing Forum)!
12/8/25: Translation from Java code to JS with OpenIA
15/8/25 : Breaking News (lol) : I've used (to try) Gemini IA... and the translated Java #22.10 version almost works in P5js (with minor modifications !) : investigation in progress ! see here
The main problem with openIA was that I couldn’t send everything at once.
Do the translation from Processing to P5JS of the code following line:
// START CODE
Translate only the syntax (do not change the code, do not modify the functions, do not add functions)
Do not add or edit comments.
The part of the code located between the line
//----------------SPECIFIQUE JS start-------------
and the line
//----------------SPECIFIQUE JS end-------------
is not to be translated because it is already in P5js
Variables declared in java but not initialized to a value must be declared and initialized to the null value.
--> followed with all the Java + JS code (all the tabs in a single text)
16/8/25 : Gemini did not write a ‘let’ for many variable declarations. It is perhaps this that causes problems because if variables that must be local are declared as global, it will work in most cases… but not all!
I will start again by specifying to it : Precede the declarations of new variables (those which are preceded by a type name of variables in Java such as String, float, Boolean, PFont, PImage,int ...) with the JavaScript instruction let).
+
For file uploads, precede them with their path, namely: data/
+
use the javascript strict mode
Done and it works fine (almost) !
Just an error in a function name and something Ihat I've to change in the JS part !
Fixed and no error in strict mode !
So we can use AI for transpilation sometimes to save time (provided that it can also be done without ! ).
16/8/25 - #23. Java version #22.10 translation in JS with Gemini: ok
19/8/25 - #24. Small settings in the demo
21/8/25 : #24.1. Small modifications without using global positions for the Demo to work properly
Problems with global positions in JS: investigation in progress
(not necessarily in this order)
Delete ComponentType (instanceof) ?
Website: put a button / translation in French on each page
Put the project on a software forge (probably codeberg.org)
Change the name of the listen() method to listenedBy() for a better readability
Comments
Translate the French comments into English (/IA)
Write all the Javadoc comments
In the Java code, copy/paste the signatures of the methods into comments on the same line so that they end up in the JS code after a translation /IA
Improvement of the keyboard detection system to manage the simultaneous pressing of several keys
Label + Containers
AnimatedSprite2D
Sound management
Particle system (Shiffman reference)
Buttons System (Texts or images)
Button on the sketch instead of keyboard inputs (JS compatibility on smartphone)
waiting for a version of the Java app on Android
INSTRUCTIONS FOR MAKING DRAWINGS WITH A "TURTLE" (cf turtle of Logo)?
(made with Violet UML Editor)
Movements with velocity, acceleration... and collisions response
Classic graphical interface BASIC version
(Quickly done graphically to test the functions / GUI)
Management of several languages (French and English in particular) for all the texts.
Sound effects and management of audio texts in several languages.
FLAT and SF graphical interfaces (neat graphics)
A transition system for the appearance and disappearance of interface elements.
Circular interface
Import/Export of information using in a transparent way for the framework user XML and JSON.
(the use of external files will be essential to my project of (quasi-) static website editor for example)
Text editor widget "rich" genre tinyHTML
(from Processing or using Processing in a classic Java environment)
Reflection in progress
Writing code (cf PixelPhysics for example)
Use of an external biliotheca
(Box2D: Java, javascript
Matter.js: Java, Javascript
...)
in due time !
Initially, a simple game with a small spaceship in an asteroid field (French/English graphical interface, velocity, accelerations, collisions, animations, particle system, sounds, French/English audio texts)
Sets of memos from an XML file and associated images that can be determined by a user to allow associations such as leaves/tree names or other things to be memorized (the / XML functions can then be used in the next project)
(with a dynamic look inside!)
Merging html templates with data saved in XML (or JSON to see) from a graphical interface.
In a second step, use of FTP by the application to send the files.
Then, optionally write PHP files to add a dynamic part for certain functions (like a contact form).
I will surely end up using Javascript programs also written with the JS version of the engine!
(which will be downloaded to the server by the program)