×
Create a new article
Write your page title here:
We currently have 176 articles on Open Eggbert. Type your article name above or click on one of the titles below and start writing!



Open Eggbert
176Articles

Development of Open Eggbert: Difference between revisions

No edit summary
m (Robertvokac moved page Open Eggbert/Development to Development of Open Eggbert without leaving a redirect)
 
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Multiplatform ==
Open Eggbert is multiplatform (desktop, Android, web).
* We should assure continuously, that the latest version (snapshot) runs correctly on all the 3 supported platforms.
This means some limitations: Only feature of Java 11 source code level are supported, but even some Java 11 features are not supported in GWT.
# Method '''String.lines(String string)''' is not present in GWT.
#* How to fix: Use method '''OpenEggbertUtils.lines(String string)'''
# Method '''Stream.toList()''' is not present in GWT
#* How to fix: Use '''Stream.collect(Collectors.toList())'''
== Inspiration ==
https://github.com/libgdx/libgdx-demo-cuboc
== Requirements for Development ==
== Requirements for Development ==
Java 17
Java 17 must be installed. Newer versions may work only for the desktop.
 
== How to scale graphics ==
To be investigated


https://github.com/AlmasB/FXGL/issues/546
== Java 11 ==
Targeting Java 11 and GWT. GTW contains a subset of the Java standard library.


== Midi support ==
== Sound + Midi support ==
https://github.com/mgsx-dev/gdx-pd
https://github.com/mgsx-dev/gdx-pd


== Graphics ==
== Graphics ==
How to scale graphics - ?
https://github.com/leonbloy/pngj
https://github.com/leonbloy/pngj


Line 46: Line 62:


https://www.reddit.com/r/libgdx/comments/18bghen/how_can_i_get_an_animation_to_be_timed_correctly/
https://www.reddit.com/r/libgdx/comments/18bghen/how_can_i_get_an_animation_to_be_timed_correctly/
https://gamedev.stackexchange.com/questions/138324/libgdx-animation-sequence
<blockquote>       boxes = new Texture(Gdx.files.internal("boxes.png")); //** loading boxes **//
       box1 = new TextureRegion(boxes,0,0,180,320);
       box2 = new TextureRegion(boxes,200,0,480-200,320);
       box3 = new TextureRegion(boxes,0,330,127,511-330);
       box4 = new TextureRegion(boxes,180,325,511-180,511-320);</blockquote>
== Generating GIFs in Open Eggbert ==
https://github.com/Anuken/GDXGifRecorder
== Videos ==
https://github.com/libgdx/gdx-video


== Sprite Tools ==
== Sprite Tools ==
Line 53: Line 87:


Detection of sprite positions.
Detection of sprite positions.
https://github.com/mapeditor/tiled/tree/master/util/java/libtiled-java
https://www.mapeditor.org/


== Support for web and mobile platforms (Android, iPhone) ==
== Support for web and mobile platforms (Android, iPhone) ==
Line 64: Line 102:


https://stackoverflow.com/questions/28267316/libgdx-not-work-on-android-api-21
https://stackoverflow.com/questions/28267316/libgdx-not-work-on-android-api-21
== Networking ==
https://www.reddit.com/r/libgdx/comments/4rtdph/what_are_some_networking_options_for_libgdx/


== Screens ==
== Screens ==
https://www.gamedevelopment.blog/full-libgdx-game-tutorial-loading-screen/
https://www.gamedevelopment.blog/full-libgdx-game-tutorial-loading-screen/
https://www.slideshare.net/slideshow/libgdx-screens-fonts-and-preferences/44430118
== Controls ==
=== Mouse ===
=== Keyboard ===
=== Touch screen ===
=== Gamepad ===
https://github.com/libgdx/Jamepad


== 2D physics engines ==
== 2D physics engines ==
https://github.com/erincatto/box2d-lite
https://github.com/erincatto/box2d-lite
https://github.com/jbox2d/jbox2d
http://www.jbox2d.org/
https://box2d.org/documentation/
https://github.com/dyn4j/dyn4j
https://slick.ninjacave.com/
https://github.com/jwvhewitt/Slick2d-Game-Engine
https://github.com/implicit-invocation/jbump


