Android Question Best experts, help me ^_^

LucaMs

Expert
Licensed User
Longtime User
I have an idea for a game that does not exist in the market.

I need to know the ways to achieve it in the most professional manner possible.

In particular, how to make it work online and how to sell useful items in the game.

I know I can find a lot of information on this site, but maybe some of you have a clear idea, and perhaps he has already implemented this.


(Engineers of WhatsApp if you want to answer, you would be welcome :D:D:D)
 

LucaMs

Expert
Licensed User
Longtime User
You can combine web sockets handlers with standard handlers. Send the pictures with standard handlers. Check WebSocketWithFileUpload module (and the standard handler: FileHelper).

I hope to find a way to keep both things together for a single user.

The WebSocket client doesn't support wss.

I hope (too many hopeS :)) to authenticate the user via https and then handle the rest via sockets.


Thanks
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I continue with this thread (at least until Erel will allow me to do it and he did not pull my ears :)).


The final (and temporary :D) choice is therefore to use a server B4J installed on a VPS service.

I still have many problems to solve.

I will need:

1) the client App in which the user will have basically the ability to create his profile and get into a room game (besides being able to follow/contact his friends);

2) the game server; for this, I think to use a B4j WebServer without GUI;

3) another client App that allows me to log on with an administrator account and enter into any room to check the progress of the game; we say as if I were an invisible player.

4) an administrative console.


Everything is not as simple as it seems.

For example, point 4: how to achieve it?
The game server has no GUI.
Since my poor knowledge about HTML/Javascript, what do I do? Another App? With the limited space on the screen and the lack of power of the device? Or another B4J server WITH GUI to connect to the game server?

Point 2:
For the management of game phases within a room, should I create a Room normal class that handles everything, including two sockets for each player (a websockt and a normal socket to send the image of the player)?

It would be necessary to draw some diagrams; for this reason I have asked this question:
http://www.b4x.com/android/forum/threads/how-do-you-develop.43691/



I hope not to bore the readers and I hope this thread might be useful.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I recommend you to start with some simple server programs (websocket and non-websocket) in order to understand the main concepts.

It is hard to say which approach will be better as it really depends on your knowledge and specific requirements.

For the management of game phases within a room, should I create a Room normal class that handles everything, including two sockets for each player
There are no sockets at all. You use WebSocket to communicate with the WebSocket handler and you use HttpJob to communicate with the standard handlers.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I recommend you to start with some simple server programs (websocket and non-websocket) in order to understand the main concepts.

It is hard to say which approach will be better as it really depends on your knowledge and specific requirements.


There are no sockets at all. You use WebSocket to communicate with the WebSocket handler and you use HttpJob to communicate with the standard handlers.


First of all, thanks for your reply.

I have already experienced a couple of servers, modifying CCTV and creating a new one with a simple login (websocket - among other things, this works well with a real mobile device, does not work with an emulator, you answered me about this).

I have written "two sockets" because one would be a websocket tied to the user and the other... too, but a normal socket, to send images.

So you do not recommend me to use normal class modules (apart for objects like Player and others)?

I have "consulted" even Chat Server, in which there is not a Player object, it seems that the Chat handler is the Player!



Well, it's complicated ... I will have to do many, many tests



Thanks again
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
You can combine web sockets handlers with standard handlers. Send the pictures with standard handlers. Check WebSocketWithFileUpload module (and the standard handler: FileHelper).

The WebSocket client doesn't support wss.

(Preface: I remember you that I know the Javascript as I know the Chinese).

I "guess" that in the example:
[Server] Upload files from your app to your B4A B4J server over the internet

