From 4b667a6fa805b71c3948d279bede1ba87efc460a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Tue, 11 Mar 2025 22:31:24 +0300 Subject: [PATCH] =?UTF-8?q?2025-03=20=D0=A2=D1=80=D0=B0=D0=BD=D1=81=D0=BB?= =?UTF-8?q?=D1=8F=D1=82=D0=BE=D1=80=20CLD=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80?= =?UTF-8?q?=D0=B8=D1=82=20=D0=9A=D0=BE=D0=BD=D1=82=D0=B5=D0=BA=D1=81=D1=82?= =?UTF-8?q?=20|=20CLD=20translator=20generates=20Context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/news/2025-03_cld_ctx-gen.md | 134 ++++++++++++++++++++++ en/news/cld_ctx-gen.html | 168 ++++++++++++++++++++++++++++ en/news/index.html | 48 ++++---- en/news/index2.html | 39 ++++--- en/news/index3.html | 34 +++--- en/news/index4.html | 32 +++--- en/news/index5.html | 40 +++---- en/news/index6.html | 39 ++++--- en/news/index7.html | 34 +++--- en/news/index8.html | 37 ++++--- en/news/index9.html | 55 ++++++++++ images/2025-03_redux-data-flow.jpg | Bin 0 -> 65594 bytes ru/news/2025-03_cld_ctx-gen.md | 137 +++++++++++++++++++++++ ru/news/cld_ctx-gen.html | 171 +++++++++++++++++++++++++++++ ru/news/ctx-gen.html | 168 ++++++++++++++++++++++++++++ ru/news/index.html | 47 ++++---- ru/news/index2.html | 38 ++++--- ru/news/index3.html | 34 +++--- ru/news/index4.html | 32 +++--- ru/news/index5.html | 39 +++---- ru/news/index6.html | 38 ++++--- ru/news/index7.html | 34 +++--- ru/news/index8.html | 37 ++++--- 23 files changed, 1145 insertions(+), 290 deletions(-) create mode 100644 en/news/2025-03_cld_ctx-gen.md create mode 100644 en/news/cld_ctx-gen.html create mode 100644 en/news/index9.html create mode 100644 images/2025-03_redux-data-flow.jpg create mode 100644 ru/news/2025-03_cld_ctx-gen.md create mode 100644 ru/news/cld_ctx-gen.html create mode 100644 ru/news/ctx-gen.html diff --git a/en/news/2025-03_cld_ctx-gen.md b/en/news/2025-03_cld_ctx-gen.md new file mode 100644 index 0000000..5b401c4 --- /dev/null +++ b/en/news/2025-03_cld_ctx-gen.md @@ -0,0 +1,134 @@ +Title: CLD: Context generation +Date: 2025-03-11 00:00 +Category: News +Slug: cld_ctx-gen +Lang: en + +![splash][splash] + +# Context generation + +In February I've updated the **C**ross-**l**anguage **d**ialect (CLD) translator to +generate Context out of YML. The generated Contexts have already been +used for the following projects: + +* CLD (the CLD translator generated its own Context) +* LHA +* PSKOV + +I never really took time to explain what Context is, so here's +a very short explanation: Context is very close to +[Store in Redux][store]. I'm afraid this is not yet the time +to explain Context in detail because I don't yet have a good +argument why you need Context. Once that time comes I do it. + +Now let's get back to the Context generation. Here's how LHA's YML for Context looks like: ([entities.yml][entities]): + +``` +# Application state context +Context: + type: context + fields: + # Command line arguments + arguments: [String] + consoleOutput: String + defaultDir: String + didLaunch: Bool + dir: String + httpDefaultPort: Int + httpLaunch: Bool + httpPort: Int + httpReply: String + httpRequest: NetRequest +``` + +CLD translator converts it to the following code in Kotlin ([entities.kt][entities-result]): + +``` +// Application state context +data class Context( + // Command line arguments + var arguments: Array = arrayOf(), + var consoleOutput: String = "", + var defaultDir: String = "", + var didLaunch: Boolean = false, + var dir: String = "", + var httpDefaultPort: Int = 0, + var httpLaunch: Boolean = false, + var httpPort: Int = 0, + var httpReply: String = "", + var httpRequest: NetRequest = NetRequest(), + override var recentField: String = "", +): CLDContext { + override fun field(name: String): T { + if (name == "arguments") { + return arguments as T + } else if (name == "consoleOutput") { + return consoleOutput as T + } else if (name == "defaultDir") { + return defaultDir as T + } else if (name == "didLaunch") { + return didLaunch as T + } else if (name == "dir") { + return dir as T + } else if (name == "httpDefaultPort") { + return httpDefaultPort as T + } else if (name == "httpLaunch") { + return httpLaunch as T + } else if (name == "httpPort") { + return httpPort as T + } else if (name == "httpReply") { + return httpReply as T + } else if (name == "httpRequest") { + return httpRequest as T + } + return "unknown-field-name" as T + } + + override fun selfCopy(): CLDContext { + return this.copy() + } + + override fun setField( + name: String, + value: Any? + ) { + if (name == "arguments") { + arguments = value as Array + } else if (name == "consoleOutput") { + consoleOutput = value as String + } else if (name == "defaultDir") { + defaultDir = value as String + } else if (name == "didLaunch") { + didLaunch = value as Boolean + } else if (name == "dir") { + dir = value as String + } else if (name == "httpDefaultPort") { + httpDefaultPort = value as Int + } else if (name == "httpLaunch") { + httpLaunch = value as Boolean + } else if (name == "httpPort") { + httpPort = value as Int + } else if (name == "httpReply") { + httpReply = value as String + } else if (name == "httpRequest") { + httpRequest = value as NetRequest + } + } +} +``` + +# March + +Kotlin is currently the anchor programming language of CLD. Thus, to use Kotlin, +one would have to install related Java tools (Gradle, Android Studio or JVM itself). +Such a requirement makes it impossible to have a web browser only development +tool. And being able to code in a web browser is something I consider the +key feature for code portability. + +That's why in March I plan to create the draft of a tool running in a web browser. + +[entities]: https://github.com/OGStudio/local-host-access/blob/main/cld/entities.yml +[entities-result]: https://github.com/OGStudio/local-host-access/blob/main/src/entities.kt#L3 +[splash]: ../../images/2025-03_redux-data-flow.jpg +[store]: https://redux.js.org/introduction/getting-started#basic-example diff --git a/en/news/cld_ctx-gen.html b/en/news/cld_ctx-gen.html new file mode 100644 index 0000000..f5d1113 --- /dev/null +++ b/en/news/cld_ctx-gen.html @@ -0,0 +1,168 @@ + + + + + + + + + +

