Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Game server and database interactions  (Read 506 times)
0 Members and 1 Guest are viewing this topic.
Offline paxerello11

Junior Newbie


Exp: 2 years



« Posted 2014-06-27 10:58:28 »

Hi all,
I'm new at multiplayer game programming and I've encountered some questions about that.
I particular I don't know if it is better to load all player information into the server at the start and saving at specific intervals or if I should work and interact with the database all the time without having the data loaded in the server.

Thanks for your attention.

EDIT: I'm trying to make an mmorpg
Online LiquidNitrogen
« Reply #1 - Posted 2014-06-27 11:11:22 »

What sort of game is it? Some game types wouldn't matter if you saved data once per minute, but some would be ruined if they lost track of anything.
Offline paxerello11

Junior Newbie


Exp: 2 years



« Reply #2 - Posted 2014-06-27 11:19:57 »

Oh yeah, sure, I had to specify xD It is an mmorpg
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Herjan
« Reply #3 - Posted 2014-06-27 11:36:42 »

You should load the player data (name etc.) in at the login and save/load when needed.
F.E. Don't continuously save your inventory into the database, but load it at the start of the game and save inventory into the database when the player disconnects.

Offline paxerello11

Junior Newbie


Exp: 2 years



« Reply #4 - Posted 2014-06-27 11:41:47 »

You should load the player data (name etc.) in at the login and save/load when needed...

Thanks a lot  Wink
Online Mike

JGO Wizard


Medals: 76
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #5 - Posted 2014-06-27 11:50:36 »

If you are worried about server crashes then you can also update the database once every x minutes/hours or whenever nothing changed in the inventory for a minute or so.

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #6 - Posted 2014-06-27 11:54:10 »

If you don't want item duping, then you have all actual item interactions take place on the server, then sync the client to the latest server state whenever it changes.

If you sync the inventory on login and logout you're asking for all kinds of item dupe bugs/exploits. The *only* place to reliably pick up/drop/discard/trade an item is a transaction on the server.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline trollwarrior1
« Reply #7 - Posted 2014-06-27 11:58:50 »

^

I was thinking about saying the same thing, but then I realised that the OP was asking when THE SERVER should STORE DATA in the DATABASE.
Offline paxerello11

Junior Newbie


Exp: 2 years



« Reply #8 - Posted 2014-06-27 11:59:36 »

If you don't want item duping, then you have all actual item interactions take place on the server, then sync the client to the latest server state whenever it changes.

If you sync the inventory on login and logout you're asking for all kinds of item dupe bugs/exploits. The *only* place to reliably pick up/drop/discard/trade an item is a transaction on the server.
Of course I will make the server able to control everything to avoid this kind of issues and cheating Wink

If you are worried about server crashes then you can also update the database once every x minutes/hours or whenever nothing changed in the inventory for a minute or so.
Yes, for sure I will update the database every X minutes, 30 for example
Offline temu

Senior Newbie


Medals: 1
Exp: 2 years



« Reply #9 - Posted 2014-06-27 12:11:21 »

You probably want to load everything at the start of the server and store back everything at the end or when a player disconnect or every TOT minutes.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #10 - Posted 2014-06-27 12:12:36 »

^

I was thinking about saying the same thing, but then I realised that the OP was asking when THE SERVER should STORE DATA in the DATABASE.

You're right, I completely misread the initial post.  Lips Sealed

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (28 views)
2014-09-12 09:08:26

Norakomi (57 views)
2014-09-10 13:57:51

TehJavaDev (72 views)
2014-09-10 06:39:09

Tekkerue (37 views)
2014-09-09 02:24:56

mitcheeb (57 views)
2014-09-08 06:06:29

BurntPizza (43 views)
2014-09-07 01:13:42

Longarmx (27 views)
2014-09-07 01:12:14

Longarmx (34 views)
2014-09-07 01:11:22

Longarmx (34 views)
2014-09-07 01:10:19

mitcheeb (40 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!