Author Topic: Pizza Delivery Gamemode  (Read 11627 times)


Last Update: November 27, 2016

Unzip the downloaded file. It contains two folders: Add-Ons and Music.
Move everything inside the Add-Ons folder to your blockland Add-Ons folder.
Move everything inside the Music folder to your blockland Music folder.


This gamemode is designed to satisfy your desire to deliver pizzas while competing with co-workers for money and survival. I could describe the amazing code that makes it work, but I don't want to bore you (yet). Just enjoy delivering pizzas and avoiding explosive death. There are four modes within this gamemode: Golden Pizza, Explosive Pizza, One for One, and One for All.

Make sure to say /help when you get started; this will provide info on how to use the compass to find your customer, the goal of each mode, the different vehicles you can unlock in the store, how to view player stats, round info, music selection, and map commands.

Player stats are saved, so you can restart your server and everyone should still have their money, car selection, etc. The gamemode is meant to be played with several players, but it's possible to play solo. If you read all of this short text, you deserve a secret command; say /color to set the color of your vehicle.

You will need to know how to use the compass, described below:


More info can be found HERE

About the code
Pizza delivery gamemode is based off of the default speedkart gamemode script; when I first got started, I copied/pasted all of the speedkart gamemode because it had things I needed like a round system and map rotation. Next, I began thinking about how pizzas could be delivered. The best method I found was to make a stationary bot inside of a 16x cube zone brick; I modified the zone script so that when a vehicle enters, several things happen: it checks if the player is the deliverer to the bot within the zone, makes the bot play one of several randomized animations and sounds, gives the player money, and sets the player's next delivery location.

To implement this pizza-delivering system of zones and bots, I needed to link bot spawn bricks with their 16x zones; to do this, I named each zone and bot spawn with corresponding numbers - for example, "bot1" goes with "zone1," "bot2" goes with "zone2," and so on up to however many delivery locations you decide to have. When the gamemode launches and when the map switches, it waits for all bricks to load and then checks through every brick, searching for names that begin with "bot" and "zone." If it finds a match, it will take note of the brick's ID and add it to a list. There are several other important bricks that the gamemode defines using this method: pizza pickup zones, starting gates, starting clocks, and vehicle spawns.

Another part of the script that I think is interesting is how it decides the amount of money players earn for each delivery. To make it as fair as possible, I made each delivery worth an amount proportional to the distance from the previous delivery location to the next delivery location; for your first delivery, the amount you earn is proportional to the distance from your spawn to your first delivery location. I might add a feature in the future that awards more money for faster deliveries.

The last thing I want to mention is how the explosive pizza is transferred from one player to another. First, the script defines a global variable for the bomb carrier. Every 33 milliseconds, it checks if there is a player near the bomb carrier and it checks if there are any bricks between the two players by firing a raycast from the bomb carrier toward the closest player and seeing what it hits first. If there are no bricks in the way, the bomb transfer process begins. At this point, the bomb is deactivated for 4 seconds to prevent it from instantly being transferred back to the original bomb carrier, an animation plays on both the bomb transferrer and acquirer (mounting the pizza image to their hands, lifting the hand, lowering the hand), a sound plays to the server, and 4 seconds later the bomb is re-activated so it can be transferred again.

Pretty sweet code right?

Making this gamemode has provided useful insight on how to make a game interesting or engaging. The most important factor seemed to be keeping the gameplay as stimulating as possible; it helps a lot to have custom sounds, player/group interaction, and explosions or other visual spectacles. It also seems important to have a 'slow' period in the gamemode when players take a break from the action - round transitions usually accomplish this. Pizza delivery gamemode is still far from perfect.

Credits
Whirlwind (idea guy)
Wehrmacht (build)
Filipe1020 (vehicles)
Armageddon (compass script)
Cowboy Dude (idk, moral support)
Faraday (programming)
« Last Edit: February 11, 2018, 04:30:44 PM by Farad »


