FAQ  •  Register  •  Login

Coding Club

Forum rules
This forum is for technical discussion only. If you are interested in gameplay or client-side issues, please post in Bitfighter Features.
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Fri Jan 06, 2012 8:21 pm

Coding Club

Tonight we went through Project1 of the Levelgen Tutorial. If you check that thread, the text pretty much sums up everything we talked about.

Homework for this week:
Try swapping out the level code in Project1.levelgen for your own level code. See if you can use code that will make something appear inside the box! If you're having trouble, open up Project1 in the level editor, add an item that isn't already there (like a speed zone or a teleporter), and save the file. Then open Project1.level in a text editor and copy the line that starts with whatever you added (FlagItem, GoalZone, Teleporter, TextItem, SpeedZone, etc).

For BONUS POINTS:
Try using a different variable name. Don't forget that it has to be the same in the "local" line and the "if()" line! Also, try changing the math.random() value to something other than 2. See how different numbers change what happens.

If you do something cool, you're welcome to post it here, in the Map Gallery, or to send me a PM. We can check the levels and levelgens out when we meet again, if you want to. After that, we'll move right on to Project2, and maybe even glance at Project3.
<<

BlackBird

User avatar

Posts: 404

Joined: Wed Jun 15, 2011 7:25 pm

Location: Maryland USA

Post Fri Jan 06, 2012 8:25 pm

Re: Coding Club

Too bad this dosnt count for high school credit. And I can't help but imagin a slot machine when learning this.
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity.
<<

Santiago ZAP

User avatar

Posts: 317

Joined: Sat May 14, 2011 8:05 am

Post Fri Jan 06, 2012 8:30 pm

Re: Coding Club

the viewtopic.php?f=41&t=315 thread was 2 hard 2 me.
is there an easyyy tutorial?
:zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance:
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Fri Jan 06, 2012 8:34 pm

Re: Coding Club

That's why we're meeting in-game with chat. If you show up next time, you won't be super far behind.
<<

Santiago ZAP

User avatar

Posts: 317

Joined: Sat May 14, 2011 8:05 am

Post Fri Jan 06, 2012 9:21 pm

Re: Coding Club

karamazovapy wrote:That's why we're meeting in-game with chat. If you show up next time, you won't be super far behind.

whens the next class?
'Cause i have the uniform on
:zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance: :zapdance:
<<

ZoombeR

Posts: 1036

Joined: Fri Jun 04, 2010 11:56 pm

Post Sat Jan 07, 2012 12:45 am

Re: Coding Club

gotta give props to _k for doing all this and time to do this for them, what a nice guy.

I think a "thanks" should be in order..
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Sat Jan 07, 2012 9:16 am

Re: Coding Club

We still need to pick our next meeting time. I'm gone next friday and saturday, but I can do other nights mid-week.
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Sat Jan 07, 2012 7:38 pm

Re: Coding Club

I have an idea for the group! We could be called the " krazy koding klub"! Or kkk for short. :3
Hee-ho!
<<

BlackBird

User avatar

Posts: 404

Joined: Wed Jun 15, 2011 7:25 pm

Location: Maryland USA

Post Sat Jan 07, 2012 7:46 pm

Re: Coding Club

When I first read that, I thought it was a great idea. Then after a few seconds of remembering certain historical events, it's got to be the worst idea ever.
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity.
<<

Skybax

User avatar

Posts: 1035

Joined: Thu Mar 11, 2010 9:17 am

Location: Washington

Post Sat Jan 07, 2012 11:21 pm

Re: Coding Club

That made me laugh. Props.
raptor wrote:Sorry Skybax, I hijacked your signature so I could post lots of info.
Whittling While wrote:Does this mean I finally get quoted in someone's signature?
watusimoto wrote:Who are the devs around here?!?
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Tue Jan 10, 2012 1:44 pm

Re: Coding Club

I can do tonight, tomorrow night, or thursday night if youins want to meet this week. Otherwise, we have to wait until at least sunday.
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Tue Jan 10, 2012 1:52 pm

Re: Coding Club

Unfortunately, all of those dates are school nights for me. Poop.
Hee-ho!
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Tue Jan 10, 2012 5:50 pm

Re: Coding Club

Actually, I just downloaded Barnacle for my unlimited-data-plan-droid, so we'll see if I'm able to connect to bitfighter over the weekend. My ping might be so bad that I'll just timeout. Maybe I can test it in the next 24-48 hours.
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Wed Jan 11, 2012 2:41 pm