== How to create a Java Platformer game ==
== How to create a Java Platformer game ==
https://longbaonguyen.github.io/courses/platformer/platformer.html
https://longbaonguyen.github.io/courses/platformer/platformer.html
== Design patterns ==
https://gameprogrammingpatterns.com/command.html
== Books ==
https://gameprogrammingpatterns.com/contents.html


== Wikipedia ==
== Wikipedia ==
Line 80: Line 154:


[[wikipedia:Gameplay|Gameplay - Wikipedia]]
[[wikipedia:Gameplay|Gameplay - Wikipedia]]
== Platforms ==
=== Desktop ===
=== Android ===
=== Web ===
https://libgdx.com/wiki/html5-backend-and-gwt-specifics
== Java annotations ==
Open Eggbert uses subset of Java 11 to reach the ability to be multiplatform (Desktop, GWT, Android)
== Fit Screen ==
https://stackoverflow.com/questions/28895140/libgdx-1-5-how-to-stretch-to-fit-width
== Colision Detection without Box2D ==
https://stackoverflow.com/questions/21249486/libgdx-intersection-of-polygons
== Implementing jumping without Box2D ==
To implement a jump mechanic in LibGDX without using Box2D, you can follow these steps:
1. **Define Variables:**
   - Create variables for the player's velocity, gravity, and whether the player is on the ground.
   ```java
   float velocityY = 0;
   final float gravity = -0.5f;
   boolean onGround = true;
   ```
2. **Jump Logic:**
   - Implement the jump by applying an upward velocity when the jump key is pressed and the player is on the ground.
   ```java
   if (Gdx.input.isKeyPressed(Input.Keys.SPACE) && onGround) {
       velocityY = 10;  // Jump strength
       onGround = false;
   }
   ```
3. **Apply Gravity:**
   - Continuously apply gravity to the player's vertical velocity.
   ```java
   velocityY += gravity;
   ```
4. **Update Player Position:**
   - Update the player's Y position using the current velocity.
   ```java
   player.y += velocityY;
   ```
5. **Ground Detection:**
   - Check if the player has landed back on the ground to reset the jump.
   ```java
   if (player.y <= groundLevel) {
       player.y = groundLevel;
       velocityY = 0;
       onGround = true;
   }
   ```