holy stuff this is very well done and fun even just in singleplayer
like this is something i'd expect from a really popular server but never really given out like this
good job to those involved and thanks for releasing it dude

holy stuff this is very well done and fun even just in singleplayer
like this is something i'd expect from a really popular server but never really given out like this
good job to those involved and thanks for releasing it dude

Thanks! Let me know if you find any bugs. I know there are a few, but they shouldn't be game-breaking.

You are the kind of person that keep me playing this game. Thanks for actually releasing what you've made!

two things that bug me slightly though

the shadow color that's set for the environment is a bit too light because on some colors like the dark brown the shadow is actually brighter than the surface but that's just a cosmetic thing

there could be some more locations to deliver to like i've already run into a few of the same ones
of course after i say this i'm taken to pretty much everywhere else nah it's probably fine lol

otherwise this is pretty amazing
« Last Edit: November 20, 2016, 12:12:02 AM by gr8dayseth »


Would anyone be interested in making their own maps for this gamemode? I could make a short tutorial for it.

I'd love if you released parkour bounty hunter as well :(

I'd love if you released parkour bounty hunter as well :(

Yoke probably has the latest version of that gamemode. I haven't talked with him in a few months - I think we're both busy with college classes. I'll try to contact him about it.

Edit: I'm surprised no bugs have been reported yet. It has been downloaded about 30 times.
« Last Edit: November 21, 2016, 02:12:41 PM by Farad »

For whatever reason I have decided to begin working on a new mode. The goal of this mode will be to take and carry a golden pizza for the longest time during the round. One player will be selected randomly at the beginning of the round to start out with the golden pizza. The golden pizza can then be stolen by other drivers and the player who carries the golden pizza longest wins.

I think I will call this mode Golden Pizza.

I seem to be getting some really bad errors :(

When executing the gamemode and required addons, some seem to complain about damage types aready existing, rtb prefs already being defined, packages already being activated, etc. which is very odd. I made sure I didn't break my entire BL installation by playing another gamemode and it was fine so I have absolutely no idea what happened here.

I am loaded into the game, however my chat is loaded with error messages and I get some flashy screen effects, like when a player is deleted. After a few respawns, the game appears normal (the console is still printing compass tick errors at this point) and I can drive around. I can even deliver to bots that don't exist and are not loaded for some reason.

Console log: https://www.dropbox.com/s/ky94erxqgaq21xf/piza%20pls.log?dl=0

EDIT: Did a fresh install of Blockland and put the files provided in the OP into it. There's still some console errors but there are less of them, and no errors being printed into chat. Bots also appear now. No idea what's wrong with my main install but I guess this is solved. The water seems to have an invisible texture though?

Console log: https://www.dropbox.com/s/09tnilqe2xe9ntq/fresh%20install.log?dl=0
« Last Edit: November 22, 2016, 08:14:24 AM by Crispy_ »

I am loaded into the game, however my chat is loaded with error messages and I get some flashy screen effects, like when a player is deleted. After a few respawns, the game appears normal

This is normal behavior (for this gamemode) when the server is just started.

(the console is still printing compass tick errors at this point) and I can drive around. I can even deliver to bots that don't exist and are not loaded for some reason.

This is not normal behavior. The bots should spawn. I'll look at the console log.

The water seems to have an invisible texture though?

Good catch. I forgot to include a required add-on: Water_Demian. I'll add it to the download.

this is an awesome gamemode dude. keep up the good work!

I just updated the download link with a new gamemode (Golden Pizza) and a new map by Quadilious and [H], shown below:

edit: I also added the environment add-ons that are required for the sky and water texture. For some reason the gamemode.txt doesn't support these types of files. Some bugs with spawning were also fixed, a few new sounds were added, and a new golden pizzabox model was added for the box transfer animation.
« Last Edit: November 24, 2016, 04:03:34 PM by Farad »