Mastering Roblox Coding - Mark Kiepe - E-Book

Mastering Roblox Coding E-Book

Mark Kiepe

0,0
29,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Roblox is a game platform with over 47 million daily active users. Something unique to Roblox is that you’re playing games made by other gamers! This means that you can make your own games, even if you have no experience. In addition, Roblox provides a free engine that allows you to create and publish a simple game in less than five minutes and get paid while at it.
Most Roblox games require programming. This book starts with the basics of programming in Roblox Luau. Each chapter builds on the previous one, which eventually results in you mastering programming concepts in Lua. Next, the book teaches you complex technologies that you can implement in your game. Each concept is explained clearly and uses simple examples that show you how the technology is being used. This book contains additional exercises for you to experiment with the concepts you’ve learned. Using best practices, you will understand how to write and build complex systems such as databases, user input controls, and all device user interfaces. In addition, you will learn how to build an entire game from scratch.
By the end of this book, you will be able to program complex systems in Roblox from the ground up by learning how to write code using Luau and create optimized code.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 655

Veröffentlichungsjahr: 2022

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Mastering Roblox Coding

The unofficial guide to leveling up your Roblox scripting skills and building games using Luau programming

Mark Kiepe

BIRMINGHAM—MUMBAI

Mastering Roblox Coding

Copyright © 2022 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Rohit Rajkumar

Publishing Product Manager: Ashitosh Gupta

Senior Editor: Aamir Ahmed

Senior Content Development Editor: Rakhi Patel

Technical Editor: Shubham Sharma

Copy Editor: Safis Editing

Project Coordinator: Sonam Pandey

Proofreader: Safis Editing

Indexer: Subalakshmi Govindhan

Production Designer: Shankar Kalbhor

Marketing Coordinator: Elizabeth Varghese

First published: August 2022

Production reference: 1290722

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

ISBN 978-1-80181-404-1

www.packt.com

Contributors

About the author

Mark Kiepe is an experienced Roblox Programmer and Game Designer with over six years of experience. He has contributed to several successful Roblox games. Besides these achievements, he is also the Co-Owner of a Roblox Game Studio called Sarcastic Studios, with games such as Pet Store Tycoon and Dream Island. Mark has contributed to more than 150 million play sessions across all games at the time of writing.

Mark started as a self-taught programmer on Roblox. What he learned on Roblox helped him in college. He currently attends a University of Applied Sciences in The Netherlands, where he studies Software Development.

I want to thank my parents and brother for their continuous support while writing this book. I am incredibly grateful for the amount of motivation they have given me.

Thanks to everyone at Packt for helping me write this book. It means the world to me.

I want to give a special thanks to Aamir and Rakhi. I have learned so much about writing through your feedback that I would have never accomplished without them.

I would also like to thank Vaideeshwari for giving me the opportunity to write this book.

About the reviewers

Arnav is a UGC Event Organizer working alongside DevRel for Roblox. He has hosted numerous events on the platform and is also an experienced developer. He has over 350 million contributed visits. He is known by his Roblox username “AceDevArnav” and is also the owner of Ace Developing Studios , which is one of the rising studios on Roblox with its upcoming games and UGC items.

Mir Ali was born in Karnataka, India on June 4, 1983. He studied in Dubai, UAE. He learned programming from the 6th Grade, starting with Q Basics, and then learning C and C++. He found these boring, as there was no way to visualize the results, and nothing made sense to him back then, except for a few ways of using IF statements, and a calculator that he made himself. He also couldn’t quite figure out what the lines of code were, when they started, or what OOP was. He therefore called it quits on programming and took a journey into building Gaming PC and servers. He then did his Cisco certification and went deeper to configure ATM relays and protocols, and calculate IP addresses for big companies.

Years passed by, and he became a father. One day his son came to him and asked, "Father, what is LUA, and how do you make an obby with rotating parts?" Mir Ali saw hope in his son’s eyes, and got up, opened Roblox, and started teaching him. He taught his son IF conditions and operators, which were easy until he reached a syntax “:”, which was from OOP. This was when lightning struck him, and everything made sense. He taught his son a full library of LUA, including Bitwise operations, and made his own Physics and network library from scratch. Now, instead of his son, Mir Ali teaches corporate giants such as Accenture, Vodafone, Microsoft, and Walmart, to name but a few. He teaches the procedural generation of buildings and environments with complex floors, and ways to enter them. He also teaches Deep math and trigonometry, such as how to make your own Math library. Last but not least, Mir Ali teaches M.L and A.I.

To my children, Arafath, Ishan, Hasanath, and Saleyhath, who motivated me.

Table of Contents

Preface

Part 1: Start Programming with Roblox

Chapter 1: Getting Up to Speed with Roblox and Luau Basics

Technical requirements

Understanding Roblox and Luau

Creating an account

Introducing Luau

Understanding and using data types in Luau

Creating a script

Hello, world!

Numbers

Math operations

Combining math operations

String concatenation

Escape characters

Casting data types

Booleans

Logical operators

Introducing and using variables

Lower and upper camel case

Updating variables

