Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PHP + Minecraft
Search
Thomas Berends
December 03, 2020
1
450
PHP + Minecraft
PHP + Minecraft as given at SymfonyWorld 2020 on Dec 3, 2020
Thomas Berends
December 03, 2020
Tweet
Share
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
For a Future-Friendly Web
brad_frost
179
9.9k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
Facilitating Awesome Meetings
lara
55
6.5k
Music & Morning Musume
bryan
46
6.8k
We Have a Design System, Now What?
morganepeng
53
7.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
The Language of Interfaces
destraynor
160
25k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Transcript
PHP + Minecraft Doing unconventional stuff by combining PHP and
Minecraft
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
Two versions Bedrock • Windows • iOS • Android •
Playstation • Xbox • Nintendo Switch Java • Windows • MacOS • Linux
PHP + Minecraft: Why? I like combining hobbies
PHP + Minecraft: Why? I like combining hobbies Programming
PHP + Minecraft: Why? I like combining hobbies Programming VR
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR 3D Printing
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR 3D Printing
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR 3D Printing
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR 3D Printing
First step: First look at the game files
First step: First look at the game files • Saves
folder
First step: First look at the game files • Saves
folder Each save folder has: • 9 subfolders, including the well named ‘data’ folder • icon.png, session lockfile
Data directory
Data directory • Worst name ever
Data directory • Worst name ever • But contains… maps?
Data directory • Worst name ever • But contains… maps?
idcounts.dat map_0.dat map_1.dat map_2.dat etc.
What is a map?
What is a map?
What is a map?
map_0.dat • Notepad shows gibberish
map_0.dat • Notepad shows gibberish • Google to the rescue!
map_0.dat • Notepad shows gibberish • Google to the rescue!
It’s.. NBT?
map_0.dat • Notepad shows gibberish • Google to the rescue!
It’s.. NBT? Custom format, the map has: • colors • xCenter • zCenter • scale
What can we do with this? • Generate created maps
outside of the game • Know where these are positioned • Put all of them next to each other to create a bigger map!
SlimMap • Open source project • Made with Symfony &
Leaflet.js • Shows Maps made by players
SlimMap - Demo
We can get things out of the world... Minecraft Save
Maps
We can get things out of the world... Minecraft Save
Maps ???
Structure Blocks • Can Save parts of the world to
the file system
Structure Blocks • Can Save parts of the world to
the file system • Can Load them in from the file system
structure file • Ends with .nbt • Contains a set
of blocks
structure file • Ends with .nbt • Contains a set
of blocks • Also used by game itself to create structures like villages
structure file • Ends with .nbt • Contains a set
of blocks • Also used by game itself to create structures like villages • Can be saved manually
structure file • Ends with .nbt • Contains a set
of blocks • Also used by game itself to create structures like villages • Can be saved manually • Can be placed automatically
structure file blocks 0: pos: 0, 0, 0 Position of
block
structure file blocks 0: pos: 0, 0, 0 Position of
block state: 0 Index of block in palette
structure file blocks 0: pos: 0, 0, 0 Position of
block state: 0 Index of block in palette palette All different blocks 0: name: minecraft:dirt
Minecraft Commands Extensive system that can do almost anything
Minecraft Commands Extensive system that can do almost anything Some
examples: • Change weather • Kill mobs / players • Teleport mobs / players • Start / stop time • Give items, take items
Minecraft Commands Can be executed using • Chat, starting with
/
Minecraft Commands Can be executed using • Chat, starting with
/ • Redstone
Minecraft Commands Can be executed using • Chat, starting with
/ • Redstone • Command line (servers-only)
Minecraft Commands Can be executed using • Chat, starting with
/ • Redstone • Command line (servers-only) • RCON (Send commands to a server)
RCON Execute Minecraft commands remotely • Send commands from any
server
RCON Execute Minecraft commands remotely • Send commands from any
server • Only needs host, port, password
RCON Execute Minecraft commands remotely • Send commands from any
server • Only needs host, port, password • Composer package available
RCON - Security • Just a password is not that
safe
RCON - Security • Just a password is not that
safe • Do not use default port
RCON - Security • Just a password is not that
safe • Do not use default port • If possible, use IP whitelisting in firewall
RCON - Examples Used for • Automatic whitelisting of users
on paid servers
RCON - Examples Used for • Automatic whitelisting of users
on paid servers • Interactive livestreams
Demo
What we just did Read a 1 x 1 x
1 structure file to use as a base
What we just did Find the palette and change name
of the single block in it
What we just did Write the new block to an
existing nbt file
What we just did Write a success message!
Resources Repository with information https://github.com/ThomasBerends/php-minecraft Composer package reading Minecraft’s file
format https://github.com/rickselby/NBT Composer package for RCON connections https://github.com/thedudeguy/PHP-Minecraft-Rcon
A last note... • Most talks get hardly any feedback
on Joind.in • It’s one of the best things you can do to improve a conference Please take 10 minutes of your time Give feedback
Questions?
Thank you! Any feedback is welcome! Twitter: @ThomasBerends