SpaceWar Demo -- mmoItem ID integer limits?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

SpaceWar Demo -- mmoItem ID integer limits?

Postby Zenith » 02 Aug 2018, 21:33

Hi,
I am working on a game which I am developing taking base of Spacewar game.
It is kind of persistent world game where players join and leave.

I notice that mmoItemId is an id assigned as an integer to all new mmoitems.
Also new bullets spawned are mmoitems.

Does it mean I need to worry about reaching integer limits of Java if there are too many bullets or that game world being persistent is there for weeks.

What happens when integer limits are reached?
Regards.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SpaceWar Demo -- mmoItem ID integer limits?

Postby Lapo » 03 Aug 2018, 06:47

Are you planning to run more than 4 billions items/bullets? :shock:
If that's the case I think you will have to worry about RAM (and possibly network) before anything else :)

Reasonably speaking I don't think that should be a concern, unless you plan to never remove any item you ever create in the game.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

Re: SpaceWar Demo -- mmoItem ID integer limits?

Postby Zenith » 03 Aug 2018, 21:21

Lapo wrote:Are you planning to run more than 4 billions items/bullets? :shock:
If that's the case I think you will have to worry about RAM (and possibly network) before anything else :)

Reasonably speaking I don't think that should be a concern, unless you plan to never remove any item you ever create in the game.

Cheers

Hey.
What I noticed is that the int value just keeps on increasing.
So say I create 1000 bullets then 1 to 1000 are used . Then I create thousand more they use 1001 to 2000. Now if previous bullets are destroyed.
Next set of bullets will use what 1 to 1000 or 2001 to 3000?

I mean does it automatically repeat the unused into values for mmoitems once the previous items with that number are removed?

I assume / believe it just keep increasing by one everytime a new bullet is generated. In which case I would need to implement some sort of pooling for bullets.

Hope I could explain properly.
User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

Re: SpaceWar Demo -- mmoItem ID integer limits?

Postby Zenith » 04 Aug 2018, 00:57

Malala in case the expected behaviour is that it wraps around after reaching maximum value
Does it check for any item already existing with that particular id.

Although I am asking a very unrealistic scenario but still I need to understand as I would leave some objects as permanent objects and others as temporary bullets. So got to make sure for my understanding.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SpaceWar Demo -- mmoItem ID integer limits?

Postby Lapo » 04 Aug 2018, 07:00

Hi,
Zenith wrote:I mean does it automatically repeat the unused into values for mmoitems once the previous items with that number are removed?

no, the counter keeps incrementing.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

Re: SpaceWar Demo -- mmoItem ID integer limits?

Postby Zenith » 04 Aug 2018, 09:03

Lapo wrote:Hi,
Zenith wrote:I mean does it automatically repeat the unused into values for mmoitems once the previous items with that number are removed?

no, the counter keeps incrementing.


So does it not mean that there is total limit of maximum 4 billion game items in the lifetime of a game server running. Even if the items get destroyed just in seconds after they are created?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SpaceWar Demo -- mmoItem ID integer limits?

Postby Lapo » 04 Aug 2018, 09:25

Theoretically yes.
So if you create 50K objects a day you have 80.000 days before the the counter restarts. 219 years, seems a reasonable amount of time :)

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

Re: SpaceWar Demo -- mmoItem ID integer limits?

Postby Zenith » 04 Aug 2018, 17:09

Lapo wrote:Theoretically yes.
So if you create 50K objects a day you have 80.000 days before the the counter restarts. 219 years, seems a reasonable amount of time :)

cheers


oh! Seems like I did not do that maths. Cool !

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 64 guests