By following these steps, you create a basic jumping mechanic where the player can jump when on the ground, and gravity pulls them back down. This can be expanded with more complex mechanics like double jumps or variable jump heights.
== Gravity ==
https://gamedev.stackexchange.com/questions/111314/writing-my-own-gravity
== Discussion ==
Reimplementing a computer game such that it produces the same output for the same set of keyboard inputs involves several key steps to ensure that the behavior and output of the new implementation match the original as closely as possible. Here's a general guide on how to approach this task:
'''1. Understand the Original Game'''
* '''Play and Analyze''': Thoroughly play the original game and understand its mechanics, behavior, and response to different inputs.
* '''Document Behavior''': Document how the game responds to different inputs, including edge cases and specific sequences of events.
* '''Reverse Engineering''': If you have access to the game's source code or documentation, review it to understand the logic and algorithms used.
'''2. Define Specifications'''
* '''Input Mapping''': Clearly define how keyboard inputs map to actions within the game. This includes key bindings and the timing of inputs.
* '''Output Requirements''': Specify what constitutes the "output" of the game. This could include graphics, sound, game state, or specific responses to inputs.
'''3. Choose Development Tools'''
* '''Programming Language''': Choose a language and development environment that you're comfortable with and that is suited for game development.
* '''Game Engine''': Decide whether to use a game engine (like Unity, Unreal Engine, or Godot) or build from scratch. An engine may simplify development but could introduce differences in behavior.
'''4. Implement Core Mechanics'''
* '''Input Handling''': Implement keyboard input handling to match the original game's input system. Ensure that inputs are processed in the same way.
* '''Game Logic''': Develop the core game logic according to the documented behavior. Pay close attention to algorithms and state management.
* '''Rendering''': If the game involves graphics, ensure that the rendering matches the original in terms of visuals and timing.
'''5. Testing and Debugging'''
* '''Unit Testing''': Create unit tests for individual components to verify that each part behaves as expected.
* '''Playtesting''': Test the game with a variety of input sequences to ensure that the output matches the original game. This might involve comparing screenshots, audio, and game states.
* '''Debugging''': Identify and fix any discrepancies between the original game and your implementation.
'''6. Refinement'''
* '''Performance Optimization''': Ensure that the game runs smoothly and efficiently. Optimize performance if necessary.
* '''Consistency Checks''': Continuously check that the output remains consistent with the original game for the same inputs.
'''7. Documentation and Final Testing'''
* '''Document Differences''': If there are any intentional or unintentional differences, document them clearly.
* '''Final Testing''': Conduct a thorough round of testing to ensure that the reimplementation meets all the specifications and requirements.
'''Additional Considerations'''
* '''Legal and Ethical Issues''': Make sure you are legally permitted to reimplement the game. If the original game is copyrighted, ensure that your work complies with relevant laws and intellectual property rights.
* '''Community Feedback''': Engage with communities or players familiar with the original game to get feedback on your implementation.
By following these steps, we can reimplement a computer game to produce the same output for the same set of keyboard presses, provided that you account for all aspects of the original game's behavior and mechanics.
== Android Studio ==
=== How to install ADB ===
'''Warning:''' Running as root is one of the solutions. Todo: find a better solution.
Download ADB
As root run:
./adb kill-server
./adb start-server
./adb devices
== Multiplatform limitations ==
Open Eggbert target Desktop, Android and Web.
Available Java SE classes and libraries are limited on Android and Web.
Web (browser): GWT is used. There are also some alternatives like TeaVM.
=== Features not supported by GWT (this list is not complete) ===
* '''Formatting:''' The use of <code>String.format()</code> is not available.
* '''Regular expressions:''' Although regular expressions are limited, a simple version of <code>Pattern Matcher</code> is included.
* '''Reflection:''' Instead of standard reflection, use <code>libGDX</code> reflection.
* '''Multithreading:''' While GWT supports timers, it does not allow the use of threads at all.
=== External links ===
https://libgdx.com/dev/contributing/#considerations-for-gwt-compatibility
== External links ==
https://gamedev.stackexchange.com/questions/109047/how-to-close-an-app-correctly-on-desktop
https://gamefromscratch.com/speeding-up-gwt-compilation-speeds-in-a-libgdx-project/

Latest revision as of 15:30, 2 November 2024

Multiplatform

Open Eggbert is multiplatform (desktop, Android, web).

  • We should assure continuously, that the latest version (snapshot) runs correctly on all the 3 supported platforms.

This means some limitations: Only feature of Java 11 source code level are supported, but even some Java 11 features are not supported in GWT.

  1. Method String.lines(String string) is not present in GWT.
    • How to fix: Use method OpenEggbertUtils.lines(String string)
  2. Method Stream.toList() is not present in GWT
    • How to fix: Use Stream.collect(Collectors.toList())

Inspiration

https://github.com/libgdx/libgdx-demo-cuboc

Requirements for Development

Java 17 must be installed. Newer versions may work only for the desktop.

Java 11

Targeting Java 11 and GWT. GTW contains a subset of the Java standard library.

Sound + Midi support

https://github.com/mgsx-dev/gdx-pd

Graphics

How to scale graphics - ?

https://github.com/leonbloy/pngj

https://www.nayuki.io/page/png-library


https://github.com/nayuki/BMP-IO?tab=readme-ov-file

https://www.nayuki.io/page/bmp-io-library-java

https://github.com/PyroSamurai/JBL


https://github.com/nayuki/PNG-library

https://image4j.sourceforge.net/


https://libgdxinfo.wordpress.com/basic_image/

Animation

https://github.com/WinterAlexander/gdx-animation

https://libgdx.com/wiki/graphics/2d/2d-animation

https://gamefromscratch.com/libgdx-tutorial-3b-simple-animation/

https://gamefromscratch.com/libgdx-video-tutorial-sprite-animation/

