Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2016-04-19 13:48:09

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Quick little question about YGN gamecode

This is a quick little question, but how did you guys manage to face the challenge of sending over 90,000 blocks to a player! (300x300 world) If that world was filled with dora pictures, the player can join and the player manages to get all the blocks. How did you guys manage this? I'm just asking because i want to make a little miner game thing. (10,000 blocks)

Offline

#2 2016-04-19 16:04:13

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: Quick little question about YGN gamecode

Smart serialization.
Leave out all the empty blocks, and don't give every instance of a block, but instead, one instance, and all it's positions.
I'm sure you must know that, I don't really think there's anything more to it really.

Offline

Wooted by:

#3 2016-04-19 23:26:09

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: Quick little question about YGN gamecode

den3107 wrote:

Smart serialization.
Leave out all the empty blocks, and don't give every instance of a block, but instead, one instance, and all it's positions.
I'm sure you must know that, I don't really think there's anything more to it really.

So just one last question, do they send every block and every position in one message? (as in message[0] would be block 5 and all of its positions).

Offline

#4 2016-04-20 09:25:38

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: Quick little question about YGN gamecode

Well, they really just sent everything in a single message.
It's just the worlddata from the init message, there's nothing more to it.
Obviously how you process and draw the message also matters in how fast a world would load.
The messages are terribly small in data size: 4-64 million characters are about 16MB
With the speed of computers and internet we live with, you don't have to worry how big the messages are (up/down speed) but how many you sent (ping) as usually everybody has a decent amoutn of MBs speed, but a rather high ping (meaning it takes a long time to start sending and recieving packages).

Offline

#5 2016-04-20 11:46:24

AlphaJon
Member
From: Who knows
Joined: 2015-07-21
Posts: 1,297

Re: Quick little question about YGN gamecode

Well, I already tried concatenating messages together to send just one bigger message, but it didn't work. And I don't really know how playerIO handles such messages, mainly because I didn't dig in its source.
If you want, I'll give you more details about what I already tried once I get on my computer which has my sources.

Offline

#6 2016-04-20 12:12:48

Kaslai
Official Caroler
From: SEAͩT̓͑TLͯͥͧͪ̽ͧE͑̚
Joined: 2015-02-17
Posts: 787

Re: Quick little question about YGN gamecode

The game literally just sends all the blocks in a massive array. Each block is represented by one or more numbers, and the number of numbers used is determined by the block ID, which is the first number in the set of numbers.

In an example 3x3 world with empty blocks everywhere except for a coin door in the middle, the server sends something along the lines of:

00 00 00 00 10 12 00 00 00 00

Each of those pairs of digits is a single byte. If we rearrange the bytes into a rough grid...

00 00 00
00 10 12 00
00 00 00

I don't remember what the actual ID for coin doors is so I am just calling it 10 in this case. It is followed by a 12 to indicate that it should take 18 coins to open.

All the zeroes indicate empty blocks. So to send this 3x3 world, we need 3*3 bytes, plus a little extra for information about the coin door.

Now, most blocks in this game are one or two bytes, so let's say they are 2 bytes for simplicity.

If we have a 300x300 world, then we need 300*300 blocks, which is 90,000 total. We then need two bytes for every block, which means we need to send the user 180,000 bytes of data for the world.

To put this in somewhat more understandable terms, that is 1,440,000 bits of data, or 1.373 megabits. Almost all modern internet connections are rated at one megabit per second or faster, which means you can download at least a whole megabit every second. That means a 300x300 world can be downloaded in under 1.5 seconds, even on a 1 megabit per second connection.

If you're still stuck on 56 kilobits per second though... That will take you around 26 seconds to download.

A really easy way to think of EE levels is to think of an image file, where each pixel is a block. Downloading a 300x300 image is pretty fast, so transmitting a 300x300 EE world is pretty fast as well. Granted, most images use compression, but the principle is the same.

Offline

Wooted by:
Kaslai1461150768597339

Board footer

Powered by FluxBB

[ Started around 1732431225.2581 - Generated in 0.058 seconds, 13 queries executed - Memory usage: 1.42 MiB (Peak: 1.53 MiB) ]