1 00:00:00,000 --> 00:00:03,840 Well, thank you for coming to my talk. The talk today is When Space Elephants Attack, 2 00:00:04,460 --> 00:00:09,660 and it's about a new game, a new contest that I'm bringing to DEF CON today, or this weekend, 3 00:00:09,840 --> 00:00:15,280 which is called the Schemaverse, and it's just basically a game within a database. 4 00:00:16,940 --> 00:00:21,140 So, first quickly, who am I? I'm an expert in designing video game UI. 5 00:00:21,720 --> 00:00:26,360 I'm specialized in computer-human interaction. I'm a graphic designer, 6 00:00:26,360 --> 00:00:32,400 and I'm also a very skilled technical writer. Except I'm actually none of those things whatsoever. 7 00:00:32,820 --> 00:00:38,600 I made a game in a database. That wouldn't make any sense. So who am I really? Just a database geek. 8 00:00:40,900 --> 00:00:47,400 So, Schemaverse 101. It's a space battle game played entirely within a PostgreSQL database. 9 00:00:48,800 --> 00:00:53,780 There's actually no UI whatsoever, just glorious SQL queries constantly. 10 00:00:54,620 --> 00:00:56,340 The game itself is a test game. 11 00:00:56,360 --> 00:00:59,540 It's a tick-based game, so basically everyone has a chance to do one move, 12 00:01:00,260 --> 00:01:04,560 and then the tick finishes, some things are calculated, and then the next tick goes on. 13 00:01:06,020 --> 00:01:08,780 The database itself is completely open to the internet. 14 00:01:09,880 --> 00:01:14,000 Everyone who gets the address for it will be able to connect, so long as you come to me first, 15 00:01:14,100 --> 00:01:16,180 at the contest booth, to sign up. 16 00:01:17,960 --> 00:01:20,380 Security is implemented within the database itself. 17 00:01:20,720 --> 00:01:24,280 There's also a couple of dirty little Perl scripts here and there, but Perl's always dirty. 18 00:01:25,780 --> 00:01:26,220 Surprise! 19 00:01:26,360 --> 00:01:28,220 Surprisingly, this game is actually a pretty good time. 20 00:01:28,400 --> 00:01:31,160 So I hope a couple people come, sign up, and give it a try. 21 00:01:31,860 --> 00:01:34,500 The game itself does also play after the con. 22 00:01:34,840 --> 00:01:37,100 There's just a constant running server you can join in. 23 00:01:38,280 --> 00:01:41,040 So why did I do this? Great question. 24 00:01:41,940 --> 00:01:44,680 Every geek needs a project. This just happens to be mine. 25 00:01:44,880 --> 00:01:46,420 I'm sure everyone can respect that. 26 00:01:47,260 --> 00:01:51,620 I also wanted to be educated myself on database security, learn a lot more, 27 00:01:52,180 --> 00:01:55,540 and learn about even just optimization and non-security elements. 28 00:01:55,540 --> 00:01:59,400 And I wanted to do the same and educate others on the matter. 29 00:02:00,100 --> 00:02:02,840 I also wanted to push database systems a little bit further. 30 00:02:03,040 --> 00:02:06,320 When I started creating this system, a lot of people told me, 31 00:02:06,960 --> 00:02:09,380 well, I asked the internet, because the internet is all-knowing, 32 00:02:09,440 --> 00:02:13,220 I said, what would you do to secure an open database on the internet? 33 00:02:13,540 --> 00:02:15,040 The only answer I got was don't. 34 00:02:16,860 --> 00:02:19,360 Well, why? What's wrong with that? 35 00:02:20,020 --> 00:02:21,340 It's just another application. 36 00:02:21,740 --> 00:02:24,240 What's missing from this system? 37 00:02:25,180 --> 00:02:27,200 That would make this a bad idea. 38 00:02:28,160 --> 00:02:29,840 So this is what I wanted to find out. 39 00:02:30,060 --> 00:02:31,540 And I might find out this weekend. 40 00:02:32,380 --> 00:02:34,040 And finally, it's also pretty funny. 41 00:02:35,020 --> 00:02:37,120 It's a game in a database. Come on. 42 00:02:37,940 --> 00:02:39,360 So why bring it to DEFCON? 43 00:02:40,320 --> 00:02:44,580 Clearly the last DEFCON that I've been at have just been too relaxing. 44 00:02:44,940 --> 00:02:46,740 Just drinking and having a good time. 45 00:02:46,860 --> 00:02:48,680 I felt I needed a little bit more stress while here. 46 00:02:50,220 --> 00:02:53,620 There also wasn't enough to break here, especially for the database geeks. 47 00:02:54,240 --> 00:02:56,420 So I've brought this here in hopes that you have a good time. 48 00:02:58,580 --> 00:03:00,660 So, getting into the actual gameplay. 49 00:03:01,420 --> 00:03:03,360 As I've mentioned, it's a tick-based game. 50 00:03:03,560 --> 00:03:06,380 Everyone goes, finished, new tick starts up. 51 00:03:07,380 --> 00:03:11,440 Basically, you command an army of ships who go out, conquer planets, 52 00:03:11,720 --> 00:03:13,620 and fight each other and blow things up. 53 00:03:14,200 --> 00:03:15,160 Sounds pretty good. 54 00:03:16,940 --> 00:03:19,860 So in the game, there's a bunch of different goals you can actually have. 55 00:03:20,200 --> 00:03:24,120 You can be a space jerk, running around just blowing people up. 56 00:03:24,120 --> 00:03:25,020 Not really actually playing. 57 00:03:26,300 --> 00:03:27,500 You can be the emperor. 58 00:03:28,120 --> 00:03:31,300 Just going and conquering every planet that you can find. 59 00:03:32,320 --> 00:03:34,040 You can be the planet pillager. 60 00:03:34,240 --> 00:03:38,360 And just rape the crap out of all the land resources that you can find. 61 00:03:38,620 --> 00:03:41,640 Using those resources to then build bigger and better things. 62 00:03:42,440 --> 00:03:43,940 Or, size matters. 63 00:03:44,200 --> 00:03:46,400 Build the biggest and best ships constantly. 64 00:03:47,320 --> 00:03:48,520 And you'll also win. 65 00:03:49,080 --> 00:03:51,120 But of course, there's one overall goal. 66 00:03:51,340 --> 00:03:53,160 Which is to do all of those things. 67 00:03:54,120 --> 00:03:54,960 And become the scheme of supremacy. 68 00:03:57,480 --> 00:03:59,560 So, how do you actually play this game? 69 00:04:00,880 --> 00:04:02,340 As I mentioned, you come to me. 70 00:04:03,020 --> 00:04:04,820 Or anyone who's at the contest booth. 71 00:04:05,800 --> 00:04:07,120 And you ask to register. 72 00:04:07,400 --> 00:04:10,460 When you register, you get inserted into the player table. 73 00:04:10,860 --> 00:04:13,420 And then you get an actual user account on the database. 74 00:04:13,800 --> 00:04:15,860 Yes, you are a user on the database. 75 00:04:17,660 --> 00:04:18,980 You also get two things. 76 00:04:19,080 --> 00:04:20,420 You get a row in the player's table. 77 00:04:20,660 --> 00:04:23,920 And you get a planet assigned to you. 78 00:04:24,120 --> 00:04:24,700 As your home planet. 79 00:04:25,500 --> 00:04:28,340 So you can see when you start out in the player table, you got some money there. 80 00:04:28,620 --> 00:04:32,280 You got, looks like 10 million, I don't really remember. 81 00:04:32,580 --> 00:04:34,940 And then you got a fuel reserve to get you started too. 82 00:04:36,280 --> 00:04:38,060 You also have something called an air channel. 83 00:04:38,320 --> 00:04:39,620 Which I'll get to later on. 84 00:04:40,400 --> 00:04:43,420 And finally, on your planet, you can see your planet has a location. 85 00:04:43,800 --> 00:04:44,640 Has a name. 86 00:04:44,840 --> 00:04:45,840 Which, it's your planet. 87 00:04:46,040 --> 00:04:47,580 You can update the name if you'd like. 88 00:04:48,540 --> 00:04:49,900 It also has a mine limit. 89 00:04:50,220 --> 00:04:54,080 That limit is only that number of ships. 90 00:04:54,120 --> 00:04:56,680 Can actually mine that planet per tick. 91 00:04:57,040 --> 00:04:58,940 And I'm going to get into that a little bit more later. 92 00:04:59,340 --> 00:05:01,500 And finally, the conqueror ID, which is you. 93 00:05:01,820 --> 00:05:02,420 Great work. 94 00:05:03,200 --> 00:05:08,600 So the planet you get off the beginning is somewhere off the far center of the universe. 95 00:05:08,880 --> 00:05:11,500 The center of the universe is where most of the battle will happen. 96 00:05:11,740 --> 00:05:13,380 So you get this planet off nowhere. 97 00:05:14,580 --> 00:05:17,500 And it's kind of your own little home that no one's likely to find. 98 00:05:19,160 --> 00:05:20,420 So now you've got your player. 99 00:05:20,540 --> 00:05:21,320 You've got a planet. 100 00:05:21,680 --> 00:05:22,640 Great, what's next? 101 00:05:22,640 --> 00:05:25,940 Well, I said it's a space battle game, so you need some ships. 102 00:05:26,460 --> 00:05:28,460 So I wasn't kidding when I said this is a sequel game. 103 00:05:28,720 --> 00:05:32,220 So what you want to do to create some ships, which will cost you a thousand dollars. 104 00:05:32,680 --> 00:05:33,480 Virtual dollars. 105 00:05:35,320 --> 00:05:36,940 Is insert into your ships table. 106 00:05:37,680 --> 00:05:39,140 Now there's a couple ways you can do that. 107 00:05:39,240 --> 00:05:40,000 It's fairly dynamic. 108 00:05:40,480 --> 00:05:43,940 You can either just give it a name and it'll be created at the center of the universe. 109 00:05:44,840 --> 00:05:46,000 You can give it some skill. 110 00:05:47,300 --> 00:05:49,500 Every ship gets 20 skill to start with. 111 00:05:49,580 --> 00:05:51,640 And you can kind of disperse that however you want. 112 00:05:51,640 --> 00:05:55,840 You can upgrade those more later on, but it's good just to have that initial go. 113 00:05:57,680 --> 00:06:00,400 And you can also specify the location of where you want to build. 114 00:06:00,760 --> 00:06:04,060 Now there's a little bit of extra rules there. 115 00:06:04,540 --> 00:06:09,480 Basically if you're building from the center, 3,000 in every direction from 0, 0. 116 00:06:10,660 --> 00:06:13,100 You can build wherever you want within that. 117 00:06:13,220 --> 00:06:13,760 That's fine. 118 00:06:14,520 --> 00:06:19,200 Outside of that range, you can only build on planets that you've already conquered. 119 00:06:20,820 --> 00:06:21,300 So. 120 00:06:21,640 --> 00:06:24,240 You've got your home planet where no one can get to it. 121 00:06:24,840 --> 00:06:28,960 You go there, mine some resources, and then hit center earth for the actual battle. 122 00:06:30,960 --> 00:06:31,400 So. 123 00:06:31,720 --> 00:06:33,400 What can ships actually do? 124 00:06:34,460 --> 00:06:37,340 Each of your ships have the ability to do three different actions. 125 00:06:37,920 --> 00:06:40,220 They can only do one of those actions per tick. 126 00:06:40,680 --> 00:06:42,420 So you have to decide what it's doing. 127 00:06:43,640 --> 00:06:49,180 When performing that action, both objects have to be within range of each other. 128 00:06:49,400 --> 00:06:51,440 Range is just another skill that you're... 129 00:06:51,640 --> 00:06:52,140 ship has. 130 00:06:54,680 --> 00:06:55,860 So what's the first action? 131 00:06:56,580 --> 00:06:57,460 Attacking, of course. 132 00:06:59,120 --> 00:07:00,860 So again, this is a sequel game. 133 00:07:01,020 --> 00:07:06,740 So there's a ships in range view to find all your enemy ships because you can't normally see them. 134 00:07:06,940 --> 00:07:09,120 But if they're within range of your ships, then you can. 135 00:07:11,220 --> 00:07:19,020 So using the attack function, you can actually attack from one of your ships to an enemy ship that is within range of you. 136 00:07:19,440 --> 00:07:20,120 Make sense? 137 00:07:21,640 --> 00:07:30,760 Actual attacking uses your attack skill and their defense skill plus a little bit of luck and then calculates that to your future health. 138 00:07:31,020 --> 00:07:33,180 That doesn't get committed until the end of the tick. 139 00:07:35,700 --> 00:07:37,880 Of course, if there's attacking, there's also repair. 140 00:07:38,440 --> 00:07:39,620 Repair is the same thing. 141 00:07:40,000 --> 00:07:44,400 You can actually repair anything within range of you. 142 00:07:44,720 --> 00:07:46,300 Repairing uses the engineering skill. 143 00:07:47,100 --> 00:07:49,280 No luck is really involved in that one. 144 00:07:49,400 --> 00:07:50,140 It's just engineering. 145 00:07:52,900 --> 00:07:54,540 And finally, there's mining. 146 00:07:55,400 --> 00:07:57,740 Mining is how you get all the resources in the game. 147 00:07:57,800 --> 00:08:00,960 Mining is how you continue on and build up your fleets and improve. 148 00:08:01,980 --> 00:08:05,580 So when you mine a planet, nothing happens instantly. 149 00:08:05,860 --> 00:08:08,580 You get added to a table called... 150 00:08:10,460 --> 00:08:11,220 Don't remember. 151 00:08:11,480 --> 00:08:11,940 Anyways. 152 00:08:12,800 --> 00:08:20,060 It's added to a mining table where it's just temporary for that tick that says this ship is mining this planet. 153 00:08:21,060 --> 00:08:28,160 At the end of the tick, all ships that tried to mine each planet try and do so. 154 00:08:28,380 --> 00:08:29,920 Now keep in mind there's that mine limit. 155 00:08:30,480 --> 00:08:34,000 So only a certain number of ships can mine a planet per tick. 156 00:08:34,860 --> 00:08:40,120 If you mine a planet more than anyone else that tick, you now conquer that planet. 157 00:08:45,220 --> 00:08:46,620 Oh, and you also get the resources. 158 00:08:47,620 --> 00:08:49,820 You don't have to conquer to get the resources though. 159 00:08:50,680 --> 00:08:52,580 So obviously ships can also move around. 160 00:08:52,920 --> 00:08:54,960 And this is the most finicky part of the game. 161 00:08:55,040 --> 00:08:56,780 It's the thing that people complain the most about. 162 00:08:56,940 --> 00:08:59,760 But you can write a better move function in SQL. 163 00:08:59,860 --> 00:09:00,640 The game is open source. 164 00:09:00,760 --> 00:09:01,320 Please do so. 165 00:09:04,040 --> 00:09:07,480 So there's really two ways you can use the move function. 166 00:09:07,720 --> 00:09:09,200 And keep in mind this is a 2D game. 167 00:09:09,580 --> 00:09:12,360 A 3D game in a database would just be weird. 168 00:09:14,960 --> 00:09:18,380 So the first way you can do it is actually give a speed. 169 00:09:18,380 --> 00:09:19,980 And then a destination. 170 00:09:21,240 --> 00:09:28,300 If you give a speed and a destination, your ship must have enough fuel to start and then slow down. 171 00:09:28,580 --> 00:09:33,400 If you want to start, or if you want to speed up to 100, then it'll take 100 fuel. 172 00:09:33,620 --> 00:09:36,880 When you get to your destination, it's going to take another 100 fuel to slow down. 173 00:09:37,540 --> 00:09:40,580 You also require fuel for changing direction while moving. 174 00:09:42,960 --> 00:09:48,300 If you don't have enough fuel to slow down, but you have enough fuel to speed up, 175 00:09:48,660 --> 00:09:50,720 you're not going to be able to use that first methodology. 176 00:09:51,080 --> 00:09:55,960 It's going to stop you and say, this isn't going to work because I can't stop you and you have a destination. 177 00:09:56,780 --> 00:10:03,080 But it will at least return back the direction that it was trying to go to your air channel, which I'll get to later on. 178 00:10:04,620 --> 00:10:09,560 So the second way you can do it, if you don't have that much fuel and you don't actually care about stopping anywhere, 179 00:10:09,760 --> 00:10:15,640 is just specifying the speed and then the direction and then just null and null for the actual location. 180 00:10:16,500 --> 00:10:18,360 Your ship is just going to go off into wherever it wants to go. 181 00:10:18,380 --> 00:10:19,280 It doesn't really matter. 182 00:10:19,440 --> 00:10:21,980 You can refuel it later and stop it when you feel like it. 183 00:10:23,560 --> 00:10:24,940 So that's pretty much moving around. 184 00:10:25,120 --> 00:10:27,900 It's not too hard, but for some reason it is difficult. 185 00:10:28,680 --> 00:10:32,140 Nice little graph there on how moving actually goes as far as the direction. 186 00:10:34,500 --> 00:10:35,400 Not too complicated. 187 00:10:36,860 --> 00:10:39,840 So you've got these awesome ships, but you want them to be better. 188 00:10:40,240 --> 00:10:42,460 You want that size matters award, maybe. 189 00:10:43,580 --> 00:10:45,680 Well, there are a lot of upgrades you can do. 190 00:10:46,120 --> 00:10:48,160 You can upgrade the health, the fuel, the speed. 191 00:10:48,380 --> 00:10:48,740 Range. 192 00:10:48,940 --> 00:10:49,760 Range is a good one. 193 00:10:50,380 --> 00:10:52,640 Attack, defense, engineering, and prospecting. 194 00:10:52,900 --> 00:10:53,720 Prospecting is your mining. 195 00:10:53,900 --> 00:10:54,580 I should have mentioned that. 196 00:10:57,720 --> 00:11:00,520 Every skill does have a limit that you can upgrade it to. 197 00:11:01,200 --> 00:11:05,200 Attack, defense, engineering, and prospecting have a limit of 500 total. 198 00:11:05,440 --> 00:11:06,820 They can't surpass that. 199 00:11:07,420 --> 00:11:08,940 Everything else has its own limit. 200 00:11:09,620 --> 00:11:10,420 It's right there. 201 00:11:10,480 --> 00:11:12,660 It's also on the CD if you want to reference it. 202 00:11:17,640 --> 00:11:21,480 So just kind of a recap of what's going on in the game, what happens in a tick. 203 00:11:22,120 --> 00:11:24,040 Every ship can move once in the tick. 204 00:11:25,220 --> 00:11:27,740 The amount it moves is based on its speed. 205 00:11:29,080 --> 00:11:32,560 Every ship performs a single action, or they might do nothing. 206 00:11:32,700 --> 00:11:33,780 That's really up to you. 207 00:11:35,700 --> 00:11:42,240 After that, the perform mining function takes action and actually calculates who is successful in mining that planet. 208 00:11:42,240 --> 00:11:46,980 Gives out resources and awards new planet conqueror to anyone who's successfully done it. 209 00:11:49,120 --> 00:11:50,620 Planets will run out of fuel. 210 00:11:51,900 --> 00:11:58,760 So if that happens, some planets randomly will receive more fuel after each tick. 211 00:12:00,960 --> 00:12:02,920 Afterwards, damage and repair is committed. 212 00:12:03,080 --> 00:12:06,100 As I mentioned, attacking and repair happens to the future health. 213 00:12:06,540 --> 00:12:08,400 Future health becomes current health. 214 00:12:08,580 --> 00:12:09,140 Pretty simple. 215 00:12:10,080 --> 00:12:13,980 Any ship that has been at zero health for 60 ticks is going to explode. 216 00:12:14,520 --> 00:12:16,340 And you can no longer use that ship. 217 00:12:16,600 --> 00:12:21,600 All your upgrades are gone, but you do get a thousand virtual dollars of currency back. 218 00:12:21,860 --> 00:12:23,540 So that way you can build a new ship somewhere. 219 00:12:24,400 --> 00:12:27,220 And finally, tick underscore sequence dot next val. 220 00:12:28,200 --> 00:12:29,260 Tick goes to the next. 221 00:12:29,420 --> 00:12:30,080 Pretty standard. 222 00:12:31,940 --> 00:12:34,480 So general strategy, as I talked about earlier. 223 00:12:34,980 --> 00:12:38,020 Basically, you want to go build on your home planet that you've been given. 224 00:12:38,520 --> 00:12:40,060 Build up to your mine limit. 225 00:12:40,880 --> 00:12:43,020 And just mine the crap out of that planet. 226 00:12:43,500 --> 00:12:53,100 That's going to give you all the resources you need to then build some great ships for the center where everyone else is going to converge and try and branch out to get all the other planets. 227 00:12:54,360 --> 00:12:57,360 You're going to want to make sure you actually defend any planet you conquer. 228 00:12:57,580 --> 00:13:03,100 If you conquer a new planet, build some new ships around it to attack anything and to defend. 229 00:13:04,960 --> 00:13:06,120 It's pretty much the game. 230 00:13:08,020 --> 00:13:12,400 So anything that's happening in the game does enter your my events view that you have. 231 00:13:13,080 --> 00:13:15,160 Most things that happen successfully at least. 232 00:13:16,220 --> 00:13:18,040 Some events are public, some are private. 233 00:13:18,280 --> 00:13:22,840 You don't necessarily care when someone upgrades a ship or you don't necessarily should know when someone upgrades a ship. 234 00:13:24,040 --> 00:13:29,140 The events, my events view itself is designed to be read very programmatically. 235 00:13:29,700 --> 00:13:36,480 Because this is a game where you want to be able to pull details and actually figure out what you're going to do based on those details. 236 00:13:36,480 --> 00:13:41,600 But if you want to read it in a more human readable way of what's actually happening. 237 00:13:41,880 --> 00:13:45,060 If you just use the read underscore event function with the ID. 238 00:13:46,260 --> 00:13:50,120 It'll actually concatenate it into a nice little string that you can read. 239 00:13:51,700 --> 00:13:54,240 So there's a couple other little helper functions like that. 240 00:13:55,080 --> 00:13:57,380 Refuel ship obviously is fairly helpful. 241 00:13:58,660 --> 00:14:03,280 Every time you mine a planet, that fuel goes to your players fuel reserve. 242 00:14:03,920 --> 00:14:06,460 And then you can give that fuel to your players. 243 00:14:06,480 --> 00:14:07,340 To your ship. 244 00:14:07,980 --> 00:14:10,200 Doesn't go directly to the ship that mined it. 245 00:14:11,580 --> 00:14:12,980 Convert resource is important. 246 00:14:13,640 --> 00:14:16,020 Because you mine fuel but you want money. 247 00:14:16,260 --> 00:14:17,720 You need money to build things. 248 00:14:18,120 --> 00:14:19,620 It's actually a one to one relationship. 249 00:14:20,020 --> 00:14:24,180 Originally I had some crazy system where it would fluctuate. 250 00:14:24,460 --> 00:14:27,300 But the only thing you ever do is convert fuel to money. 251 00:14:27,420 --> 00:14:28,840 You never convert money to fuel. 252 00:14:30,100 --> 00:14:32,860 So it was kind of tanked. 253 00:14:33,980 --> 00:14:36,380 There's a couple other character variables. 254 00:14:36,380 --> 00:14:37,400 Get variable, get numeric variable. 255 00:14:37,560 --> 00:14:41,220 There's a variables table that holds the maximums and things that you can upgrade to. 256 00:14:41,420 --> 00:14:43,640 So it's just an easy way to get that value. 257 00:14:44,640 --> 00:14:46,700 And get player ID and get player username. 258 00:14:46,960 --> 00:14:50,620 You're going to use those a lot if you write some queries based on the events table. 259 00:14:51,140 --> 00:14:54,520 Or if you want to figure out who someone is that's attacking you. 260 00:14:55,720 --> 00:14:57,580 Other key views that you might find interesting. 261 00:14:57,800 --> 00:14:58,860 I talked about ships and range. 262 00:14:59,120 --> 00:15:02,080 Again, you can't see other ships in your my ships table. 263 00:15:02,220 --> 00:15:03,820 Because it's not your ships table. 264 00:15:03,960 --> 00:15:04,800 It's the my ships table. 265 00:15:06,380 --> 00:15:09,340 If you use the ships and range then you can actually see other ships around you. 266 00:15:11,040 --> 00:15:14,080 The my ships flight recorder is just kind of neat really. 267 00:15:14,200 --> 00:15:15,440 It's actually completely useless. 268 00:15:15,660 --> 00:15:18,880 But if you wanted to graph out and see where all your ships went then it's kind of fun. 269 00:15:19,580 --> 00:15:21,520 Finally there's also online players. 270 00:15:22,000 --> 00:15:23,100 Obviously what it is. 271 00:15:23,760 --> 00:15:27,460 Current stats just gives how many planets have been conquered. 272 00:15:27,780 --> 00:15:29,860 How many ships total are in the system. 273 00:15:29,980 --> 00:15:31,100 How many players are online. 274 00:15:31,360 --> 00:15:32,680 How many players are in the system. 275 00:15:33,020 --> 00:15:33,820 Etc, etc. 276 00:15:33,960 --> 00:15:36,000 So just how much money is in the system too. 277 00:15:36,380 --> 00:15:38,640 So it just kind of gives you a benchmark to see how you're doing. 278 00:15:38,840 --> 00:15:42,180 You can't really see very much about how anyone else is doing in the game. 279 00:15:42,280 --> 00:15:43,780 But you can see the overall stats. 280 00:15:43,940 --> 00:15:45,840 So you can kind of guess how well you're doing off of that. 281 00:15:46,100 --> 00:15:48,760 And then there's the public variable table again that I mentioned. 282 00:15:48,900 --> 00:15:51,520 Which you can just use those functions to graph. 283 00:15:53,040 --> 00:15:54,620 So finally fleet scripts. 284 00:15:54,980 --> 00:15:57,280 This is where the game actually gets super cool. 285 00:15:57,460 --> 00:15:58,560 At least in my opinion. 286 00:15:58,660 --> 00:16:00,180 I might have a weird sense of cool. 287 00:16:02,320 --> 00:16:05,440 Basically a fleet script allows you to 288 00:16:05,440 --> 00:16:08,420 automate all the gameplay for you. 289 00:16:10,000 --> 00:16:11,520 Because I love SQL. 290 00:16:11,800 --> 00:16:16,020 If you're sitting in this room you're either my friends or you like SQL as well. 291 00:16:16,940 --> 00:16:20,400 But you don't want to be writing SQL for the next 72 hours. 292 00:16:20,660 --> 00:16:21,760 To win a contest. 293 00:16:22,180 --> 00:16:23,240 Because we're at DEFCON. 294 00:16:23,280 --> 00:16:25,760 DEFCON is a little bit more fun than doing that constantly. 295 00:16:27,660 --> 00:16:29,660 So how do you actually do this? 296 00:16:29,720 --> 00:16:30,860 And how does it work? 297 00:16:31,320 --> 00:16:34,100 Well if you insert into your MyFleets table. 298 00:16:34,260 --> 00:16:34,900 Give it a name. 299 00:16:35,440 --> 00:16:36,040 First start. 300 00:16:38,480 --> 00:16:40,360 If you update your MyFleets table. 301 00:16:41,260 --> 00:16:43,260 With the script declarations column. 302 00:16:43,420 --> 00:16:44,320 And the script column. 303 00:16:46,000 --> 00:16:47,260 And then enable it. 304 00:16:48,020 --> 00:16:49,220 What's going to happen. 305 00:16:49,420 --> 00:16:51,320 Is it's going to take those sections there. 306 00:16:51,560 --> 00:16:53,280 Which you can see for this one. 307 00:16:53,360 --> 00:16:56,260 I'm taking all of the ships within range. 308 00:16:56,440 --> 00:16:57,960 And attacking the crap out of them. 309 00:17:00,460 --> 00:17:04,260 The system will take that data you just updated into those columns. 310 00:17:04,260 --> 00:17:06,560 And then create a function out of it. 311 00:17:07,380 --> 00:17:11,040 So you can see this will be called fleet underscore script underscore nine. 312 00:17:11,320 --> 00:17:14,320 Because we updated fleet script ID equals nine. 313 00:17:15,700 --> 00:17:17,660 The declarations go under declare. 314 00:17:17,960 --> 00:17:19,380 And the scripts go under begin. 315 00:17:20,220 --> 00:17:22,140 Just in case nothing does get returned. 316 00:17:22,420 --> 00:17:24,300 Got a quick little return one at the end there. 317 00:17:24,460 --> 00:17:27,080 If you wanted to return something that makes you feel better it's fine. 318 00:17:27,180 --> 00:17:27,440 Do so. 319 00:17:30,120 --> 00:17:30,600 So. 320 00:17:31,360 --> 00:17:32,900 Now you've just got this function. 321 00:17:32,900 --> 00:17:34,680 Which isn't really doing a lot. 322 00:17:34,880 --> 00:17:37,800 It makes it easier because now you don't have to rewrite the scripts every time. 323 00:17:37,880 --> 00:17:38,500 You just call them. 324 00:17:39,900 --> 00:17:43,000 But if you want that to happen automatically for you every tick. 325 00:17:44,620 --> 00:17:45,660 You can do that. 326 00:17:47,180 --> 00:17:50,640 The script that controls all the ticks is tick dot PL. 327 00:17:51,160 --> 00:17:54,060 Tick dot PL is just one of my dirty little Perl scripts. 328 00:17:54,480 --> 00:17:57,420 And it will actually connect as your user. 329 00:17:57,820 --> 00:18:00,140 And run that function on your behalf. 330 00:18:00,600 --> 00:18:01,700 Every single tick. 331 00:18:02,900 --> 00:18:07,500 To do so you just have to buy a minimum of one minute of processing time for it. 332 00:18:07,920 --> 00:18:09,000 Which is ten million. 333 00:18:10,080 --> 00:18:11,700 They're expensive because time is money. 334 00:18:12,580 --> 00:18:14,080 And you have to set it to enabled. 335 00:18:14,320 --> 00:18:16,600 The enabled is really just for your own little reference. 336 00:18:16,900 --> 00:18:18,560 So if you wanted something to stop. 337 00:18:18,740 --> 00:18:19,720 Then you could do so. 338 00:18:20,700 --> 00:18:22,720 If your script runs past that one minute. 339 00:18:23,180 --> 00:18:23,900 Everything's cancelled. 340 00:18:24,060 --> 00:18:24,840 Gets reverted back. 341 00:18:25,120 --> 00:18:26,380 And you just lose what you did. 342 00:18:26,580 --> 00:18:28,240 So you have to keep it within that one minute. 343 00:18:28,240 --> 00:18:30,180 Or buy another minute onto it. 344 00:18:31,740 --> 00:18:33,540 To buy any time for it. 345 00:18:33,580 --> 00:18:34,920 You just use the upgrade function again. 346 00:18:35,100 --> 00:18:36,340 You pass it the fleet ID. 347 00:18:36,660 --> 00:18:39,100 And you pass it fleet run time as the code. 348 00:18:39,540 --> 00:18:41,280 And then you can specify the quantity. 349 00:18:41,540 --> 00:18:42,840 So this would buy one more minute. 350 00:18:42,960 --> 00:18:43,780 For my fleet nine. 351 00:18:46,280 --> 00:18:48,880 So obviously you don't necessarily see what's happening in the fleet. 352 00:18:49,040 --> 00:18:50,000 Because you're not running it. 353 00:18:50,220 --> 00:18:51,420 So if there's been any problems. 354 00:18:51,600 --> 00:18:53,240 You just notice I'm not getting any money. 355 00:18:53,400 --> 00:18:54,140 This kind of sucks. 356 00:18:54,140 --> 00:18:56,840 So I have actually made a way. 357 00:18:56,900 --> 00:18:58,380 Where you can see what's going on too. 358 00:18:59,460 --> 00:19:02,600 Postgresql has a notify system built into it. 359 00:19:02,860 --> 00:19:04,240 And I utilize that. 360 00:19:04,460 --> 00:19:06,260 To use that error channel. 361 00:19:06,400 --> 00:19:07,820 That I threw in my players. 362 00:19:08,340 --> 00:19:10,760 Any errors that your script will have. 363 00:19:11,060 --> 00:19:12,180 Will be piped to that. 364 00:19:12,960 --> 00:19:14,460 So if you type listen. 365 00:19:14,680 --> 00:19:15,680 And add your error channel. 366 00:19:16,540 --> 00:19:18,380 Every time you run a sequel query. 367 00:19:18,860 --> 00:19:20,320 Within the results payload. 368 00:19:20,680 --> 00:19:22,440 It's going to include any new errors. 369 00:19:22,540 --> 00:19:23,180 That you've had. 370 00:19:23,540 --> 00:19:24,120 In the script. 371 00:19:24,140 --> 00:19:25,200 In that queue. 372 00:19:26,480 --> 00:19:29,260 I also wrote a super insecure python script. 373 00:19:29,640 --> 00:19:30,900 Which you shouldn't run. 374 00:19:31,040 --> 00:19:31,900 From the defcon network. 375 00:19:32,200 --> 00:19:33,560 Because you will be on the wall of sheep. 376 00:19:34,580 --> 00:19:35,900 There's no SSL on it. 377 00:19:36,020 --> 00:19:37,200 If you want to download the script. 378 00:19:37,360 --> 00:19:38,440 It's on schemaverse.com. 379 00:19:38,900 --> 00:19:41,300 If you have some server off defcon. 380 00:19:41,480 --> 00:19:42,740 That you feel more comfortable using. 381 00:19:43,060 --> 00:19:44,420 Then it's fine to use it. 382 00:19:44,460 --> 00:19:45,180 It's not a big deal. 383 00:19:46,820 --> 00:19:48,280 But please don't use it here. 384 00:19:49,220 --> 00:19:50,920 Here's a little example of what it looks like. 385 00:19:51,160 --> 00:19:52,540 It's dead simple. 386 00:19:54,140 --> 00:19:55,700 It's the schemaverse output stream or SOS. 387 00:19:56,000 --> 00:19:58,240 And it will just list anything that's going on. 388 00:19:58,460 --> 00:20:00,440 There's also a couple other things in the system. 389 00:20:00,500 --> 00:20:01,360 That will notify here. 390 00:20:01,500 --> 00:20:02,340 Not just fleet scripts. 391 00:20:02,560 --> 00:20:04,480 But any time move fails or things like that. 392 00:20:04,680 --> 00:20:05,780 It just gives it here. 393 00:20:06,040 --> 00:20:07,840 I did have an error table at first. 394 00:20:08,140 --> 00:20:12,180 But after 10 million records in a couple days. 395 00:20:12,460 --> 00:20:14,260 It didn't seem like a good idea to continue. 396 00:20:16,240 --> 00:20:17,720 So this is defcon. 397 00:20:18,300 --> 00:20:19,700 Security in this game. 398 00:20:20,700 --> 00:20:21,820 As I mentioned earlier. 399 00:20:21,960 --> 00:20:23,440 Most people's response was don't. 400 00:20:24,980 --> 00:20:25,860 But hopefully. 401 00:20:26,100 --> 00:20:27,940 I think it might last. 402 00:20:28,080 --> 00:20:29,300 It lasted the first night. 403 00:20:29,500 --> 00:20:30,800 So I'm pretty happy about that. 404 00:20:32,360 --> 00:20:33,800 Architecture wise in the game. 405 00:20:34,160 --> 00:20:34,960 As I said. 406 00:20:35,080 --> 00:20:36,000 You are users. 407 00:20:36,280 --> 00:20:38,360 So the players are users in the system. 408 00:20:39,920 --> 00:20:41,160 Then you've got the database. 409 00:20:41,480 --> 00:20:42,940 And then you've got the two Perl scripts. 410 00:20:43,260 --> 00:20:45,020 And I didn't really talk about the one Perl script yet. 411 00:20:45,060 --> 00:20:45,700 But I'll get to it. 412 00:20:46,200 --> 00:20:47,740 And that's really all the system is. 413 00:20:50,020 --> 00:20:52,660 So what was I worried about when writing this game? 414 00:20:52,660 --> 00:20:54,920 Well query limits was the first one. 415 00:20:55,800 --> 00:21:00,620 All it takes is one person to run a couple queries of generate series 1 to infinity. 416 00:21:01,300 --> 00:21:02,020 And then. 417 00:21:02,560 --> 00:21:05,440 No one could ever have another query actually run on this system. 418 00:21:06,160 --> 00:21:08,040 So I needed to find a way to stop that. 419 00:21:09,040 --> 00:21:11,120 Obviously authentication is a bit of an issue. 420 00:21:11,320 --> 00:21:13,660 Luckily I've got super secure MD5 going on. 421 00:21:14,100 --> 00:21:15,380 That was the best I could do. 422 00:21:16,840 --> 00:21:17,800 SQL injections. 423 00:21:18,140 --> 00:21:19,060 Obviously a problem. 424 00:21:19,260 --> 00:21:21,360 Although admittedly at first I thought. 425 00:21:21,460 --> 00:21:21,600 Well. 426 00:21:21,600 --> 00:21:24,060 A user can only do. 427 00:21:24,760 --> 00:21:26,860 What they have the ability to do on the system. 428 00:21:27,100 --> 00:21:29,100 And I kind of forgot a key fact of. 429 00:21:29,520 --> 00:21:31,960 There was another higher power user. 430 00:21:32,100 --> 00:21:32,960 Controlling some things. 431 00:21:34,840 --> 00:21:35,760 And finally. 432 00:21:36,520 --> 00:21:37,920 Postgres exploits and quirks. 433 00:21:38,460 --> 00:21:41,880 I don't really know what the next zero day is for Postgres. 434 00:21:42,160 --> 00:21:43,520 If it happens this weekend. 435 00:21:43,960 --> 00:21:45,220 I have things logging. 436 00:21:45,480 --> 00:21:47,060 So I hope I find it. 437 00:21:48,540 --> 00:21:49,720 As I mentioned earlier. 438 00:21:49,820 --> 00:21:51,580 Most communities were less than helpful to me. 439 00:21:51,600 --> 00:21:53,240 On pretty much all of this. 440 00:21:53,500 --> 00:21:54,140 The only. 441 00:21:54,360 --> 00:21:56,820 I think the one response I got was use SSL. 442 00:21:56,900 --> 00:21:59,340 So someone connects securely to my box. 443 00:21:59,460 --> 00:22:00,140 And then destroy it. 444 00:22:00,360 --> 00:22:01,520 So I was really happy about that. 445 00:22:04,160 --> 00:22:05,960 So the basics that I kind of went on. 446 00:22:06,260 --> 00:22:06,700 Basically. 447 00:22:07,020 --> 00:22:08,980 As far as the actual game play goes. 448 00:22:09,440 --> 00:22:11,680 Almost everything in the game is based off of. 449 00:22:11,720 --> 00:22:14,740 Player ID equals get player ID session user. 450 00:22:14,960 --> 00:22:16,460 Session user is just a variable. 451 00:22:16,720 --> 00:22:17,920 System variable in Postgres. 452 00:22:18,100 --> 00:22:18,800 That's who's connecting. 453 00:22:19,260 --> 00:22:20,540 So because you're a user. 454 00:22:21,600 --> 00:22:22,460 Next to your my players table. 455 00:22:22,820 --> 00:22:24,720 That's how I figure out what you're allowed to do. 456 00:22:25,020 --> 00:22:26,020 And all the views. 457 00:22:26,120 --> 00:22:26,760 All the triggers. 458 00:22:26,900 --> 00:22:27,900 Everything is based off that. 459 00:22:28,660 --> 00:22:30,000 Which gets me to the next thing. 460 00:22:30,340 --> 00:22:31,360 How do I control data? 461 00:22:32,040 --> 00:22:35,460 It's basically just as I would hope you would develop. 462 00:22:35,500 --> 00:22:38,260 Your regular application security within your database. 463 00:22:38,620 --> 00:22:39,100 I use roles. 464 00:22:39,420 --> 00:22:41,400 To make sure that users should only do. 465 00:22:41,480 --> 00:22:42,500 What users can do. 466 00:22:42,660 --> 00:22:44,520 And can only see what they should be able to see. 467 00:22:45,340 --> 00:22:48,080 Triggers and functions control most of the data changes. 468 00:22:48,260 --> 00:22:51,040 That users don't have direct access to update. 469 00:22:51,960 --> 00:22:53,440 Rules do the same I should say. 470 00:22:53,740 --> 00:22:55,800 And then views just make sure you can only see. 471 00:22:55,880 --> 00:22:56,740 What you're supposed to see. 472 00:22:56,860 --> 00:22:58,240 Again you shouldn't be able to see. 473 00:22:58,340 --> 00:22:59,700 Where other players ships are. 474 00:22:59,840 --> 00:23:03,320 I did enable SSL. 475 00:23:03,500 --> 00:23:05,460 Because I do want people to connect securely. 476 00:23:05,520 --> 00:23:06,340 And destroy my box. 477 00:23:07,360 --> 00:23:08,580 Well I'd rather they win. 478 00:23:08,740 --> 00:23:12,060 But I'd rather someone not find the user name. 479 00:23:13,240 --> 00:23:14,400 And finally availability. 480 00:23:14,760 --> 00:23:15,800 Which was those query limits. 481 00:23:15,920 --> 00:23:16,720 That generate series. 482 00:23:17,860 --> 00:23:19,780 Postgres has a very very helpful. 483 00:23:21,600 --> 00:23:22,900 Variable within the configuration. 484 00:23:23,240 --> 00:23:24,900 Called set query timeout. 485 00:23:25,100 --> 00:23:26,320 Or statement timeout. 486 00:23:26,980 --> 00:23:27,500 Perfect. 487 00:23:27,760 --> 00:23:29,240 I thought this is exactly what I needed. 488 00:23:29,480 --> 00:23:31,780 No query should last longer than a minute. 489 00:23:31,920 --> 00:23:32,860 Was my original thought. 490 00:23:33,940 --> 00:23:35,240 So I set that up. 491 00:23:35,460 --> 00:23:36,380 And then I played around. 492 00:23:37,020 --> 00:23:40,400 And I found out that every single user. 493 00:23:40,540 --> 00:23:42,360 Who connects to Postgres. 494 00:23:42,640 --> 00:23:44,880 Has the ability to type set. 495 00:23:45,760 --> 00:23:47,480 Statement timeout equals zero. 496 00:23:49,620 --> 00:23:50,600 This is one of the things. 497 00:23:50,680 --> 00:23:51,220 Where I'm talking about. 498 00:23:51,600 --> 00:23:52,940 Using database systems a little bit. 499 00:23:53,080 --> 00:23:54,400 How is that acceptable? 500 00:23:55,840 --> 00:23:57,400 When you have something. 501 00:23:57,480 --> 00:23:58,200 That you configure. 502 00:23:58,520 --> 00:23:59,720 As a security measure. 503 00:24:00,100 --> 00:24:01,060 And a user. 504 00:24:01,180 --> 00:24:02,800 Any user can connect. 505 00:24:03,140 --> 00:24:04,920 And run a statement to set it to infinity. 506 00:24:05,620 --> 00:24:06,580 Didn't make any sense. 507 00:24:07,080 --> 00:24:09,080 That's where ref.pl comes into play. 508 00:24:09,580 --> 00:24:10,780 That's just another Perl script. 509 00:24:10,980 --> 00:24:12,640 That monitors all the processes running. 510 00:24:12,920 --> 00:24:15,420 And will kill anything that surpassed its time limit. 511 00:24:15,940 --> 00:24:17,300 It's actually a lot more dynamic. 512 00:24:17,480 --> 00:24:18,520 Than the statement would have been. 513 00:24:22,600 --> 00:24:23,900 And make less. 514 00:24:24,140 --> 00:24:25,000 I don't like them. 515 00:24:25,960 --> 00:24:26,480 So. 516 00:24:27,220 --> 00:24:28,580 Here's a little fun example. 517 00:24:28,780 --> 00:24:30,520 Of SQL injections that I thought. 518 00:24:30,960 --> 00:24:32,000 Oh it's fine. 519 00:24:32,480 --> 00:24:33,680 They're a player. 520 00:24:33,840 --> 00:24:34,980 They can only do so many things. 521 00:24:35,180 --> 00:24:36,000 That was really dumb. 522 00:24:36,680 --> 00:24:38,940 So in that fleet creation script. 523 00:24:39,760 --> 00:24:40,700 Where you take. 524 00:24:40,900 --> 00:24:43,100 What you've updated the fleets table to be. 525 00:24:43,420 --> 00:24:46,860 And then thrown it into the actual table itself. 526 00:24:47,600 --> 00:24:49,240 Or then that gets taken out. 527 00:24:49,360 --> 00:24:50,560 Put into the function. 528 00:24:51,600 --> 00:24:52,300 You see. 529 00:24:52,480 --> 00:24:54,100 Script declaration gets put there. 530 00:24:54,480 --> 00:24:55,660 And then the new script. 531 00:24:56,580 --> 00:24:58,680 I hope you can see the problem with this. 532 00:25:02,940 --> 00:25:04,040 Not only. 533 00:25:04,880 --> 00:25:07,200 Can someone privilege escalate. 534 00:25:07,200 --> 00:25:08,040 Their script. 535 00:25:08,160 --> 00:25:09,720 The function that they're creating. 536 00:25:09,920 --> 00:25:11,200 To be security definer. 537 00:25:11,340 --> 00:25:13,280 Security definer in Postgres means. 538 00:25:13,500 --> 00:25:16,240 The administrator is now running this basically. 539 00:25:16,440 --> 00:25:17,940 Or the person who created the function. 540 00:25:17,940 --> 00:25:18,300 Which. 541 00:25:19,220 --> 00:25:21,680 Only Schemaverse itself has the ability to do. 542 00:25:23,280 --> 00:25:24,540 Now your fleet script. 543 00:25:24,780 --> 00:25:26,000 Is going to run as Schemaverse. 544 00:25:26,060 --> 00:25:26,520 Every time. 545 00:25:27,620 --> 00:25:29,200 So I've got a nice little update. 546 00:25:29,300 --> 00:25:30,580 Player set balance equals zero. 547 00:25:30,980 --> 00:25:33,000 I may want to specify except me. 548 00:25:33,780 --> 00:25:35,120 But you get the gist of it. 549 00:25:35,980 --> 00:25:37,100 But not only that. 550 00:25:37,200 --> 00:25:37,840 After that. 551 00:25:38,280 --> 00:25:39,940 By inserting more nice code. 552 00:25:40,280 --> 00:25:42,840 I actually rewrite the move function as well. 553 00:25:43,360 --> 00:25:44,020 Because I. 554 00:25:44,800 --> 00:25:45,560 Why not. 555 00:25:47,940 --> 00:25:49,420 So I can send every player backwards. 556 00:25:49,720 --> 00:25:50,080 If I want. 557 00:25:50,200 --> 00:25:52,400 Or I can make the move function more convoluted. 558 00:25:53,020 --> 00:25:53,420 Great. 559 00:25:54,640 --> 00:25:56,080 So this was a bit of a problem. 560 00:25:57,440 --> 00:25:59,200 And I wasn't really sure how to fix it. 561 00:25:59,280 --> 00:26:00,760 I still don't know if I have fixed it. 562 00:26:00,860 --> 00:26:01,900 But I like my solution. 563 00:26:02,960 --> 00:26:04,340 I just added a secret. 564 00:26:05,620 --> 00:26:06,860 So let me go back to that quickly. 565 00:26:07,960 --> 00:26:10,180 Right underneath the initial create and replace. 566 00:26:10,540 --> 00:26:12,320 You have fleet under source script. 567 00:26:12,760 --> 00:26:14,540 It's just a quick string declaration. 568 00:26:14,660 --> 00:26:15,980 To say this is where it starts. 569 00:26:16,000 --> 00:26:16,780 This is where it ends. 570 00:26:18,560 --> 00:26:19,800 To fix this. 571 00:26:20,140 --> 00:26:21,500 I just made that random. 572 00:26:22,640 --> 00:26:23,740 If you don't know. 573 00:26:23,800 --> 00:26:25,020 How to end the script. 574 00:26:26,420 --> 00:26:27,680 Then you can't. 575 00:26:29,000 --> 00:26:29,960 Forcefully stop it. 576 00:26:31,220 --> 00:26:32,100 The error. 577 00:26:32,320 --> 00:26:33,680 The actual creation. 578 00:26:33,700 --> 00:26:34,560 Will just error out. 579 00:26:35,480 --> 00:26:37,080 Now I have had people with ideas. 580 00:26:37,160 --> 00:26:38,020 Come to me and say. 581 00:26:38,620 --> 00:26:40,520 What if I find a way to just make it. 582 00:26:40,600 --> 00:26:42,140 So that I throw an exception. 583 00:26:42,480 --> 00:26:43,680 And then my exception does something. 584 00:26:44,020 --> 00:26:45,380 I have no idea if this works. 585 00:26:47,940 --> 00:26:48,160 Again. 586 00:26:48,300 --> 00:26:48,820 It's DEFCON. 587 00:26:48,940 --> 00:26:49,820 It certainly can. 588 00:26:51,000 --> 00:26:52,540 So some final words on security. 589 00:26:54,120 --> 00:26:57,000 I hope that if someone does find a bug in this. 590 00:26:57,180 --> 00:26:58,480 That can destroy it. 591 00:26:58,800 --> 00:27:00,320 Instead of destroying it. 592 00:27:00,420 --> 00:27:01,480 They use it to win. 593 00:27:02,060 --> 00:27:03,600 Because if you can win this game. 594 00:27:04,300 --> 00:27:07,420 Through fairly unnecessarily good ways. 595 00:27:07,960 --> 00:27:08,780 It's DEFCON. 596 00:27:08,920 --> 00:27:09,880 Full respect to you. 597 00:27:10,180 --> 00:27:10,860 You win. 598 00:27:11,840 --> 00:27:13,140 I have no problem with that. 599 00:27:14,100 --> 00:27:16,140 So my only deterrent is the fact that. 600 00:27:17,940 --> 00:27:20,080 I'm running the first ever. 601 00:27:20,720 --> 00:27:21,460 Schemaverse tournament. 602 00:27:22,180 --> 00:27:23,540 I do have prizes. 603 00:27:25,380 --> 00:27:26,940 So if at the end of it. 604 00:27:27,080 --> 00:27:27,860 Someone does. 605 00:27:28,160 --> 00:27:29,720 Drop database schemaverse. 606 00:27:30,780 --> 00:27:32,440 Then no one wins my prizes. 607 00:27:32,680 --> 00:27:33,720 And they're actually pretty good. 608 00:27:35,040 --> 00:27:36,120 I have backups. 609 00:27:36,540 --> 00:27:38,100 But I don't. 610 00:27:39,620 --> 00:27:40,680 Once it goes down. 611 00:27:40,800 --> 00:27:42,460 I'm not sure if there's going to be time to fix it. 612 00:27:42,680 --> 00:27:43,480 I might be too drunk. 613 00:27:44,280 --> 00:27:45,360 But we'll see how it goes. 614 00:27:45,480 --> 00:27:47,860 So the tournament did start yesterday. 615 00:27:50,060 --> 00:27:51,540 Although in everyone's manual. 616 00:27:51,680 --> 00:27:53,180 I think it says the tournament starts tomorrow. 617 00:27:54,400 --> 00:27:55,800 But the tick actually. 618 00:27:56,360 --> 00:27:58,000 Like the game can take a while to play. 619 00:27:58,100 --> 00:27:59,260 Usually it's played over a week. 620 00:27:59,420 --> 00:28:01,920 I've tried to tweak it a little bit. 621 00:28:01,940 --> 00:28:02,920 To be a three day game. 622 00:28:03,200 --> 00:28:04,000 So here we are. 623 00:28:04,720 --> 00:28:06,240 It does end at Sunday at noon. 624 00:28:07,600 --> 00:28:07,960 Registration. 625 00:28:08,060 --> 00:28:08,840 If you want to come play. 626 00:28:08,940 --> 00:28:10,360 And I really hope that some people here do. 627 00:28:10,540 --> 00:28:11,700 It's going to be in the contest area. 628 00:28:11,900 --> 00:28:12,760 Just come find us. 629 00:28:13,200 --> 00:28:13,580 Register. 630 00:28:13,920 --> 00:28:14,580 And then you're good to go. 631 00:28:16,600 --> 00:28:17,960 I have no idea. 632 00:28:18,040 --> 00:28:19,660 How many users this will support. 633 00:28:21,340 --> 00:28:24,200 I've played with probably about 15 different players. 634 00:28:24,400 --> 00:28:25,800 And it's gone pretty good. 635 00:28:27,100 --> 00:28:29,320 I don't know if there's going to be more than that here. 636 00:28:29,520 --> 00:28:31,360 I don't know if there's going to be more power users. 637 00:28:31,680 --> 00:28:32,660 We'll see how it goes. 638 00:28:32,820 --> 00:28:34,440 At some point I may have to limit it. 639 00:28:34,700 --> 00:28:36,280 If I see it starting to slow down. 640 00:28:36,460 --> 00:28:37,300 Because as I mentioned. 641 00:28:37,680 --> 00:28:39,020 The tick won't end. 642 00:28:39,940 --> 00:28:41,440 Until everyone's scripting is done. 643 00:28:41,700 --> 00:28:42,740 And a tick will never end. 644 00:28:42,760 --> 00:28:44,560 It will only start until that first one is finished. 645 00:28:45,280 --> 00:28:47,400 So if I get 100 players. 646 00:28:47,780 --> 00:28:50,480 Then that's 140 minutes worth of processing time. 647 00:28:50,580 --> 00:28:51,780 If everyone takes up their limit. 648 00:28:51,940 --> 00:28:53,220 That they get off the beginning. 649 00:28:53,660 --> 00:28:56,040 So it can be a fairly long time. 650 00:28:56,220 --> 00:28:57,660 Which normally a tick would last one minute. 651 00:28:59,600 --> 00:29:00,640 So my prizes. 652 00:29:02,420 --> 00:29:05,000 To the person who gets first blood. 653 00:29:05,180 --> 00:29:06,900 The first person to attack in this game. 654 00:29:07,800 --> 00:29:08,280 Postgresql. 655 00:29:08,720 --> 00:29:09,200 Themselves. 656 00:29:09,300 --> 00:29:10,700 Have donated some nice swag. 657 00:29:11,120 --> 00:29:12,740 They've given me a t-shirt to give away. 658 00:29:12,760 --> 00:29:13,800 And some posters. 659 00:29:14,000 --> 00:29:16,240 Commemorating the release of 9.1. 660 00:29:18,720 --> 00:29:20,740 Navicat has given me one license. 661 00:29:20,840 --> 00:29:21,820 Of Navicat Postgres. 662 00:29:21,920 --> 00:29:23,380 Which is a pretty sweet piece of software. 663 00:29:24,220 --> 00:29:25,620 For Mac, Windows, etc. 664 00:29:25,780 --> 00:29:26,720 I'm not going to be a salesman here. 665 00:29:28,080 --> 00:29:30,200 And I have one free admission. 666 00:29:30,900 --> 00:29:32,020 To Postgres West. 667 00:29:33,180 --> 00:29:34,160 Or PG West. 668 00:29:34,420 --> 00:29:34,840 I should say. 669 00:29:35,600 --> 00:29:37,160 It's happening end of September. 670 00:29:37,380 --> 00:29:38,400 27th to 30th. 671 00:29:38,560 --> 00:29:40,020 I thought that was a great prize too. 672 00:29:42,760 --> 00:29:44,600 Not everyone might have the ability. 673 00:29:44,700 --> 00:29:45,880 To travel again in a month. 674 00:29:47,120 --> 00:29:47,720 That's why. 675 00:29:47,840 --> 00:29:49,280 Some of the prizes might be a little bit. 676 00:29:50,440 --> 00:29:51,400 Kind of decisive. 677 00:29:51,620 --> 00:29:53,320 Once we see some results. 678 00:29:54,040 --> 00:29:56,320 And I've also got an extra $50. 679 00:29:56,640 --> 00:29:57,120 American. 680 00:29:57,240 --> 00:29:58,940 From an anonymous donor. 681 00:30:00,240 --> 00:30:01,540 Who will basically. 682 00:30:01,800 --> 00:30:03,580 Whoever he sees fit in the game. 683 00:30:03,680 --> 00:30:04,160 Will get it. 684 00:30:07,400 --> 00:30:08,520 So those are my prizes. 685 00:30:08,920 --> 00:30:09,380 So finally. 686 00:30:09,380 --> 00:30:10,940 How do you actually connect to this game? 687 00:30:12,100 --> 00:30:13,100 However the hell you want. 688 00:30:13,660 --> 00:30:14,440 It's a database. 689 00:30:14,740 --> 00:30:15,500 On the net. 690 00:30:15,680 --> 00:30:17,420 Anything that can connect to the database. 691 00:30:17,760 --> 00:30:20,240 Be it any language you want. 692 00:30:20,400 --> 00:30:23,260 Python, Pearl, PHP, Ruby.net, Java, TCL. 693 00:30:23,540 --> 00:30:24,640 I super don't care. 694 00:30:24,980 --> 00:30:25,640 Use it. 695 00:30:25,740 --> 00:30:26,280 It's fine. 696 00:30:26,540 --> 00:30:28,720 Any database client you feel comfortable with. 697 00:30:28,980 --> 00:30:30,260 I'm going to say pgadmin. 698 00:30:30,400 --> 00:30:31,200 Might be your best bet. 699 00:30:31,360 --> 00:30:33,460 Because I know pgadmin has SSL. 700 00:30:33,900 --> 00:30:35,640 So I would suggest you use that. 701 00:30:39,380 --> 00:30:39,600 If you have a cat. 702 00:30:39,720 --> 00:30:42,220 Will automatically pipe it through some SSH for you. 703 00:30:42,340 --> 00:30:43,880 So that could be useful too. 704 00:30:44,620 --> 00:30:45,060 Again. 705 00:30:45,200 --> 00:30:46,500 We are at DEFCON. 706 00:30:46,840 --> 00:30:49,700 Wall of sheep will be plentiful with schemaverse accounts. 707 00:30:49,960 --> 00:30:50,700 If we're not careful. 708 00:30:50,900 --> 00:30:52,200 And I'd rather that not happen. 709 00:30:53,120 --> 00:30:54,540 So as you can see. 710 00:30:54,720 --> 00:30:55,680 Under my host. 711 00:30:56,900 --> 00:30:58,260 DB.schemaverse.com. 712 00:30:58,420 --> 00:30:59,920 With the super secret host name. 713 00:31:00,000 --> 00:31:00,820 That you use to connect. 714 00:31:01,180 --> 00:31:04,240 And it's just on a regular port of 5432. 715 00:31:08,480 --> 00:31:08,920 So. 716 00:31:09,380 --> 00:31:10,800 If you want more information. 717 00:31:11,180 --> 00:31:12,340 I've got website. 718 00:31:13,780 --> 00:31:15,040 DEFCON.schemaverse.com. 719 00:31:15,820 --> 00:31:16,780 And then I've got. 720 00:31:17,100 --> 00:31:18,380 Some project homes. 721 00:31:18,500 --> 00:31:19,300 That said it's open source. 722 00:31:21,100 --> 00:31:21,500 Now. 723 00:31:21,860 --> 00:31:23,980 My talk has ended up pretty fast. 724 00:31:24,280 --> 00:31:25,200 I apologize for that. 725 00:31:25,360 --> 00:31:26,700 I thought it was going to be too long. 726 00:31:26,800 --> 00:31:27,220 From yesterday. 727 00:31:27,900 --> 00:31:29,980 So I'll kind of talk a little bit more about strategy. 728 00:31:30,200 --> 00:31:32,120 And how to win if you actually want to. 729 00:31:33,180 --> 00:31:34,540 I do know some people. 730 00:31:34,540 --> 00:31:36,020 Who instead of. 731 00:31:36,440 --> 00:31:37,640 Using my tick system. 732 00:31:37,800 --> 00:31:39,860 Or the actual fleet system that I've developed. 733 00:31:41,200 --> 00:31:42,140 Instead of spending. 734 00:31:42,340 --> 00:31:43,440 Wasted money on that. 735 00:31:43,680 --> 00:31:46,320 They actually just write Python scripts instead. 736 00:31:47,240 --> 00:31:48,820 To run everything for them. 737 00:31:48,860 --> 00:31:49,380 Every minute. 738 00:31:50,580 --> 00:31:51,560 Roughly the same thing. 739 00:31:51,660 --> 00:31:53,080 You don't necessarily know when the tick ends. 740 00:31:53,180 --> 00:31:54,260 But you can always pull the system. 741 00:31:54,360 --> 00:31:55,500 And find out if there's a new tick. 742 00:31:56,060 --> 00:31:58,300 So you can be fairly creative. 743 00:31:58,400 --> 00:31:59,340 With how you play this game. 744 00:32:00,740 --> 00:32:01,900 Since I've got time. 745 00:32:02,040 --> 00:32:02,920 I'd love to answer questions. 746 00:32:03,060 --> 00:32:03,800 If anyone has it. 747 00:32:06,840 --> 00:32:07,240 Yeah. 748 00:32:07,620 --> 00:32:09,880 How do you find nearby planets? 749 00:32:10,580 --> 00:32:11,320 Nearby planets. 750 00:32:11,440 --> 00:32:12,720 You can see every planet in the game. 751 00:32:12,780 --> 00:32:13,900 Using the planets table. 752 00:32:14,060 --> 00:32:14,680 Well it's a view. 753 00:32:16,920 --> 00:32:17,600 Oh sorry. 754 00:32:17,740 --> 00:32:18,240 How can you see. 755 00:32:18,500 --> 00:32:21,260 The question was how can you see planets within range. 756 00:32:21,600 --> 00:32:24,060 And originally there was a planets in range view. 757 00:32:24,480 --> 00:32:25,720 And then I realized. 758 00:32:25,940 --> 00:32:28,200 Well we can kind of see most things. 759 00:32:29,340 --> 00:32:31,420 And it makes sense that you can kind of see most things too. 760 00:32:31,760 --> 00:32:32,160 So. 761 00:32:33,400 --> 00:32:36,460 Basically any planet that you want to see. 762 00:32:36,500 --> 00:32:36,940 Is in the view. 763 00:32:37,060 --> 00:32:38,380 And you can also see who's conquered it. 764 00:32:38,560 --> 00:32:39,640 So if you want to be a jerk. 765 00:32:39,780 --> 00:32:40,900 And target one of your friends. 766 00:32:41,120 --> 00:32:42,500 Then you can go find what he's got. 767 00:32:42,740 --> 00:32:43,740 And go attack it. 768 00:32:45,520 --> 00:32:46,260 Other questions? 769 00:32:46,760 --> 00:32:47,320 Over there. 770 00:32:50,880 --> 00:32:51,280 Sorry. 771 00:32:54,660 --> 00:32:55,060 Yes. 772 00:32:55,520 --> 00:32:57,600 You can conquer another player's home system. 773 00:32:59,340 --> 00:33:00,280 Now keep in mind. 774 00:33:00,300 --> 00:33:03,080 Most of the planets were developed very close to the center. 775 00:33:03,420 --> 00:33:08,000 And then as you get out of the kind of center area of the map. 776 00:33:08,200 --> 00:33:10,160 Then it becomes more and more sparse. 777 00:33:10,480 --> 00:33:11,660 So your home planet. 778 00:33:11,820 --> 00:33:14,740 It might actually be impossible to find. 779 00:33:14,840 --> 00:33:17,200 If you upgrade the ship speed completely. 780 00:33:17,380 --> 00:33:19,940 It might still be impossible to get to another planet. 781 00:33:20,220 --> 00:33:21,400 So it might be protected. 782 00:33:21,940 --> 00:33:22,380 But. 783 00:33:23,160 --> 00:33:24,680 If you can find a sequel injection. 784 00:33:24,880 --> 00:33:26,500 That gives you their home planet. 785 00:33:26,620 --> 00:33:27,440 Then that could work too. 786 00:33:27,520 --> 00:33:27,680 Right. 787 00:33:29,340 --> 00:33:30,140 Any other questions? 788 00:33:30,740 --> 00:33:31,520 More questions? 789 00:33:34,020 --> 00:33:34,460 Alright. 790 00:33:35,520 --> 00:33:37,060 How long have you been on this project? 791 00:33:37,360 --> 00:33:37,940 How long? 792 00:33:38,080 --> 00:33:39,720 I've been working on it for about a year and a half. 793 00:33:40,000 --> 00:33:40,960 It's 2300. 794 00:33:41,120 --> 00:33:41,360 Oh sorry. 795 00:33:41,440 --> 00:33:42,440 How long have I been working on it? 796 00:33:43,100 --> 00:33:45,460 2300 lines of sequel code at this point. 797 00:33:47,060 --> 00:33:48,620 Couple hundred lines of Perl. 798 00:33:50,120 --> 00:33:52,440 You can see my git repository history. 799 00:33:52,620 --> 00:33:53,120 Which is like. 800 00:33:53,660 --> 00:33:54,500 Activity down. 801 00:33:54,700 --> 00:33:55,520 Activity down. 802 00:33:59,340 --> 00:34:00,300 It's been a fun pet project. 803 00:34:00,600 --> 00:34:00,960 It actually. 804 00:34:01,760 --> 00:34:03,280 No one knew about it for ages. 805 00:34:03,720 --> 00:34:04,380 And then. 806 00:34:06,500 --> 00:34:08,020 Merlin on PostgreSQL. 807 00:34:08,340 --> 00:34:10,060 On the mailing list. 808 00:34:10,820 --> 00:34:11,500 Found it. 809 00:34:11,740 --> 00:34:13,080 And was like hey this is awesome. 810 00:34:14,340 --> 00:34:16,460 But it wasn't overly tested at that point. 811 00:34:16,540 --> 00:34:17,380 This is last December. 812 00:34:18,200 --> 00:34:19,480 Which is great for testing. 813 00:34:19,620 --> 00:34:21,480 Because people basically just connected it. 814 00:34:21,720 --> 00:34:23,900 Just brutally destroyed it. 815 00:34:24,120 --> 00:34:25,700 Within a couple days. 816 00:34:26,300 --> 00:34:27,160 Which is great. 817 00:34:29,480 --> 00:34:30,300 Reroad everything. 818 00:34:30,900 --> 00:34:32,080 Most things at least. 819 00:34:33,500 --> 00:34:35,560 And now it's in a very more stable. 820 00:34:35,640 --> 00:34:36,820 Actually playable time. 821 00:34:37,000 --> 00:34:38,020 It was basically beforehand. 822 00:34:38,540 --> 00:34:40,380 It was just you've got some chips. 823 00:34:40,500 --> 00:34:41,900 You can go around and blow some things up. 824 00:34:42,180 --> 00:34:44,560 But now there's actually like gameplay to it. 825 00:34:44,880 --> 00:34:46,160 Other interesting things. 826 00:34:46,280 --> 00:34:47,160 If you wanted. 827 00:34:47,420 --> 00:34:49,820 You could actually add a goal in the game. 828 00:34:51,200 --> 00:34:52,480 The trophies table. 829 00:34:52,780 --> 00:34:54,480 Or the trophy table I should say. 830 00:34:54,660 --> 00:34:56,400 Is something you can insert into. 831 00:34:57,060 --> 00:34:58,980 Every trophy that I showed earlier. 832 00:34:59,340 --> 00:35:00,580 You've got space jerk etc. 833 00:35:00,840 --> 00:35:02,320 Space jerk is just the best one. 834 00:35:02,760 --> 00:35:03,640 Pillager is pretty good. 835 00:35:04,600 --> 00:35:05,820 Anyways any of those. 836 00:35:06,160 --> 00:35:07,720 Are just sequel statements again. 837 00:35:07,840 --> 00:35:08,900 Just like the fleet system. 838 00:35:09,600 --> 00:35:11,480 Except these ones have a little bit more control. 839 00:35:11,660 --> 00:35:13,300 Because they can actually go into all the tables. 840 00:35:13,720 --> 00:35:16,160 Your player can only see the views most of the time. 841 00:35:16,500 --> 00:35:19,600 But the trophies can see every table there is. 842 00:35:20,080 --> 00:35:20,440 So. 843 00:35:20,700 --> 00:35:22,200 If you want to make up a trophy. 844 00:35:22,500 --> 00:35:24,280 You can actually add it into the game. 845 00:35:24,860 --> 00:35:26,160 And if I allow it. 846 00:35:27,140 --> 00:35:29,160 Because there's nothing ridiculous in the code. 847 00:35:29,340 --> 00:35:30,800 Then it will become a trophy. 848 00:35:30,900 --> 00:35:32,640 That will get calculated out at the end of the round. 849 00:35:33,140 --> 00:35:33,780 Pretty fun. 850 00:35:34,040 --> 00:35:35,460 There's also items in the game. 851 00:35:36,980 --> 00:35:38,400 I didn't really talk about it. 852 00:35:38,460 --> 00:35:40,080 Because I haven't had time to create any items. 853 00:35:40,600 --> 00:35:42,600 But just like the trophies and the fleets. 854 00:35:42,880 --> 00:35:45,220 It's just sequel code that you throw into a table. 855 00:35:45,500 --> 00:35:46,940 And you're allowed to insert. 856 00:35:47,000 --> 00:35:48,000 Into the items table. 857 00:35:48,740 --> 00:35:50,700 So if you can insert into that table. 858 00:35:51,340 --> 00:35:52,740 Create an item that you want. 859 00:35:53,020 --> 00:35:54,240 I'll see who made it. 860 00:35:54,520 --> 00:35:56,100 I'll see which user created this. 861 00:35:56,480 --> 00:35:58,380 And I might be nice and give you this item. 862 00:35:59,880 --> 00:36:01,960 And then I'm going to scatter them around the universe. 863 00:36:02,100 --> 00:36:02,780 And you can find them. 864 00:36:03,640 --> 00:36:04,600 So the game is. 865 00:36:04,780 --> 00:36:07,040 Can be a little bit more complex. 866 00:36:07,260 --> 00:36:07,860 Or you can. 867 00:36:08,480 --> 00:36:09,080 You know. 868 00:36:09,200 --> 00:36:10,200 Take it how you wish. 869 00:36:11,900 --> 00:36:12,800 Any other questions? 870 00:36:22,460 --> 00:36:23,340 Good question. 871 00:36:23,860 --> 00:36:24,860 The question was. 872 00:36:24,860 --> 00:36:26,720 What happens after the game ends. 873 00:36:28,360 --> 00:36:28,920 Users. 874 00:36:29,200 --> 00:36:29,920 Users stay. 875 00:36:30,060 --> 00:36:30,600 Players stay. 876 00:36:31,080 --> 00:36:32,500 All ships are destroyed. 877 00:36:33,620 --> 00:36:34,700 Planets don't move. 878 00:36:35,760 --> 00:36:37,420 You get a new planet though. 879 00:36:37,920 --> 00:36:39,280 Kind of change things up. 880 00:36:39,600 --> 00:36:41,800 All the fuel is redone on all the planets. 881 00:36:43,100 --> 00:36:45,580 And all the events and everything is destroyed. 882 00:36:45,740 --> 00:36:46,020 Basically. 883 00:36:48,060 --> 00:36:50,900 Originally I wanted to just kind of be an ongoing game. 884 00:36:52,680 --> 00:36:53,240 But. 885 00:36:53,800 --> 00:36:54,840 After playing it once. 886 00:36:54,860 --> 00:36:55,160 For a while. 887 00:36:55,240 --> 00:36:56,080 It didn't really make sense. 888 00:36:56,200 --> 00:36:59,020 Because at some point a new user just can't compete. 889 00:37:00,380 --> 00:37:00,760 So. 890 00:37:13,700 --> 00:37:20,020 That would be kind of interesting in its own way. 891 00:37:20,120 --> 00:37:20,600 The question was. 892 00:37:20,600 --> 00:37:21,180 What happens. 893 00:37:21,760 --> 00:37:23,620 At the end of a game. 894 00:37:23,760 --> 00:37:26,240 When basically planets are re-given out. 895 00:37:26,340 --> 00:37:28,260 But you do lose your original home planet. 896 00:37:28,500 --> 00:37:29,360 Which I didn't specify. 897 00:37:29,760 --> 00:37:30,020 Yeah. 898 00:37:33,140 --> 00:37:33,540 No? 899 00:37:33,880 --> 00:37:34,280 Question? 900 00:37:38,960 --> 00:37:39,360 Alright. 901 00:37:39,480 --> 00:37:39,620 Well. 902 00:37:39,720 --> 00:37:40,440 I guess I'm done early. 903 00:37:40,560 --> 00:37:41,980 But if you do have any further questions. 904 00:37:42,100 --> 00:37:43,760 That you want in a more intimate space. 905 00:37:44,560 --> 00:37:46,320 QA room 4. I believe is my room. 906 00:37:50,600 --> 00:37:52,880 Or if you want to complain about move to me. 907 00:37:52,960 --> 00:37:53,560 That's fine too. 908 00:37:55,040 --> 00:37:56,620 I hope you come to the contest area. 909 00:37:56,700 --> 00:37:57,620 And sign up for the game. 910 00:37:58,220 --> 00:37:59,840 I'd love for this to become successful. 911 00:38:00,200 --> 00:38:01,720 And I'd love to bring it back to DEFCON 20. 912 00:38:01,880 --> 00:38:02,700 I think that would be fantastic. 913 00:38:03,940 --> 00:38:04,260 Anyways. 914 00:38:04,820 --> 00:38:05,460 Thank you for coming.