Removing magic numbers

Introducing constants

Using conditionals

Relational operators

if-else conditionals

Using elseif

Nested if statements

Understanding scopes

Exercise 1.1 – Changing properties on a part

Exercise 1.2 – Police system part I

Exercise 1.3 – Understanding a script

Summary

Chapter 2: Writing Better Code

Technical requirements

Using functions

Making a function

Parameters and arguments

Multiple parameters

Default parameter values

Returning functions

Multiple return values

Nested functions

Best practices when using functions

Storing data types in tables

Storing data in a table

Reading data from a table

Setting data in a table

Using dictionaries

Multi-dimensional tables

Functions in a table

Programming loops

while loops

repeat until loops

for loops

Continuing and stopping a loop

Large oops

Using modules

Creating a module script

Requiring the module from another script

Exercise 2.1 – simple elevator

Exercise 2.2 – converting loops

Exercise 2.3 – Police System II (difficult)

Summary

Chapter 3: Event-Based Programming

Technical requirements

Introduction to events

Functions on instances

Listening to events

Using properties for missing events

Creating custom events

Using bindable events

Using bindable functions

Comparing events to modules (advanced)

Using bindable events in modules (advanced)

Exercise 3.1 – event-based game

Summary

Part 2: Programming Advanced Systems

Chapter 4: Securing Your Game

Technical requirements

Understanding the client and server

Introducing LocalScripts

FilteringEnabled

Replication exceptions to FilteringEnabled

Client and server responsibilities

Using RemoteEvents and RemoteFunctions

Setting up the GUI

Client-sided Team Changer

Using RemoteEvents

Using RemoteEvents from the server to the client

Using RemoteFunctions

Implementing security

Server checks

Implementing debounces

Honeypots

Filtering user text

TextObject

The GetNonChatStringForBroadcastAsync function

The GetChatForUserAsync function

Exercise 4.1: Securing your game

Exercise:

Summary

Chapter 5: Optimizing Your Game

Technical requirements

Understanding and using StreamingEnabled

Enabling StreamingEnabled

Programming with StreamingEnabled

Working with animations

Uploading animations

Understanding the Animator object

Programming an AnimationTrack

Animations on NPCs

Working with tweens

Setting up the gate

Setting up the server scripts

Getting tween data

Understanding TweenInfo

Creating a tween

Client-sided debounces

Custom yielding functions

Exercise 5.1 – greeting an NPC

Exercise 5.2 – falling block

Summary

Chapter 6: Creating User Interfaces for All Devices

Technical requirements

Creating GUIs

Using ScreenGuis

Using SurfaceGuis

Using BillboardGuis

Optimizing UIs

Testing GUIs

Small UI improvements

Working with color-blindness

Displaying controls

Improving GUI navigation

Using images

Using Tweens

Core GUIs

Exercise 6.1 – Creating a shop GUI

Summary

Chapter 7: Listening to User Input

Technical requirements

Working with ClickDetectors

Working with ProximityPrompts

Working with tools

Implementing advanced user input

Keyboard input

Gamepad input

Mouse input

ContextActionService

Choosing how to listen to user input

Exercise 7.1 – Eating food

Summary

Chapter 8: Building Data Stores

Technical requirements

Introduction to data stores

Saving data

Error handling

Reading data

Creating default player data

Saving tables

Saving dictionaries

Saving user data in data stores

Removing data

Writing safer data stores

Caching data

Autosaving

Improving error handling

Data store limitations

Creating a DataManager

Setting versus updating data

Working with ordered data stores

Exercise 8.1 – Building and testing data stores

Exercise 8.2 – Simple obby

Summary

Chapter 9: Monetizing Your Game

Technical requirements

Programming game passes

Prompting game passes

Rewarding game passes

Instant game pass reward

Implementing developer products

Prompting developer products

Rewarding developer products

Working with PolicyService

Giving Premium Benefits

Implementing Premium Benefits

Third-party sales

Implementing third-party sales

Exercise 9.1 – building a currency system

Summary

Part 3: Creating Your Own Simulator Game

Chapter 10: Creating Your Own Simulator Game

Technical requirements

Introduction to the game

Creating data stores

Getting keys for our data stores

DataManager functions

DataManager events

Implementing server scripts

Implementing leader stats

Implementing monetization scripts

Implementing character upgrades

Claiming orbs

Implementing rebirths

Selling orbs

Programming GUIs

Programming the SideButtons GUI

Programming the Rebirthing GUI

Programming the DeveloperProducts GUI

Programming the GamePasses GUI

Programming the Upgrade GUI

Updating your game

Summary

Index

Other Books You May Enjoy

Part 1: Start Programming with Roblox

This part of the book will focus on the basics of Roblox development. It is highly recommended to have a basic knowledge of Roblox and Roblox Studio. However, everything is explained from the ground up using best practices that will help you throughout the rest of the book. This is still addressed as it is a must-have for the rest of the book.

This section comprises the following chapters:

Chapter 1, Getting Up to Speed with Roblox and Luau Basics Chapter 2, Writing Better CodeChapter 3, Event-Based Programming