In the news...

+
+
+

+ CLD: Context generation +

+

+ 2025-03-11 00:00 +

+
+

splash

+

Context generation

+

In February I've updated the Cross-language dialect (CLD) translator to +generate Context out of YML. The generated Contexts have already been +used for the following projects:

+
    +
  • CLD (the CLD translator generated its own Context)
  • +
  • LHA
  • +
  • PSKOV
  • +
+

I never really took time to explain what Context is, so here's +a very short explanation: Context is very close to +Store in Redux. I'm afraid this is not yet the time +to explain Context in detail because I don't yet have a good +argument why you need Context. Once that time comes I do it.

+

Now let's get back to the Context generation. Here's how LHA's YML for Context looks like: (entities.yml):

+
# Application state context
+Context:
+    type: context
+    fields:
+        # Command line arguments
+        arguments: [String]
+        consoleOutput: String
+        defaultDir: String
+        didLaunch: Bool
+        dir: String
+        httpDefaultPort: Int
+        httpLaunch: Bool
+        httpPort: Int
+        httpReply: String
+        httpRequest: NetRequest
+
+

CLD translator converts it to the following code in Kotlin (entities.kt):

+
// Application state context
+data class Context(
+    // Command line arguments
+    var arguments: Array<String> = arrayOf(),
+    var consoleOutput: String = "",
+    var defaultDir: String = "",
+    var didLaunch: Boolean = false,
+    var dir: String = "",
+    var httpDefaultPort: Int = 0,
+    var httpLaunch: Boolean = false,
+    var httpPort: Int = 0,
+    var httpReply: String = "",
+    var httpRequest: NetRequest = NetRequest(),
+    override var recentField: String = "",
+): CLDContext {
+    override fun <T> field(name: String): T {
+        if (name == "arguments") {
+            return arguments as T
+        } else if (name == "consoleOutput") {
+            return consoleOutput as T
+        } else if (name == "defaultDir") {
+            return defaultDir as T
+        } else if (name == "didLaunch") {
+            return didLaunch as T
+        } else if (name == "dir") {
+            return dir as T
+        } else if (name == "httpDefaultPort") {
+            return httpDefaultPort as T
+        } else if (name == "httpLaunch") {
+            return httpLaunch as T
+        } else if (name == "httpPort") {
+            return httpPort as T
+        } else if (name == "httpReply") {
+            return httpReply as T
+        } else if (name == "httpRequest") {
+            return httpRequest as T
+        }
+        return "unknown-field-name" as T
+    }
+
+    override fun selfCopy(): CLDContext {
+        return this.copy()
+    }
+
+    override fun setField(
+        name: String,
+        value: Any?
+    ) {
+        if (name == "arguments") {
+            arguments = value as Array<String>
+        } else if (name == "consoleOutput") {
+            consoleOutput = value as String
+        } else if (name == "defaultDir") {
+            defaultDir = value as String
+        } else if (name == "didLaunch") {
+            didLaunch = value as Boolean
+        } else if (name == "dir") {
+            dir = value as String
+        } else if (name == "httpDefaultPort") {
+            httpDefaultPort = value as Int
+        } else if (name == "httpLaunch") {
+            httpLaunch = value as Boolean
+        } else if (name == "httpPort") {
+            httpPort = value as Int
+        } else if (name == "httpReply") {
+            httpReply = value as String
+        } else if (name == "httpRequest") {
+            httpRequest = value as NetRequest
+        }
+    }
+}
+
+