https://www.pixnbgames.com/blog/libgdx/frame-by-frame-animations-in-libgdx/

https://www.codeandweb.com/texturepacker/tutorials/libgdx-sprite-sheet-tutorial

https://www.reddit.com/r/libgdx/comments/18bghen/how_can_i_get_an_animation_to_be_timed_correctly/

https://gamedev.stackexchange.com/questions/138324/libgdx-animation-sequence

       boxes = new Texture(Gdx.files.internal("boxes.png")); //** loading boxes **//

       box1 = new TextureRegion(boxes,0,0,180,320);

       box2 = new TextureRegion(boxes,200,0,480-200,320);

       box3 = new TextureRegion(boxes,0,330,127,511-330);

       box4 = new TextureRegion(boxes,180,325,511-180,511-320);

Generating GIFs in Open Eggbert

https://github.com/Anuken/GDXGifRecorder

Videos

https://github.com/libgdx/gdx-video

Sprite Tools

Generating sprite animations to gifs

https://genuinecoder.com/how-to-create-gif-from-multiple-images-in-java/

Detection of sprite positions.

https://github.com/mapeditor/tiled/tree/master/util/java/libtiled-java

https://www.mapeditor.org/

Support for web and mobile platforms (Android, iPhone)

It is a good idea to ensure, that Open Eggbert is runnable on web and mobile platforms.


https://stackoverflow.com/questions/2590850/threading-in-gwt-client

https://stackoverflow.com/questions/57735039/how-framwork-such-as-libgdx-handle-threading-for-web-target

https://stackoverflow.com/questions/28267316/libgdx-not-work-on-android-api-21

Networking

https://www.reddit.com/r/libgdx/comments/4rtdph/what_are_some_networking_options_for_libgdx/

Screens

https://www.gamedevelopment.blog/full-libgdx-game-tutorial-loading-screen/

https://www.slideshare.net/slideshow/libgdx-screens-fonts-and-preferences/44430118

Controls

Mouse

Keyboard

Touch screen

Gamepad

https://github.com/libgdx/Jamepad

2D physics engines

https://github.com/erincatto/box2d-lite

https://github.com/jbox2d/jbox2d

http://www.jbox2d.org/

https://box2d.org/documentation/

https://github.com/dyn4j/dyn4j

https://slick.ninjacave.com/

https://github.com/jwvhewitt/Slick2d-Game-Engine

https://github.com/implicit-invocation/jbump

How to create a Java Platformer game

https://longbaonguyen.github.io/courses/platformer/platformer.html

Design patterns

https://gameprogrammingpatterns.com/command.html

Books

https://gameprogrammingpatterns.com/contents.html

Wikipedia

Game design - Wikipedia

Video game development - Wikipedia

Gameplay - Wikipedia

Platforms

Desktop

Android

Web

https://libgdx.com/wiki/html5-backend-and-gwt-specifics

Java annotations

Open Eggbert uses subset of Java 11 to reach the ability to be multiplatform (Desktop, GWT, Android)

Fit Screen

https://stackoverflow.com/questions/28895140/libgdx-1-5-how-to-stretch-to-fit-width

Colision Detection without Box2D

https://stackoverflow.com/questions/21249486/libgdx-intersection-of-polygons

Implementing jumping without Box2D

To implement a jump mechanic in LibGDX without using Box2D, you can follow these steps:

1. **Define Variables:**

   - Create variables for the player's velocity, gravity, and whether the player is on the ground.

   ```java

   float velocityY = 0;

   final float gravity = -0.5f;

   boolean onGround = true;

   ```

2. **Jump Logic:**

   - Implement the jump by applying an upward velocity when the jump key is pressed and the player is on the ground.

   ```java

   if (Gdx.input.isKeyPressed(Input.Keys.SPACE) && onGround) {

       velocityY = 10;  // Jump strength

       onGround = false;

   }

   ```

3. **Apply Gravity:**

   - Continuously apply gravity to the player's vertical velocity.

   ```java

   velocityY += gravity;

   ```

4. **Update Player Position:**

   - Update the player's Y position using the current velocity.

   ```java

   player.y += velocityY;

   ```

