![]() |
New programming course - Printable Version +- Colobot Forum - International Colobot Community (https://colobot.info/forum) +-- Forum: [Archive] New forum (2015-2019) (https://colobot.info/forum/forumdisplay.php?fid=76) +--- Forum: Colobot: Gold Edition Development (https://colobot.info/forum/forumdisplay.php?fid=62) +---- Forum: Level Design & Story (https://colobot.info/forum/forumdisplay.php?fid=66) +---- Thread: New programming course (/showthread.php?tid=633) |
New programming course - krzys_h - 07-16-2015 Let's start by quoting what @Simbax said yesterday: (07-15-2015, 09:36 PM)Simbax Wrote: Nowadays, Colobot isn't even one of a kind, because there is a lot of (good) programming games much better achieving their goals. Colobot doesn't even have a serious programming language, so there is even no motivation to learn from it. In my opinion, this project is already dead for the supposed target audience. It was already dead in 2001, as it was too hard to learn anything from it without previous at least little knowledge about real Computer Science and nearly everyone beat it without any programming, so it missed its main goal. Because of that, I'd like to start what I've been thinking about for a long time - completly redesigning the programming course in the game. But why is the current one bad? As @Simbax already mentioned, it's really hard to learn from it without previous expirience with programming. I've started planning how we could make it better. The current first exercise level starts with learning 3 instructions without explaining the language syntax and HOW it works. What are those numbers inside the braces? Why does the code have to be started with "extern void object: ![]() Besides, what if somebody doesn't know what programming is? There should be some introduction explaining that. Let's take a look at what I've written. This is just first two chapters, 16 levels. All exercises take place on some new planet. I have no idea how it will look yet. 1. INTRODUCTION 1.1. First steps You land on a planet. The mission starts with a cutscene - WheeledShooter and the astronaut get off the spaceship. The robot goes first. Suddenly, two AlienAnts appear and start attacking the shooter (it has magnifyDamage=0.05 so they don't actually destroy it). The astronaut escapes to the spaceship. At this point, the cutscene ends. Robbie appears and displays message "Press F1 or click on your assistant to read instructions on your SatCom". The player gets some basic informations about what programming is. Then, demonstration time - how programming can be useful? - he is asked to click on the robot and start an already written program that looks something like this: Code: extern void object::KillAnts() 1.2. Your first program Starting cutscene: A WheeledGrabber comes out of SpaceShip and stops 5m from a platform. Task: You have to move your robot 5m forward. Info in SatCom: How to open program editor, basic program skeleton structure (briefly explaining each of these: extern, void, object::, program name, (), {}), what an instruction is, what a parameter is, move() instruction TODO: Is that not too much information at once? 1.3. Moving things Scenery: The robot stands where he ended the last exercise. There is a titanium cube in front of it Task: Move the titanium cube 5m backwards, to the starting position of previous exercise. Info in SatCom: Negative numbers to move(), grab() and drop() 1.4. Turning around Scenery: The robot stands where he finished the last exercise, with a titanium cube in front. Task: The player has to move the titanium cube to the platform on the left and then come back on the starting platform. Info in SatCom: turn(), more than one way to do the same thing: Code: extern void object::Method1() 1.5. The other way Scenery: The robot stands where he finished, there is a titanium cube in front of it. Task: Move the titanium cube to the platform on the right. Info in SatCom: negative numbers to turn() 1.6. Help a friend Scenery: The robots moved to a different place. There is a WheeledShooter with an empty EnergyCell. WheeledGrabber stands behind it with a full EnergyCell on the left. AlienAnts are coming. Task: Replace the energy cell with a full one. The Shooter is already programmed to kill the ants. Info in SatCom: This is meant to be a bit of a challenge to the player to see what he learned, so he gets only very general instructions on what needs to be done. There is also a step-by-step algorithm hidden under a link in case he decides that he needs more help. 2. BASIC INSTRUCTIONS AND LOOPS TODO: The most basic instructions are already covered in the previous chapter. Maybe name this "More basic instructions" or something like that. 2.1. Make some titanium Scenery: There is a Converter 5m in front and TitaniumOre on a platform 10m behind Task: Make some Titanium and bring it back to the platform Info in SatCom: wait(), time needed to make Titanium, move away so that the Converter can work 2.2. Using a radar Scenery: The same as in the previous exercise, except you don't know anything about positions of the objects Task: Do the same as in the previous exercise Info in SatCom: what is a variable, "object" variable type, object categories, radar(), goto(item.position) 2.3. Looping in a loop Scenery: Three TitaniumOres, no platform this time Task: Make 3 titanium cubes Info in SatCom: while(true) {...} (with a quick explanation on what the argument means), space() instruction NOTE: In this exercise, the program crashes when no more TitaniumOre can be found, that's not a problem. Don't try to fix that, it might be too early for a player to understand everything. 2.4. Patience is a virtue, time is money Description: Do not wait too long! Scenery: one TitaniumOre Task: Make Titanium and deliver to the platform, without using wait() Info in SatCom: additional arguments to radar(), null if radar not found, using argument of the while() loop NOTE: If ProhibitedToken from one of the CeeBots still works (I believe it does) we can make sure the player doesn't use wait() 2.5. Under attack! Scenery: AlienAnts attacking from 4 sides Task: Kill them all Info in SatCom: fire() NOTE: No loop here yet 2.6. Don't repeat yourself Scenery: The same Task: The same Info in SatCom: for() loop, explain the counter variable 2.7. There's more! Scenery: AlienAnts attacking from 8 sides Task: Kill them all Info in SatCom: Copy of the program from previous exercise. Show how easy it is to make this program work with 8 ants thanks to using the loop. 2.8. Aiming is important Scenery: AlienAnt on a hill Task: aim() and fire() Info in SatCom: aim(), aiming angle limitation 2.9 Don't shoot me! Scenery: AlienAnts on 3 sides, astronaut on the 4th one Task: for() + fire(), but don't shoot on the 3rd iteration, bacause an astronaut is standing there Info in SatCom: if() instruction, if(i == 2) 2.10. Helping more friends This is basically exercise 1.5 from the current game Scenery: There is 10 WingedShooters without PowerCells programmed to destroy a nest of AlienAnts Info in SatCom: Again, a challenge level. Only general instructions on what needs to be done. As you can see, these exercises are designed to learn programming in small steps. This is basically the same knowledge we currently have in the first chapter (7 levels). I believe this is better than putting a ton of new instructions in one exercise. Also, each chapter ends with an challenge levels that encourage players to think like a programmer. Additional help is still available if he needs it. I'm waiting on any suggestions - do you think doing the programming course in smaller steps is good? Also, I'm waiting on ideas how the planet the exercises take place at could look. RE: New programming course - Simbax - 07-16-2015 I love it! This is exactly how the exercises should look in the first place. I'd gladly help with designing the levels and writing. About the planet, maybe an artificial environment? A space station or something like that. It would be hard to make because of lack of assets, but it's an introduction to programming, thus I think it is logical to put it in a controllable training station. RE: New programming course - tomaszkax86 - 07-16-2015 I like this idea. It's pretty straightforward and fun to play, not to mention it could properly show CBot features. RE: New programming course - RaptorParkowsky - 07-17-2015 I totally agree with that script, but I'm not sure if that really need another planet. For now I would stay with planets that already exists, as the Exercises aren't really canon with the main plot of the game. If there will be really good design for that, then we can change it. (07-16-2015, 11:19 AM)krzys_h Wrote: 1. INTRODUCTIONHow to do that cutscene? Without cutscene refactoring that allows control the cameras in scene or other files that's not possible. A lot of things can be done with CBOT but still there's a lot hardcoded stuff with already existing cutscenes. Good to mention is that the chapter 3 - "Foundamentals" - in already existing programming course was supposed to be first chapter, as the first exercise require to power the Practice Bot before coding. Unfortunately EPSITEC did a big mess with that. For sure Exercises and Challanges will be refactored before the Missions. Not mentioning the Free Game, because that doesn't require so much work. RE: New programming course - krzys_h - 07-17-2015 (07-17-2015, 11:31 AM)RaptorParkowsky Wrote: For now I would stay with planets that already exists, as the Exercises aren't really canon with the main plot of the game.I wouldn't agree. Programming is one of the most important aspects of Colobot, so I'd say this is as important as missions. (07-17-2015, 11:31 AM)RaptorParkowsky Wrote: How to do that cutscene? Without cutscene refactoring that allows control the cameras in scene or other files that's not possible. A lot of things can be done with CBOT but still there's a lot hardcoded stuff with already existing cutscenes.As I remember Ceebot4 there was a lot of commands for controlling the camera, we could probably add them also in Colobot. Also, there is already one camera control command available: Code: object item = radar(BotFactory); RE: New programming course - tomangelo - 07-17-2015 I think that fully programmable cutscenes would be good to implement in future. Custom levels creators would love such feature. RE: New programming course - RaptorParkowsky - 07-17-2015 (07-17-2015, 11:52 AM)krzys_h Wrote: I wouldn't agree. Programming is one of the most important aspects of Colobot, so I'd say this is as important as missions.I don't said that the Exercises aren't important. They are just out from actual plot about "saving the world" in Missions. They are in the same universe, but in different timeline. (07-17-2015, 11:52 AM)krzys_h Wrote: As I remember Ceebot4 there was a lot of commands for controlling the camera, we could probably add them also in Colobot.Well, there was even a invisible robots as the cameras. I think that LevelController should be able to control camera movements, timing, access/non-access to UI when the cutscene is playing, etc. All in CBOT instead of scene files. RE: New programming course - krzys_h - 07-25-2015 I think it makes sense to put it where we have the first Earth tutorial missions, but like 30 years earlier, before the Earth was destroyed. But... this time we'll make the Houston look like it should. Not just 1 building with 2 rooms - a lot more, like 10 or so. Or actually, maybe INSIDE one of the buildings? Here is some more exercises (4 chapters, 31 levels): 3. ADVANCED MOVEMENT 3.1. Clear the points Find all the waypoints WITHOUT using goto() SatCom: accessing the robot as "this", direction(), distance() 3.2. Barrage fire the same as 2.1 in current game, but with TargetBots (more "controlled envrionment") SatCom: asynchronous functions, motor() 3.3. Be careful, slow down! Exercise 4.1 from current game SatCom: show fractions to motor() 3.4. Become a shadow Exercise 4.5 from current game SatCom: Subtract from distance() 3.5. Crazy robot Exercise 4.3 from current game SatCom: combine direction(), distance() with motor() 3.6. Follow a path Follow a path of WayPoints (or flags) SatCom: Mini-challenge. Experment with motor() params to see what is fastest 3.7. Mines You have Mines instead of WayPoints SatCom: Be careful not to hit them! Remember the "Slow down" exercise? 3.8. Fly up, fly down A few waypoint rings in a straight line on different heights, the engine doesn't overheat SatCom: jet(), calculating height difference, slowing down close to target. First set the height, then fly forward. 3.9. Warning, overheating! The engine overheats now SatCom: this.temperature 3.10. There is a better way SatCom: Use motor() and jet() for simultenaous control of two things, this allows to pass all the rings without landing 3.11. Flying challenge Something like MISSION 2.2 SatCom: CHALLENGE! Additional help available. After doing it for the first time, try to improve it so it can pass the whole level without having to cool the engine. 4. READY TO FIGHT? Basically chapter 2 from current game (except for first level). We'll see if we want to add anything. This is 6 levels. These missions will probably happen outside of "controlled envrionment", on some planet, but wthout the astronaut (this is before the first expedition, only robots!) 5. FUNCTIONS 5.1. Basic functions TODO: Find good usage example SatCom: what is a function, why is it useful (shortening code, naming fragments), main program is also a function defined as "extern" 5.2. Accessing robot from within a function TODO: Find good usage example SatCom: object:: notation 5.3. Functions with parameters Exercise 6.2 SatCom: using parameters to dynamically "modify" a function 5.4. Public functions TODO: Find good usage example SatCom: public functions, making "code libraries", what happens if you modify or destroy a program with public function 5.5. Spiral Exercise 6.3 SatCom: CHALLENGE! Use a function with parameter 6. COMMUNICATION 6.1. How to get there? Exercise 3.4 from current game SatCom: recieve(), use of float variables 6.2. Radar is broken, find the path Exercise 3.5, maybe with added WayPoints SatCom: Use two variables (dir + dist) Disabled instructions: radar(), search(), retobject() 6.3. Remote control Exercise 3.9 SatCom: send(), encoding instructions as numbers 6.4. Sending parameters Send parameters as additional info to ExchangePost SatCom: some explanation 6.5. Shorten your code! SatCom: Use a function to shorten your code from previous exercise 6.6. Are you done already? The second robot deletes the info after it finished. Use that instead of constant wait time. SatCom: testinfo() 6.7. TODO: Something with deleteinfo() 6.8. More than numbers Use static class fields to send instructions as strings SatCom: string variable type, classes, static fields 6.9. Houston, we have a problem! Remote control a robot to exchange your PowerCell for a full one SatCom: CHALLENGE! I'm planning at least one more chapter, but we'll see. RE: New programming course - tomangelo - 07-25-2015 Little offtopic; with that Earth levels - this should be introduced in story levels. Instead of searching a backpack in the middle of a desert, there might be walking from building A to building B (movement tutorial, with Robby/Robbie telling us "you can move with WSAD keys"). It's 2015 year today, we don't have to limit amount of objects on the map so much, like they have to in 2001 year. End of offtopic On last chapters there might be some code battles, where you need to destroy enemy bots/base. In first missions you only need to shoot a few bots, that are just coming to your base and shoot at it, but in finish exercise you'll need to write complex algorithm that will build whole base from scratch, defend itself and destroy enemy base. Also in challenges there might be more levels like this, but with increased difficulty. RE: New programming course - RaptorParkowsky - 07-25-2015 (07-25-2015, 03:56 PM)krzys_h Wrote: I think it makes sense to put it where we have the first Earth tutorial missions, but like 30 years earlier, before the Earth was destroyed. That makes a HUGE sense! Especially when there's already in the game some exercises on the Earth, where is the water, nice sky, there's no fog, etc. Some Exercises would be inside the Houston main base, some of them would be outside, but always on Earth, without Aliens (in future we will add Synthetic Aliens or something like that for exercises where TargetBots are not enough and the "tamed" real Aliens would be not very realistic as we never met them before in the main plot of the Missions). RE: New programming course - krzys_h - 07-25-2015 (07-25-2015, 04:42 PM)tomangelo Wrote: Little offtopic; with that Earth levels - this should be introduced in story levels. Instead of searching a backpack in the middle of a desert, there might be walking from building A to building B (movement tutorial, with Robby/Robbie telling us "you can move with WSAD keys"). I think we should separate the exercises and challenges. Something like this is really good for challenges, instead of copying the same code you already wrote in the exercises section... So, basically: Exercises - learn programming from stratch. Test your knowledge in challenge levels at the end of each chapter Challenges - Use your knowledge in practise. DO NOT repeat stuff from exercises. RE: New programming course - tomangelo - 07-25-2015 That's what I mean. In exercises you learn how to create such program (small steps, first you just defend a few bots, last you create whole base), in challenges you need to create a program with knowledge taken from exercises, but it will need to fulfill some additional requirements, so the code might be changed. RE: New programming course - krzys_h - 07-26-2015 Here we go with the promised last chapter: 7. PRODUCTION LINE 7.1. Titanium Convert TitaniumOre from Derrick. Converter and Derrick already built. SatCom: Mini-challenge. Make Titanium and deliver to the platform. DO NOT use wait(), you already know how too do this better. 7.2. But I need a Converter... Derrick, 1 Titanium, no Converter. Deliver 3 Titanium cubes to the flag. SatCom: build() 7.3. Needs more power Derrick, Converter, PowerStation. Make 10 Titanium. SatCom: use PowerStation to recharge, this.energyCell.energyLevel, speed settings 7.4. Making PowerCells Titanium, PowerPlant. Make 3 PowerCells. 7.5. A longer chain Derrick, Converter, PowerPlant. Make 3 PowerCells. 7.6. Could you help me? Program TWO bots. One does TitaniumOre -> Titanium, the other one does Titanium -> PowerCell -> free space near target flag 7.7. Where is my friend? ![]() Titanium, PowerCell, BotFactory SatCom: object.factory(), sending program to second robot 7.8. No buildings again?! Derrick, 1 Titanium. Make 10 shooters with PowerCells. But Shooters are not researched D: THIS IS THE FINAL CHALLENGE OF EXERCISES MODE SatCom: Learn to use the documentation (link to documentation on research system and object.research()) I've noticed we're missing exercises on arrays. Any ideas on a good way to show that? Anything else we're missing? RE: New programming course - tomaszkax86 - 07-26-2015 For arrays I believe recharging power cells on the ground could be fine. First you find them using retobject() and store them in object[], and then you recharge them one by one. This could also show that CBot arrays grow on demand. RE: New programming course - RaptorParkowsky - 08-02-2015 Okay, so how far I think/understand/interpret: - We're going to make Exercises (and probably also the Challenges as well) as in a canon, in official Colobot: Gold Edition plot timeline, somewhere before the main Missions. - There's no other planets than Earth (Nevada or NASA facilities - depends on the exercise). That's official NASA Training Course about using the CBOT programming language and some bots. - There's no Aliens (especially the tamed ones, that they're attacking only the bots). Instead of Aliens, there will be TargetBots and SyntheticAliens (in the future we will add special model for that, for now we can just color AlienAnts on white or the robot's color). - Every chapter of the training course will end the special challenge exercise that combines the material from previous exercises or chapters. - In the exercises there will be some basic storytelling (scripted scenes with examples, Robbie quotes and tips, easter-eggs, some informations about progressive pollution on Earth, maybe even about NASA Space Program plans, etc.). This require some temperance, as we don't need to cover the main reason of playing in the Exercises - learning the basics about CBOT and programming philosophy. - There should be also some code battle exercises for player vs computer, remote controlls and other game modes that we will add in the future. User/player must have any basic idea, how to play in other game modes. Or maybe we can just add a small training course that fits into one chapter in every single game mode that we will add? RE: New programming course - krzys_h - 08-02-2015 I see a small problem. The player doesn't know about existence of aliens before Tropica, so how to explain existence of synthetic aliens a long time before the mission was started? RE: New programming course - Simbax - 08-02-2015 What about the old expedition? Maybe Houston got some brief informations from them after all? RE: New programming course - Emxx52 - 08-02-2015 Quote:as in a canon, in official Colobot: Gold Edition plot timeline, somewhere before the main Missions.I don't really like this idea, exercises were never meant to make sense, and rewriting every single one so as to glue them with the original story would be just pointless. And dumb. There is nothing bad about making them more interesting though, for example by adding some Techs and creating new, more colorful environments. Quote:That's official NASA Training Course about using the CBOT programming language and some bots.Nah... ![]() Quote:Instead of Aliens, there will be TargetBots and SyntheticAliensThat makes... absolutely no sense. Especially considering the fact that you wanted to make exercises 'canon'. And somehow you don't have any objections to the concept of synthetic aliens. RE: New programming course - RaptorParkowsky - 08-02-2015 (08-02-2015, 09:45 PM)krzys_h Wrote: I see a small problem. The player doesn't know about existence of aliens before Tropica, so how to explain existence of synthetic aliens a long time before the mission was started? && (08-02-2015, 10:00 PM)Emxx52 Wrote: That makes... absolutely no sense. Especially considering the fact that you wanted to make exercises 'canon'. And somehow you don't have any objections to the concept of synthetic aliens. NASA are preparing the Astronaut (user/player) for every eventuality in the Space. And, well, SyntheticAliens will be basically a robot, that will be shooting at players robots something similar like AlienAnts orga-balls. And I think that robot model should look like, well, gray dummy alien painted on cardboard and moving on wheels ![]() ![]() Because NASA didn't know that aliens really look like a big, strange, non-humanoid insects... RE: New programming course - tomangelo - 08-02-2015 (08-02-2015, 10:00 PM)Emxx52 Wrote: I don't really like this idea, exercises were never meant to make sense, and rewriting every single one so as to glue them with the original story would be just pointless. And dumb. There is nothing bad about making them more interesting though, for example by adding some Techs and creating new, more colorful environments.But who said that we can't make exercises more meaningful and attractive for new players? Replacing Aliens with TargetBots or shooters will be fine, SyntheticAliens are quite strange. Before mission we don't know about them. But on the other hand, it would be after main story, so it would allow us to build bots and structures, that were discovered in story. Shooters, flying bots and sniffers were discovered in game, it wouldn't make any sense when we have such technology before main story, and completely lose it when we'll start the game. Or we could make some exercises on old Earth, with old technology, and some exercises on Terranova with all this new technology. |