March

+

Kotlin is currently the anchor programming language of CLD. Thus, to use Kotlin, +one would have to install related Java tools (Gradle, Android Studio or JVM itself). +Such a requirement makes it impossible to have a web browser only development +tool. And being able to code in a web browser is something I consider the +key feature for code portability.

+

That's why in March I plan to create the draft of a tool running in a web browser.

+
+
+
+ + + +
+ + \ No newline at end of file diff --git a/en/news/index.html b/en/news/index.html index 6aa7561..516e756 100644 --- a/en/news/index.html +++ b/en/news/index.html @@ -25,6 +25,32 @@

News

+

+ CLD: Context generation +

+

+ 2025-03-11 00:00 +

+
+

splash

+

Context generation

+

In February I've updated the Cross-language dialect (CLD) translator to +generate Context out of YML. The generated Contexts have already been +used for the following projects:

+
    +
  • CLD (the CLD translator generated its own Context)
  • +
  • LHA
  • +
  • PSKOV
  • +
+

I never really took time to explain what Context is, so here's +a very short explanation: Context is very close to +Store in Redux. I'm afraid this is not yet the time +to explain Context in detail because I don't yet have a good. . .

+
+ +

PSKOV 2 for JVM

@@ -218,28 +244,8 @@ gamejam of Continue reading
-
-

- "Memory" text UI -

-

- 2024-06-14 00:00 -

-
-

"Memory" text UI

-

In May I implemented text UI for "Memory" game in Python. And converted it to C++ -by the instrument under development.

-

Game logic cycle implementation lead to the creation of a controller that manages -context. Creating the controller in Python was straightforward. C++ version took -some time, because the controller needs std::any, which is part of C++17. -The instrument under development is limited to C++11 in order to support OpenWrt.

-

Here's how much code I wrote (in lines):. . .

-
-
-

Page 1 of 8

+

Page 1 of 9

Older »

diff --git a/en/news/index2.html b/en/news/index2.html index 2e1890d..6c593c3 100644 --- a/en/news/index2.html +++ b/en/news/index2.html @@ -25,6 +25,26 @@

News

+

+ "Memory" text UI +

+

+ 2024-06-14 00:00 +

+
+

"Memory" text UI

+

In May I implemented text UI for "Memory" game in Python. And converted it to C++ +by the instrument under development.

+

Game logic cycle implementation lead to the creation of a controller that manages +context. Creating the controller in Python was straightforward. C++ version took +some time, because the controller needs std::any, which is part of C++17. +The instrument under development is limited to C++11 in order to support OpenWrt.

+

Here's how much code I wrote (in lines):. . .

+
+ +

"Memory" game logic

@@ -197,25 +217,8 @@ not the hardware one. Today I can confidently say I found the necessary. . .

-
-

- The pros and cons of restarting from scratch -

-