WebSocketWithFileUpload is the websocket handler, which runs a function on the html page :( which in turn "connects to FileHelper" which sends the image to WebSocketWithFileUpload via a callsubdelayed2. [This explanation shows how little I understood]

Given that the image that my app will send will be the icon player, my wshPlayer (websocket handler) could play the part of WebSocketWithFileUpload, if I'm not mistaken. Should this handler run a function on my client that sends the image file using HttpJob?

And how can I proceed in reverse order, send an image from server to client?



I'm doing too many questions at this time, sorry :(
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
WebSocketWithFileUpload is the websocket handler, which runs a function on the html page
Not exactly. Check index.html. There is no javascript there. There is however a form that is being send when the user presses on the submit button. This form is sent to filehelper.

In your case it is simpler. You don't need to handle the multipart data. Just create a standard handler that reads the file from the stream and send the file with HttpJob. After the file is sent you can send a notification to the websocket.

The same is true for files being sent from the server. Send a notification with the web socket and then download the file with HttpJob.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Not exactly. Check index.html. There is no javascript there. There is however a form that is being send when the user presses on the submit button. This form is sent to filehelper.

In your case it is simpler. You don't need to handle the multipart data. Just create a standard handler that reads the file from the stream and send the file with HttpJob. After the file is sent you can send a notification to the websocket.

The same is true for files being sent from the server. Send a notification with the web socket and then download the file with HttpJob.

Ok, I'll try.

I hope to be able to send the file to the right player. Also, since this is done in two stages, although fast, I hope that there will be not problems with the tens of millions of users of my app :D.


Many thanks Erel
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Well, I was able to... understand anything.

"Just create a standard handler that reads the file from the stream and send the file with HttpJob. After the file is sent you can send a notification to the websocket."

Standard handler on device? I have created a simple class on device, in wich the link in:
j.PostBytes(link &...
should point to...? a server handle class like FileHelper?
Should then this class save somewhere the file available to the websocket handler when it receives notification from the client?

"After the file is sent you can send a notification to the websocket."
After the file is sent it is sent but not received with certainty.
________________________________________________________

Certainly I find all of this confusing because I do not know the backstory, the POST & GET, how they work in B4A, web-not web B4J server, which objects possess a session, etc.
In short, I am too ignorant and I can not clarify my ideas by taking examples from various places-example projects.
_______________________________________________________

I emphasize that my questions are not addressed only to Erel, which is certainly very busy.


It's all too complicated for me, I'm afraid.

Distinguish what are the tasks of the "Player" websocket handler and what those of a normal code module, which I think might be the centerpiece, the manager of the whole "game server", is already hard.


what I want to achieve in this small part :( is:

the user can choose an image for his profile and send it to the server (where it will end then, I'm not sure. Surely the central database and then in a class Player or the Player websocket handler, mah!)

In the opposite direction, the server will send to the user/client a series of images relating to other players (friends players and those in the game room).

I would need to a "scheme" like: names and type of modules and name and type of routines.

Something like:

--- Client sends an image ---
clsSendImage - httpjob with PostBytes to X on server
x (type) routine ReceiveImageFile does...
and so on.

Not a thing with many details.



Sorry but at this time I am more confused than usual.



I thank you even if you had only read all this whining.
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
Make realtime online games, massive multplayer with chat itens, etc

i m using VB.NET to make a server on my rpg game
send strings with user position x and y, its working fine for now and very fast. use tcp/socket.
and php + mysql to store user info, make quests, inventory, etc its a good way for you too.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Make realtime online games, massive multplayer with chat itens, etc

i m using VB.NET to make a server on my rpg game
send strings with user position x and y, its working fine for now and very fast. use tcp/socket.
and php + mysql to store user info, make quests, inventory, etc its a good way for you too.


Thanks, Douglas, but I imagine that you will do an intensive use of PHP that I know very little.
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
no, im using php only to make a conection, the querys i made on app.
the server is only to know
-users online
-users possition
-users image 1 to 5 if user 1 = hero.png if user 2 = lala.png etc and i make a position on the map

php + mysql
store informations like user login, coins etc
check if user is banned or no

here have a example, i made a tutorial
http://www.douglasfarias.com.br/tutoriais/9.php
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User

Attachments

  • 10515232_819656211397930_5253557847387969298_o.jpg
    10515232_819656211397930_5253557847387969298_o.jpg
    49.8 KB · Views: 289
  • 10557027_819675378062680_8376993104411391769_o.jpg
    10557027_819675378062680_8376993104411391769_o.jpg
    93.8 KB · Views: 273
  • 10486810_819656154731269_3603761877024432580_o.jpg
    10486810_819656154731269_3603761877024432580_o.jpg
    82.3 KB · Views: 282
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Very nice.

But those posts confuse me even more (#19 #20 - "You must connect from VB.NET, Android is server in this case.")
(I have not been able to run your project due to the different version of B4A. However, the code executes many calls to php pages)


Ignoring the saving of data in a database, which is not the most complicated thing...

I'm interested to know what is the structure that you have developed.

How do you use VB.Net? (and in this case a VPS is indispensable, I guess ... but also using the server B4J)


You have been very kind, so ... I take this opportunity :D to ask you a diagram of the structure.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Make realtime online games, massive multplayer with chat itens, etc

i m using VB.NET to make a server on my rpg game
send strings with user position x and y, its working fine for now and very fast. use tcp/socket.
and php + mysql to store user info, make quests, inventory, etc its a good way for you too.


If you use php+mysql only for saving data, why don't use SQL Server?
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
hmm i use a vps to server
when user enter in the game, connect at server on vps, the server make connection client/server
client send to server: userid userposition x y userhero 1 to 5

i use only to make a connection, and with result place this on the game map.
whitout vps i dont know =(

and i dont need store the position, the connection is only bits, dont need much internet, only to get users positions and place on the maps.
is very fast to get position and send via socket/tcp, only send and receive positions and i use this to place on the map

i m store only quests, inventory etc.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I thought that the VPS were simply a kind of system emulator, windows or linux or other, to be managed remotely like a normal PC, in which to install our programs, like your own server (such as a server B4J).

Which VPS do you use? So I can inform me better.
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
windows 2003, server .exe use port 5555
i never used B4J if you know easy its is good because is very fast.
i m using vb.net because my friend know about vb.net and its easy xD
 
Upvote 0
Top