Re: Coding Club

Turns out I actually CAN connect with barnacle and my cell. Only issue is that I've got a 400-500 ping. SO. We can do coding club over the weekend, I just can't play the game...I may time out at some point and have to reconnect, and I should probably limit the time I'm tethered, but I can do it!

Friday or Saturday work for youins?
<<

BlackBird

User avatar

Posts: 404

Joined: Wed Jun 15, 2011 7:25 pm

Location: Maryland USA

Post Wed Jan 11, 2012 2:45 pm

Re: Coding Club

Friday and Saturday should both work...
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity.
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Wed Jan 11, 2012 4:07 pm

Re: Coding Club

What if you just connected over a temporary irc channel? Would that work any better?
Hee-ho!
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Wed Jan 11, 2012 4:24 pm

Re: Coding Club

Meeting in-game is easier.
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Wed Jan 11, 2012 4:30 pm

Re: Coding Club

Ok. ._.
Hee-ho!
<<

FoOtloOse

User avatar

Posts: 75

Joined: Wed May 11, 2011 5:53 pm

Location: P. Sherman 42 Wallaby Way, Sydney

Post Wed Jan 11, 2012 8:50 pm

Re: Coding Club

Which Friday or Saturday?
pengu? pengu!
<<

BlackBird

User avatar

Posts: 404

Joined: Wed Jun 15, 2011 7:25 pm

Location: Maryland USA

Post Wed Jan 11, 2012 8:54 pm

Re: Coding Club

FoOtloOse wrote:Which Friday or Saturday?

Yes.
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity.
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Wed Jan 11, 2012 9:32 pm

Re: Coding Club

Hee-ho!
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Fri Jan 13, 2012 9:59 am

Re: Coding Club

Are we meeting tonight?
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Fri Jan 13, 2012 11:27 am

Re: Coding Club

I guess...
Hee-ho!
<<

BlackBird

User avatar

Posts: 404

Joined: Wed Jun 15, 2011 7:25 pm

Location: Maryland USA

Post Fri Jan 13, 2012 11:27 am

Re: Coding Club

Sure!
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity.
<<

FoOtloOse

User avatar

Posts: 75

Joined: Wed May 11, 2011 5:53 pm

Location: P. Sherman 42 Wallaby Way, Sydney

Post Fri Jan 13, 2012 2:33 pm

Re: Coding Club

Time?
pengu? pengu!
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Fri Jan 13, 2012 2:43 pm

Re: Coding Club

Same as last time? 9-10?
Hee-ho!
<<

BlackBird

User avatar

Posts: 404

Joined: Wed Jun 15, 2011 7:25 pm

Location: Maryland USA

Post Fri Jan 13, 2012 3:02 pm

Re: Coding Club

BlackBird wrote:Sure!
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity.
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Fri Jan 13, 2012 4:03 pm

Re: Coding Club

BlackBird wrote:
BlackBird wrote:Sure!
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Fri Jan 13, 2012 4:06 pm

Re: Coding Club

Little_Apple wrote:I guess...
Hee-ho!
<<

FoOtloOse

User avatar

Posts: 75

Joined: Wed May 11, 2011 5:53 pm

Location: P. Sherman 42 Wallaby Way, Sydney

Post Fri Jan 13, 2012 4:53 pm

Re: Coding Club

karamazovapy wrote:
BlackBird wrote:
BlackBird wrote:Sure!
pengu? pengu!
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Fri Jan 13, 2012 8:42 pm

Re: Coding Club

Another worthwhile class! Tonight was kind of messy between me having to run off my tether and the rush of people who didn't actually want to do class showing up, but we got through it!

Tonight we reviewed variables, math.random, and if/then/else from Project1. For new material, we looked at using more than one variable in a script, choosing higher numbers for math.random, adding more than one line of level code at a time, and using elseif().

For next week, please take a close look at Project2.levelgen and make sure you understand exactly how each piece of the code works! Everything is cumulative. To understand the complicated stuff, you have to understand 100% of the simple stuff we're doing right now.

TOUGH HOMEWORK:
1) Modify Project2.levelgen so that the math.random for ResourceNumber chooses from either 1-5 or 1-6.

2) Copy and paste the elseif(ResourceNumber == 3) block after the initial if(ResourceNumber == 4) test.

3) Change the "3" in the block you pasted so it tests for 5 or 6, depending on the change you made in Step 1.