- 2020-01-01 00:00 -

-
-

Happy 2020

-

Anyone, who watches our progress long enough, can say that we restarted the development from scratch plenty of times.

-

Even before releasing "OGS Mahjong", we changed the underlying technology more than once. After that, we did it again several times, throwing away already completed features. -It seems that right now we have less completed features than before the release of "OGS Mahjong". It's true, but not entirely.

-

When "OGS Mahjong" was released, we had a descent looking (for that moment) open-source game, that worked under Windows and Linux. With some luck and effort it still works today, but not out of the box.. . .

-
-
-

Page 2 of 8

+

Page 2 of 9

« Newer Older » diff --git a/en/news/index3.html b/en/news/index3.html index 950f7ae..840d435 100644 --- a/en/news/index3.html +++ b/en/news/index3.html @@ -25,6 +25,23 @@

News

+

+ The pros and cons of restarting from scratch +

+

+ 2020-01-01 00:00 +

+
+

Happy 2020

+

Anyone, who watches our progress long enough, can say that we restarted the development from scratch plenty of times.

+

Even before releasing "OGS Mahjong", we changed the underlying technology more than once. After that, we did it again several times, throwing away already completed features. +It seems that right now we have less completed features than before the release of "OGS Mahjong". It's true, but not entirely.

+

When "OGS Mahjong" was released, we had a descent looking (for that moment) open-source game, that worked under Windows and Linux. With some luck and effort it still works today, but not out of the box.. . .

+
+ +
-

- OpenSceneGraph cross-platform examples -

-

- 2018-04-20 00:00 -

-
-

iOS Simulator renders a cube

-

This article summarizes the work we did to produce the first two cross-platform OpenSceneGraph examples.

-

By the time the first technology demonstration of OGS Mahjong 2 has been released, we've already had issue request (to explain how to load images with OpenSceneGraph on Android) hanging for some time. We considered creating a new tutorial for OpenSceneGraph cross-platform guide at first. However, we realized that it's time-consuming and excessive for such a tiny topic (compared to what an average game has) as image loading. We decided to continue sharing our knowledge in the form of concrete examples. That's how OpenSceneGraph cross-platform examples were born.. . .

-
-
-

Page 3 of 8

+

Page 3 of 9

« Newer Older » diff --git a/en/news/index4.html b/en/news/index4.html index 5f6b770..f86f794 100644 --- a/en/news/index4.html +++ b/en/news/index4.html @@ -25,6 +25,21 @@

News

+

+ OpenSceneGraph cross-platform examples +

+

+ 2018-04-20 00:00 +

+
+

iOS Simulator renders a cube

+

This article summarizes the work we did to produce the first two cross-platform OpenSceneGraph examples.

+

By the time the first technology demonstration of OGS Mahjong 2 has been released, we've already had issue request (to explain how to load images with OpenSceneGraph on Android) hanging for some time. We considered creating a new tutorial for OpenSceneGraph cross-platform guide at first. However, we realized that it's time-consuming and excessive for such a tiny topic (compared to what an average game has) as image loading. We decided to continue sharing our knowledge in the form of concrete examples. That's how OpenSceneGraph cross-platform examples were born.. . .

+
+ +
-

- iOS tutorial -

-

- 2017-06-08 10:00 -

-
-

Earth and a rocket

-

This article describes problems we faced during the creation of iOS tutorial in May 2017.

-

This February we managed to get simple model rendered under iOS in just a few days. We expected to finish iOS tutorial in no time. However, the reality reminded us: it's easy to come up with a hackish demo that works for one person, but it's hard to create a concise example that works for everyone.. . .

-
-
-

Page 4 of 8

+

Page 4 of 9

« Newer Older » diff --git a/en/news/index5.html b/en/news/index5.html index 2ecda96..6341823 100644 --- a/en/news/index5.html +++ b/en/news/index5.html @@ -25,6 +25,21 @@

News

+

+ iOS tutorial +

+

+ 2017-06-08 10:00 +

+
+

Earth and a rocket

+

This article describes problems we faced during the creation of iOS tutorial in May 2017.

+

This February we managed to get simple model rendered under iOS in just a few days. We expected to finish iOS tutorial in no time. However, the reality reminded us: it's easy to come up with a hackish demo that works for one person, but it's hard to create a concise example that works for everyone.. . .

+
+ +

