As I keep player information?

Como eu guardo informações do jogador?

Por exemplo, o jogador está no level 9 e o animal de estimação está cançado. Como mostro isso na proxima vez que o jogador abrir o jogo?





As I keep player information?

For example, the player is at level 9 and the pet is tired. How do I show it the next time the player opening the game?

Just to clarify. I want to write to the device itself, not on a server. No connection to internet, no connection to the server, only on the device. Mobile phone, iPad, tablet, etc…

There is a nice Serialization system in JME3, just have your objects implement the Savable interface (look how the read an write methods are implemented in JME objects Spatial, NOde, Geometry etc…)



Then have a try at the brand new SaveGame class added by Normen this very night.

The SaveGame class isnt don yet, it should store not xml but uuencoded binary data… One only has 8000chars in preferences… Though generally I suggest using java.util.Preferences for storing persistent data yeah.

you got almost perfect english in your post (readable at least :P), but your title makes no sense :?

Como = How

Como = Like / As

wezrule said:
you got almost perfect english in your post (readable at least :P), but your title makes no sense :?


google translator :P.

normen said:
Como = How
Como = Like / As


hehe, normen and his 1000 abilities. He speaks portuguese too :D.

luancomputacao said:
Como eu guardo informações do jogador?
Por exemplo, o jogador está no level 9 e o animal de estimação está cançado. Como mostro isso na proxima vez que o jogador abrir o jogo?


Sorte sua por ter encontrado alguém brasileiro no forum ;). Como nehon disse, apenas implemente a interface Savable nas suas classes que serão salvas(por exemplo a class Player) e implemente seus métodos "write" e "read.". Olhe no javadoc as classes que implementam essa interface e como elas são usadas para serem salvas, vc pode dar uma olhada no código fonte do jMonkeyPlataform e ver como elas são salvas. Algumas classes que implementam Savable : Spatial, Node, Geometry.

e.g:
[java]
public class SomeHell implements Savable {
@Override
public void write(...) {
...
}

@Override
public void read(...) {
...
}
}
[/java]

Como normen disse, vc poderá usar java.util.Preferences também, mas isso tem um limite de 8000 chars.

-Abraços

Edit: Eu não parei para olhar se os métods write e read são voids xD.
normen said:
The SaveGame class isnt don yet, it should store not xml but uuencoded binary data.. One only has 8000chars in preferences.. Though generally I suggest using java.util.Preferences for storing persistent data yeah.

:D sorry, didn't want to spoil

Christmas comes early then :]



La Navidad llega temprano, entonces :]

I think all from this forum hasn’t english as their native language :D.

I made some finishing touches and added an example under jme3test/tools/TestSaveGame. Note that this way of saving only supports small amounts of data currently.

2 Likes

Muito obrigado glaucomardano pela tradução, foi de grande ajuda!!! Se você puder continuar a me ajudar serei constantemente grato!

Thanks normen and nehon. Your informations is very providential. And very tanks to glaucomardano because of their explanation. But my problem is this.

I want make an aplication (game) for Android device, I want to save player informations in one archive, after i open the file and take advantage of these informations through a gedget.

This is possible? JMonkey make me happy in this quest?

If I knew what is a “gedget”… xD. Anyway, you can read those informations from everywhere in your game.

glaucomardano said:
If I knew what is a "gedget"... xD. Anyway, you can read those informations from everywhere in your game.

Vou responder em português. Vai ficar mais facil de entender, creio eu.
Primeiro, desculpe-me por colocar a palavra errada.
Onde está gedget lê-se widget. Pelo menos tratando-se de android.
Como exemplo:
http://www.downloadatoz.com/resources/201009/pic/1284021172.jpg
este widget fica flutuando na área de trabalho, no desktop, do Android. Ele é uma atividade que fica executando em "segundo" plano, este aplicativo, em intervalos fixos de tempo, acessa dados tanto no celular quanto na internet. Quando o usuário dá um clique no widget ele será ativado, disponibilizando mais funções como escrever um novo tweet.
O widget não é o aplicativo principal, mas tem acesso a informações que o aplicativo completo gravou em alguma coisa. O widget é apenas um caminho rápido para obter algumas informações do apilcativo, via desktop


No meu caso pretendo, através do um widget, mostrar na área de trabalho, desktop, certas informações do jogo.
por exemplo:
Enquanto eu jogava, atingi o nivel 5, equipei o meu avatar com um martelo e um escudo. E meu animal de estimação está no level 6, está vestindo uma colraça e está com fome.
No widget quero mostrar só estas informações. Para isso eu preciso armazenar as informações fora do jogo, para poder acessar de um outro aplicativo.

Resumindo. Quero compartilhar informações entre dois aplicativos.

I was searching in this night. There are various concepts of Widget . You may see in wikipedia in portuguese and in english.
In answering to post of glaucomardano. Where i wrote gedget will read widget.
Summing up, I'll have two aplications and share data between them.
A widget is the "desktop float aplication" like in this image
http://www.downloadatoz.com/resources/201009/pic/1284021172.jpg
It has the minimum information about twitter, just show some twitters in desktop. This widget and other full twitter aplication share a database.

In my case i have the game and a widget. However I'll need shared data in both aplications.
This is it boys. I hope been clear.


(My english if very bad)
normen said:
I made some finishing touches and added an example under jme3test/tools/TestSaveGame. Note that this way of saving only supports small amounts of data currently.


@luancomputacao: Did you already look at the TestSaveGame yet? If you are using jmp, just create a new test project via New--->Project---->TestProject, but you must to update you jmp before doing that : https://wiki.jmonkeyengine.org/legacy/doku.php/sdk:update_center
If you didn't have installed the jmp, just download the jme-test-data libraly and add to your project's classpath.
I your game, save the infomartions as a file and load it in your other application which uses widgets. More clearer than this is impossible, just giving you the code xD.

Thanks glaucomardano. Knowing that I start my monograph. My aim was to select a Engine to make aplications for Android devices, and in then use the most technologies in one or more applications. Internet, graphics, sharing informations, widget, acelerometer, etc. For this I needed knew about sharing informations through archives.

I’ll go to studies, now!!!

Any information is very welcomce!

Did u know you can create android desktop executables via jmp xD?

See this document on android and using specific android functions:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:android