4) Modify the level code in the levelgen:addLevelLine entries to change the result of math.random choosing 5 or 6, as in Step 3.


Copy/Pasting and Modifying existing code is a big part of programming. Learn what all the individual parts do, and how you can change them to get the code to do what you want! If you can't remember what something does, check the tutorial thread linked in the first post of this topic. Thanks for the work!
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Fri Jan 20, 2012 11:31 am

Re: Coding Club

karamazovapy wrote:Are we meeting tonight?
Hee-ho!
<<

BlackBird

User avatar

Posts: 404

Joined: Wed Jun 15, 2011 7:25 pm

Location: Maryland USA

Post Fri Jan 20, 2012 11:37 am

Re: Coding Club

BlackBird wrote:Sure!
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity.
<<

Lone Wolf

User avatar

Posts: 157

Joined: Fri Mar 18, 2011 7:44 pm

Location: /home/muddy

Post Fri Jan 20, 2012 12:53 pm

Re: Coding Club

Little_Apple wrote:Same as last time? 9-10?



Wait, what time zone?
if you're reading this, i'm sorry for how cringe my old posts are. i rarely play BF anymore, but if you ever want to find me, you can catch me on steam, or on discord @ muddy#7969
<<

BlackBird

User avatar

Posts: 404

Joined: Wed Jun 15, 2011 7:25 pm

Location: Maryland USA

Post Fri Jan 20, 2012 1:00 pm

Re: Coding Club

Eastern time.
You cannot legislate the poor into prosperity by legislating the wealthy out of prosperity.
<<

CleverBot

User avatar

Posts: 560

Joined: Sun Dec 04, 2011 3:37 pm

Location: Orokin Void

Post Fri Jan 20, 2012 1:18 pm

Re: Coding Club

What we talk about in-game during the coding club sessions? Don't you have to visually show code and math...can't do that with a simple text-to-text communication system.

There are 3 basic ways of learning: visually/seeing, orally+reading, and doing/practice. FYI don't need a teaching degree to know that.
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Fri Jan 20, 2012 1:43 pm

Re: Coding Club

We all download a zip file with the different projects and _k guides us through them explaining what each part means. It works surprisingly well.
Hee-ho!
<<

Lone Wolf

User avatar

Posts: 157

Joined: Fri Mar 18, 2011 7:44 pm

Location: /home/muddy

Post Fri Jan 20, 2012 7:55 pm

Re: Coding Club

WHAT THE HELL IS THE PASSWORD?
if you're reading this, i'm sorry for how cringe my old posts are. i rarely play BF anymore, but if you ever want to find me, you can catch me on steam, or on discord @ muddy#7969
<<

Little_Apple

User avatar

Posts: 839

Joined: Sat Jun 11, 2011 12:31 pm

Location: Zanzibar Land

Post Fri Jan 20, 2012 8:22 pm

Re: Coding Club

I didn't even know it!! It was set to keep out the occupy coding club protesters.
Hee-ho!
<<

karamazovapy

Posts: 1567

Joined: Tue Feb 23, 2010 7:52 pm

Post Fri Jan 20, 2012 8:24 pm

Re: Coding Club

Sorry - we password the server once class gets going so people don't join and flood the chat or mess up class.

Anyway, it was another good week. HOMEWORK!

1) Your goal is to create some "mutually exclusive" code and some "independent" code. Copy the code you need from Project3.levelgen and paste it into Project1.levelgen.

2) Decide what either/or type results you want to get and paste the level code into the levelgen where you want it.

3) Decide how often you want your either/or code to come up and adjust both math.random to the correct number and the placement of the code after "then", "elseif", or "else" to get the frequency right (ex. 1 out of 5 versus 4 out of 5).

4) Add another variable/math.random/if-then block of code to create an independent test that has nothing to do with numbers 2 and 3.

5) Make sure your variable names describe what type of code will come up!

From here, coding can get a lot more complicated, but this is the basic idea. You're adding whole sections of code on your own and making them do what you want. Since you know what each individual piece does, just think about it bit by bit and decide what you need to change to get the results you want!

We've got about two weeks until we're through the levelgen tutorial. If you were interested in learning this stuff but missed the first couple classes, we can do the whole thing over again so you can learn too! The one big rule is that you actually have to show up every time and do your best. See you next week!

CHANG.

Return to Technical Discussion

Who is online

Users browsing this forum: No registered users and 2 guests