OpenSceneGraph sample

@@ -162,31 +177,8 @@ -
-

- September 2016 recap -

-

- 2016-10-11 00:00 -

-
-

Mahjong created during live session

-

This article explains September 2016 live session stages: draft, rehearsal, live session itself, and publishing.

-

Even though live session takes only a few hours, we devote a whole month to prepare for it. Let's have a look at live session stages in detail.

-
    -
  1. Draft. Game creation for the first time.

    -

    Purposes:

    -
      -
    • test our technologies and fix major bugs;
    • -
    • discover usability issues to fix in the next development iteration;
    • -
    • list exact steps to reproduce the game later;. . .
  2. -
-
-
-

Page 5 of 8

+

Page 5 of 9

« Newer Older » diff --git a/en/news/index6.html b/en/news/index6.html index b8280a3..c8e3ece 100644 --- a/en/news/index6.html +++ b/en/news/index6.html @@ -25,6 +25,29 @@

News

+

+ September 2016 recap +

+

+ 2016-10-11 00:00 +

+
+

Mahjong created during live session

+

This article explains September 2016 live session stages: draft, rehearsal, live session itself, and publishing.

+

Even though live session takes only a few hours, we devote a whole month to prepare for it. Let's have a look at live session stages in detail.

+
    +
  1. Draft. Game creation for the first time.

    +

    Purposes:

    +
      +
    • test our technologies and fix major bugs;
    • +
    • discover usability issues to fix in the next development iteration;
    • +
    • list exact steps to reproduce the game later;. . .
  2. +
+
+ +

OGS Editor 0.10 and live session materials

@@ -158,22 +181,8 @@ It's time to create simple Mahjong solitaire game. -
-

- Live session: 28 May 2016 -

-

- 2016-05-17 00:00 -

-
-

We're glad to annouce that the LiveCoding session will take place on 28 May 2016 at 12:00 CEST. Join us! -. . .

-
-
-

Page 6 of 8

+

Page 6 of 9

« Newer Older » diff --git a/en/news/index7.html b/en/news/index7.html index d662143..fa857ca 100644 --- a/en/news/index7.html +++ b/en/news/index7.html @@ -25,6 +25,20 @@

News

+

+ Live session: 28 May 2016 +

+

+ 2016-05-17 00:00 +

+
+

We're glad to annouce that the LiveCoding session will take place on 28 May 2016 at 12:00 CEST. Join us! +. . .

+
+ +
-

- SOON: Creating a simple game live (Editor 0.7) -

-

- 2015-11-02 00:00 -

-
-

As we have promised, we are ready to give you Editor 0.7 which is capable of creating the complete test chamber. However, after recreating the test chamber ourselves, it became clear that:

-
    -
  1. it takes more than 8 hours to recreate it (too long)
  2. -
  3. it's inappropriate to be presented in the form of an article (too boring)
  4. -
-

Therefore we decided to hold a live session at LiveCoding SOON to show you how to create a simple whac-a-mole like game from scratch.. . .

-
-
-

Page 7 of 8

+

Page 7 of 9

« Newer Older » diff --git a/en/news/index8.html b/en/news/index8.html index 9882b5d..b81a398 100644 --- a/en/news/index8.html +++ b/en/news/index8.html @@ -25,6 +25,24 @@

News

+

+ SOON: Creating a simple game live (Editor 0.7) +

+

+ 2015-11-02 00:00 +

+
+

As we have promised, we are ready to give you Editor 0.7 which is capable of creating the complete test chamber. However, after recreating the test chamber ourselves, it became clear that:

+
    +
  1. it takes more than 8 hours to recreate it (too long)
  2. +
  3. it's inappropriate to be presented in the form of an article (too boring)
  4. +
+

Therefore we decided to hold a live session at LiveCoding SOON to show you how to create a simple whac-a-mole like game from scratch.. . .

+
+ +
-

- And another year has passed -

-

- 2014-12-31 12:00 -

-
-

Hello!

-

So, this year comes to the end. There were very little publications from us during this year. We haven't stopped working, but right now our work is in the phase, when we have nothing to show. And the spare time of the team members is rarely more then 30-40 hours a month.

-

But our work continues. And you can find out some details in the new article from our programmer Michael Kapelko.

-

. . .

-
-
-

Page 8 of 8

+

Page 8 of 9

« Newer + Older »