5. **Ground Detection:**

   - Check if the player has landed back on the ground to reset the jump.

   ```java

   if (player.y <= groundLevel) {

       player.y = groundLevel;

       velocityY = 0;

       onGround = true;

   }

   ```

By following these steps, you create a basic jumping mechanic where the player can jump when on the ground, and gravity pulls them back down. This can be expanded with more complex mechanics like double jumps or variable jump heights.

Gravity

https://gamedev.stackexchange.com/questions/111314/writing-my-own-gravity

Discussion

Reimplementing a computer game such that it produces the same output for the same set of keyboard inputs involves several key steps to ensure that the behavior and output of the new implementation match the original as closely as possible. Here's a general guide on how to approach this task:

1. Understand the Original Game

  • Play and Analyze: Thoroughly play the original game and understand its mechanics, behavior, and response to different inputs.
  • Document Behavior: Document how the game responds to different inputs, including edge cases and specific sequences of events.
  • Reverse Engineering: If you have access to the game's source code or documentation, review it to understand the logic and algorithms used.

2. Define Specifications

  • Input Mapping: Clearly define how keyboard inputs map to actions within the game. This includes key bindings and the timing of inputs.
  • Output Requirements: Specify what constitutes the "output" of the game. This could include graphics, sound, game state, or specific responses to inputs.

3. Choose Development Tools

  • Programming Language: Choose a language and development environment that you're comfortable with and that is suited for game development.
  • Game Engine: Decide whether to use a game engine (like Unity, Unreal Engine, or Godot) or build from scratch. An engine may simplify development but could introduce differences in behavior.

4. Implement Core Mechanics

  • Input Handling: Implement keyboard input handling to match the original game's input system. Ensure that inputs are processed in the same way.
  • Game Logic: Develop the core game logic according to the documented behavior. Pay close attention to algorithms and state management.
  • Rendering: If the game involves graphics, ensure that the rendering matches the original in terms of visuals and timing.

5. Testing and Debugging

  • Unit Testing: Create unit tests for individual components to verify that each part behaves as expected.
  • Playtesting: Test the game with a variety of input sequences to ensure that the output matches the original game. This might involve comparing screenshots, audio, and game states.
  • Debugging: Identify and fix any discrepancies between the original game and your implementation.

6. Refinement

  • Performance Optimization: Ensure that the game runs smoothly and efficiently. Optimize performance if necessary.
  • Consistency Checks: Continuously check that the output remains consistent with the original game for the same inputs.

7. Documentation and Final Testing

  • Document Differences: If there are any intentional or unintentional differences, document them clearly.
  • Final Testing: Conduct a thorough round of testing to ensure that the reimplementation meets all the specifications and requirements.

Additional Considerations

  • Legal and Ethical Issues: Make sure you are legally permitted to reimplement the game. If the original game is copyrighted, ensure that your work complies with relevant laws and intellectual property rights.
  • Community Feedback: Engage with communities or players familiar with the original game to get feedback on your implementation.

By following these steps, we can reimplement a computer game to produce the same output for the same set of keyboard presses, provided that you account for all aspects of the original game's behavior and mechanics.

Android Studio

How to install ADB

Warning: Running as root is one of the solutions. Todo: find a better solution.

Download ADB

As root run:

./adb kill-server

./adb start-server

./adb devices

Multiplatform limitations

Open Eggbert target Desktop, Android and Web.

Available Java SE classes and libraries are limited on Android and Web.

Web (browser): GWT is used. There are also some alternatives like TeaVM.

Features not supported by GWT (this list is not complete)

  • Formatting: The use of String.format() is not available.
  • Regular expressions: Although regular expressions are limited, a simple version of Pattern Matcher is included.
  • Reflection: Instead of standard reflection, use libGDX reflection.
  • Multithreading: While GWT supports timers, it does not allow the use of threads at all.

External links

https://libgdx.com/dev/contributing/#considerations-for-gwt-compatibility

External links

https://gamedev.stackexchange.com/questions/109047/how-to-close-an-app-correctly-on-desktop

https://gamefromscratch.com/speeding-up-gwt-compilation-speeds-in-a-libgdx-project/