If have login problems remove cookies and clear browser cache.



Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[APP] J2ME SDK Mobile
06-20-2021, 12:00 PM (This post was last modified: 06-29-2021 12:21 AM by JoseskVolpe.)
Post: #17
RE: [APP] J2ME SDK Mobile
Update #4 20/06/2021 (DDMMYY)

Released a new update adding neww features that'll make development easier

Download

NEEDED CHANGES:
If you were already working on a game and you want to update the template features, you must do these changes:
  • Replace your Update() void function in dedomil.yourgame.Game class. It's probably looking like this:
Code:
public void Update(){
//Code
}

Replace it as:
Code:
public void Update(double delta){
//code
}

Change note:
  • Added delta-time on Update() method, making it easier to sync updates with the FPS (READ NOTE #1)
  • Added a Image loading class
  • Added a Sound engine class (READ NOTE#2)

Next update to do:
  • Add a simple separated documentation, with descriptions about Graphics, Sprite, MMAPI and GameEngine's methods. So featurephones developers won't need to write everything in a notebook or leave the application to search the web all time anymore, with the exception when it's really needed

Notes:
  • Note 1

delta is a double variable, wich means it handles with floatings points. Most of the times, you'll use it to handle with integer variables. You must add a conversor or a round calculator on them. For example:
When you're moving a object, you most likely create a int positioning variable, like that:
Code:
int positionX, positionY;
positionX += 1; //1 pixel per update
g.drawImage(i, positionX, positionY, 0);

When you want to sync it to the FPS, you'll calculate the movements versus the time, for example, if i want it to move 30 pixels per second, you think in this pseudocode:
Code:
positionX -> positionX + 30 * delta;

This would multiply 30 per delta. Delta is often a number for 0.0 to 1.0, for example, 0.0305. In Java, variables types is a thing, so you cannot just make this calculation as it would return an error because it's a float value parsing to a integer variable, you would like to convert it aswell as a integer:

Code:
positionX += (int)(30*delta);
You can also round it with Math.ceil() or Math.floor():
Code:
positionX += (int)Math.ceil(30*delta); //You'll still need to convert as int because Math.ceil() and Math.floor() returns double values

This will easily solve the problem

But with low values you'll often have problem with unchangeable values, in this context, the object will be freeze on higher FPS, that's because as an integer value, it will just ignore the broken numbers, 1+0.3 will still be 1 instead of 1.3. To solve this, you can make positionX a float variable instead of a integer, and convert it when you're parsing it to another integer method, for example:

Code:
float positionX, positionY;
positionX += 30*delta; //Notice you don't need to convert it on here anymore because it's now a floating point variable
g.drawImage(i, (int)(positionX), (int)(positionY), 0); //Instead, you're converting it here ;3
This will solve the problem

  • Note 2

Sound is experimental, i'm still working in a complex Sound engine on my UndertaleME project, and i'll port it to this game template once it's clean, smooth and smaller. Currently, you cannot mix sounds, for example, if you're playing a music, you cannot play a SFX with it, after the final update, some devices will still not support sounds mixing because it's a Java limitation for some devices.
Expect a lot of future changes and deprecations
To load and play sounds, it's easy. For example, if you're going to play a music:

Code:
Sound music = new Sound("your_music_name.mid");
music.Loop();

This will play the music continuosly. You can stop it by Stop() method or with Close() method to immediately free it from the RAM

Put your music in 'resources' directory inside of 'src', that includes your sprites and Images

For musics, it's adivsed to use .mid or .midi formats. You can use other formats like .wav, .mp3(DEPRECATED) and .amr(DEPRECATED) aswell, but has in mind they're much heavier in memory.
WARNING: In the next updates, it's advised to use ONLY .midi or .mid for music and .wav for SFX. Other formats WILL be descontinued. Consider alternative formats support as already deprecated. That's due to a Java MMAPI limitation.

[size=xx-small]Signature[/size]
[URL=https://www.exophase.com/user/JoseskVolpe/][IMG]https://card.exophase.com/2/0/45687.png?1612237163[/IMG][/URL]

[align=justify][size=x-small][b]OwO ¿¿¿What is this??? *wags tail*
Take my beret plz 7w7 ~[/b][/size][/align]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[APP] J2ME SDK Mobile - JoseskVolpe - 05-01-2021, 01:12 AM
RE: [APP] J2ME SDK Mobile - Abidemhie - 05-01-2021, 01:16 AM
RE: [APP] J2ME SDK Mobile - Abidemhie - 05-01-2021, 01:20 AM
RE: [APP] J2ME SDK Mobile - Abidemhie - 05-01-2021, 01:23 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 05-01-2021, 01:32 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 05-01-2021, 07:19 AM
RE: [APP] J2ME SDK Mobile - Jay man - 05-01-2021, 08:19 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 05-02-2021, 02:17 AM
RE: [APP] J2ME SDK Mobile - Kankon - 05-02-2021, 04:30 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 05-02-2021, 06:53 AM
RE: [APP] J2ME SDK Mobile - rkjanu0 - 05-02-2021, 08:03 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 05-02-2021, 08:04 AM
RE: [APP] J2ME SDK Mobile - Kankon - 05-02-2021, 08:26 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 05-21-2021, 10:35 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 06-20-2021, 05:28 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 06-20-2021 12:00 PM
RE: [APP] J2ME SDK Mobile - star cash - 06-20-2021, 02:19 PM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 06-26-2021, 07:52 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 06-29-2021, 12:18 AM
RE: [APP] J2ME SDK Mobile - JoseskVolpe - 06-29-2021, 10:11 AM
RE: [APP] J2ME SDK Mobile - Sadiq1 - 01-17-2024, 05:55 PM
RE: [APP] J2ME SDK Mobile - Nrookie - 08-03-2024, 04:01 AM
RE: [APP] J2ME SDK Mobile - King_Dave - 08-03-2024, 01:56 PM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)