Darwinbots Forum

General => Off Topic => Topic started by: Numsgil on March 03, 2015, 03:11:24 PM

Title: Personal news
Post by: Numsgil on March 03, 2015, 03:11:24 PM
Hey everyone, if you've been curious what I've been up to the last 6 months, I've changed jobs and now work for Google as a programmer, as of last week.

I've been busy and stressed from the whole process (in a good way), and haven't really worked on anything code related for DB3 in that time.  I'll probably miss my Sept 2015 goal for DB3 by a fair number of months.  I'm trying to get back in to a rhythm with it, but I don't know when that will happen exactly.  Also going forward, I think any contributions I make code-wise will technically be owned by Google, and they'll just license it to the Darwinbots project under the MIT license.  I still need to wrangle with Google legal around that point, but Google has well established channels for this sort of thing, so I don't anticipate any issues.  Part of that means I probably can't contribute to DB2 source code at all, since it's licensed under Carlo's license.  But not like I was doing that anyway :P

On the plus side, I get a small amount of cash to use for advertising anything I want on AdWords as a company perk.  So I might start advertising for Darwinbots for search queries around artificial life and programming games and the like.  If people would like to submit ideas for what keywords it would make sense to advertise against I'm all ears.

Otherwise I don't think it will really affect anything.  Just FYI for what's going on, as I've been running kinda dark the last few months.
Title: Re: Personal news
Post by: spike43884 on March 04, 2015, 01:05:53 PM
Keywords to advertise against:
Artificial Life, Simulation, Darwin, Evolution, Cellular Life, Free


Also, could you find SOMEONE NEW TO MANAGE THE LEAGUES! ._. Im sick of waiting for botsareus, he's not coming back, we need someone to replace him!
About DB2 being covered by carlo's license...Surely just have a joint licensing (if you can ask carlo about that) stating any new source code done by you while you work at google is licensed by google (or MIT or whatever) then the code written outside is licensed by carlo?
Title: Re: Personal news
Post by: Numsgil on March 06, 2015, 12:38:52 PM
Also, could you find SOMEONE NEW TO MANAGE THE LEAGUES!

Are you volunteering?

Quote
About DB2 being covered by carlo's license...Surely just have a joint licensing (if you can ask carlo about that) stating any new source code done by you while you work at google is licensed by google (or MIT or whatever) then the code written outside is licensed by carlo?

Well for one I'd rather choke myself with a used diaper than touch VB6 code ever again.  But that aside, I'd need to get everyone who's ever pushed code to DB2 to agree to license it under MIT or Apache or GPL or something like that, as everyone who's worked on the code has licensed it under Carlo's original license.  I'm not sure I could even reach PY or Eric, so I think it's practically a non starter.  But again, my complete and absolute hatred of the current DB2 codebase makes this sort of moot anyway.

DB3 is licensed under MIT, and even if it weren't I retain copyright on 99% of contributions so I could relicense most of the code under a different license if I had to.  But MIT is about as unrestrictive as it gets while still being a realistic license (the wtfpl is arguably more liberal, but good luck getting a lawyer to pass off on it), so no need.
Title: Re: Personal news
Post by: Peter on March 06, 2015, 01:46:52 PM
Good luck at google!

Does it mean you can spend 20% of your time on your own projects?
Title: Re: Personal news
Post by: Numsgil on March 06, 2015, 05:07:25 PM
Good luck at google!

Thanks!

Quote
Does it mean you can spend 20% of your time on your own projects?

Yes and no.  I'm not sure how much I'm allowed to say about it, but I'll say work has to be approved by Google and be important to Google in some way.  Darwinbots doesn't really count.  But open source projects in principle aren't off the table (Chrome and Android are obvious examples of how Google feels about open source).
Title: Re: Personal news
Post by: spike43884 on March 07, 2015, 08:34:38 AM
Are you volunteering?
I would but my computer is way to weak to run a league...And thats not even including all of the bots, thats just a small pick of them that it struggles on...
Could Peter run it maybe?
Title: Re: Personal news
Post by: Shadowgod2 on March 07, 2015, 10:16:51 AM
i will
Title: Re: Personal news
Post by: Numsgil on March 07, 2015, 03:02:51 PM
I don't really remember the details for it, but I think you can search the forums for instructions on how to do it.  eg: running the leagues (http://forum.darwinbots.com/index.php/topic,1418.msg1367469.html#msg1367469).
Title: Re: Personal news
Post by: spike43884 on March 08, 2015, 08:55:52 AM
i will
I don't really remember the details for it, but I think you can search the forums for instructions on how to do it.  eg: running the leagues (http://forum.darwinbots.com/index.php/topic,1418.msg1367469.html#msg1367469).

Well, thats sorted that, just remember to give shadow permissions to manage the starting gate etc.
Title: Re: Personal news
Post by: Peter on March 19, 2015, 06:56:31 PM
I don't really remember the details for it, but I think you can search the forums for instructions on how to do it.  eg: running the leagues (http://forum.darwinbots.com/index.php/topic,1418.msg1367469.html#msg1367469).
Bots changed the leagues quite a bit. I don't think that link is up to date.
For anyone planning to run the league, the last leagues bots posted are run with all bots in a tournament setting. (meaning if 1st and 2nd strongest bot fight in round one, 2nd strongest bot doesn't show up in the top bots) For a proper leaguetable it'll need to rerun with a stepladder. Be warned that may take time, if you're going to run it with all bots. (may take the last leaguetable before bots implemented tournament as a starting point)

Seems Google is looking for people. I just got an email from a google recruiter. Pity they don't have any office remotely close.
Title: Re: Personal news
Post by: spike43884 on March 20, 2015, 12:36:27 PM
I don't really remember the details for it, but I think you can search the forums for instructions on how to do it.  eg: running the leagues (http://forum.darwinbots.com/index.php/topic,1418.msg1367469.html#msg1367469).
Bots changed the leagues quite a bit. I don't think that link is up to date.
For anyone planning to run the league, the last leagues bots posted are run with all bots in a tournament setting. (meaning if 1st and 2nd strongest bot fight in round one, 2nd strongest bot doesn't show up in the top bots) For a proper leaguetable it'll need to rerun with a stepladder. Be warned that may take time, if you're going to run it with all bots. (may take the last leaguetable before bots implemented tournament as a starting point)

Seems Google is looking for people. I just got an email from a google recruiter. Pity they don't have any office remotely close.
Well, maybe just point these points to shadow as he's the league guy now? Yeah, stepladder will take time peter, I mean...Look at the starting gate of the bots that clogged up from botsareus's absence.
Title: Re: Personal news
Post by: Shadowgod2 on March 21, 2015, 12:25:09 AM
yea things have slowed down because i've gotten ill though not seriously. just enough to effect me mentally so at night i just don't have the mental capacity to do much. so far i only have 2 bots but i plan on having a page done a night before i start the leagues starting fully next week. at least i didn't get the brunt of the cold like my parents.
Title: Re: Personal news
Post by: spike43884 on March 21, 2015, 07:06:57 AM
What if we opened up a download for a leagues round runner, of course you couldn't do it nums, but peter could. Then just make it automatically go onto the next stepladder/round recording it in a text document?
Then the leagues could be ran without even someone there, just someone to initiate it, and record it.
Title: Re: Personal news
Post by: Botsareus on April 08, 2015, 03:21:05 PM
Peter, you are forgetting about league seeding. The first and second place bots will never run in the first round. Although if I to do it over would have made it based on energy and not population.

I think the best solution is to have a submit button that goes server side and updates a step ladder. Numsgil at one point was considering something like that with a web crawler.
Title: Re: Personal news
Post by: Numsgil on April 08, 2015, 03:24:57 PM
Numsgil at one point was considering something like that with a web crawler.

I didn't get very far on it but being able to automatically run the leagues on the server as things get submitted is definitely preferable to the current hit-or-miss manual methods.
Title: Re: Personal news
Post by: Botsareus on April 08, 2015, 03:36:46 PM
Btw: Grats on the new job.
Title: Re: Personal news
Post by: spike43884 on April 09, 2015, 10:10:03 AM
Mhm, have a ticket submission where you submit ONLY the code, it runs it in a simulation in some far away computer, or the cloud? Then via a link you can search bots and find the positions of them and the bots above/below them? It'd thus include every bot efficiently as well?
Title: Re: Personal news
Post by: Numsgil on April 09, 2015, 01:19:18 PM
Mhm, have a ticket submission where you submit ONLY the code, it runs it in a simulation in some far away computer, or the cloud? Then via a link you can search bots and find the positions of them and the bots above/below them? It'd thus include every bot efficiently as well?

My thinking was that a web crawler/spider could go through all the bots in the bestiary.  So you'd only need to submit a bot to the bestiary and it'd get run somewhere.  That's mildly hard thing #1, as I don't have any experience with crawlers/spiders, and extracting out the code for bots is not as easy as it could be because there's no common template followed.

Running the leagues could happen in theory on the web server, but we'd need to be very careful to throttle the CPU so it doesn't make the site less responsive.  It's thankfully not IO bound so the only resource we'd really have to throttle is CPU, and that could work with a process priority flag I think.  But DB2 isn't set up to be run from the command line and certainly not from a linux box natively.  That's mildly hard thing #2.

Then you'd want to post the results to a webpage and keep it updated.  The page isn't hard but extracting out the info from DB2 might be, depending on how much of the league text files still get used.  So mildly hard thing #3.
Title: Re: Personal news
Post by: spike43884 on April 09, 2015, 03:47:12 PM
Mhm, have a ticket submission where you submit ONLY the code, it runs it in a simulation in some far away computer, or the cloud? Then via a link you can search bots and find the positions of them and the bots above/below them? It'd thus include every bot efficiently as well?

My thinking was that a web crawler/spider could go through all the bots in the bestiary.  So you'd only need to submit a bot to the bestiary and it'd get run somewhere.  That's mildly hard thing #1, as I don't have any experience with crawlers/spiders, and extracting out the code for bots is not as easy as it could be because there's no common template followed.

Running the leagues could happen in theory on the web server, but we'd need to be very careful to throttle the CPU so it doesn't make the site less responsive.  It's thankfully not IO bound so the only resource we'd really have to throttle is CPU, and that could work with a process priority flag I think.  But DB2 isn't set up to be run from the command line and certainly not from a linux box natively.  That's mildly hard thing #2.

Then you'd want to post the results to a webpage and keep it updated.  The page isn't hard but extracting out the info from DB2 might be, depending on how much of the league text files still get used.  So mildly hard thing #3.

My point of ticket submissions is just to solve the no common template, beastiary can stay to share bots to other users...Possibly an access through the league results to, as [SOME] people like to explain their bots more for other people...Just reserve some CPU usage for the website, or as leagues run in background just give it priority so check how much the website will demand to function smoothly(ish) then leave the rest over to the leagues?
Extracting info from leagues...Have a webpage with a table, column 1 is bot name, column 2 is creator, column 3 date submitted, column 4 a link to the code of it, column 5 the score it got (maybe Nrg of all the bots of that species added together then divided by population? then it doesn't favour cancerous bots like the current leagues do)

Title: Re: Personal news
Post by: Botsareus on March 30, 2016, 04:45:19 PM
Numsgil:

Quote
But again, my complete and absolute hatred of the current DB2 codebase makes this sort of moot anyway.

Why do you hate the current code so much? I hope it is not all my fault.
Although I can see why you might think my attempt at a port will fail because you hate the current code anyway.
Still, I would like to get some pointers from you on this when you have a chance.

P.S.
I feel like with all that went down here over the years we lost respect for one another and what put us together in the first place. We love to program systems that emulate biology. Unfortunately this is not as fun as it first seems as proven by PY and Eric leaving and no way to contact them. I did try to contact Eric on a couple occasions to help me out with IM with no luck.
Title: Re: Personal news
Post by: Botsareus on March 30, 2016, 07:16:43 PM
[Bump]
Title: Re: Personal news
Post by: Peter on March 31, 2016, 03:59:19 AM
Numsgil:

Quote
But again, my complete and absolute hatred of the current DB2 codebase makes this sort of moot anyway.

Why do you hate the current code so much? I hope it is not all my fault.
Although I can see why you might think my attempt at a port will fail because you hate the current code anyway.
Still, I would like to get some pointers from you on this when you have a chance.
I suspect it has to do with VB6 and the capabilities of it. It's not as flexible and powerful as modern languages. Sadly it isn't easy to recreate everything in a new language, a lot has already been build in DB2.
Title: Re: Personal news
Post by: Botsareus on March 31, 2016, 10:15:33 AM
Oh ok, now I know the meaning of the word code base. I thought he meant the actual code. I guess my programming is better than I thought. :P
Title: Re: Personal news
Post by: Numsgil on March 31, 2016, 01:34:33 PM
It's a combination of the language and the code base itself.  Basically, error handling in VB6 is terrible, and there's all sorts of weird performance overhead on things.  It's also impossible to merge changes to forms created by the form creator, which is an important thing for a collaborative open source project.  Everything it was meant to be, VB.NET does better.

The code base itself is sloppy spaghetti tied together with duct tape and hope.  None of it is tested, so if you make one change, even seemingly innocuous, it might (and probably will) break everything.  We could fix that by adding tests, but there's no good testing framework for VB6, and even if there were, just changing the code enough to make it testable would probably break things.  There are global variables all over the place that manage the simulation state, and of course all sorts of random things will poke and prod at this state from everywhere and anywhere in the code.

The few times I've tried to do anything in the codebase have always been 10000% harder than they should be.  It's a classic example of a codebase that grew larger than it was architected to grow.

That's why I hate it.
Title: Re: Personal news
Post by: Botsareus on March 31, 2016, 02:12:41 PM
Agree about the spaghetti. It got reasonably bad in a couple of places. Getting rid of the goto will help. Some though I looked at but did not really figure out. One particular that drives me crazy is how the flow command logic is executed. It is a mess and it does not even let you do a start and an else block in one gene. I will have to revisit this at some point when I actually figure out how to fix it.

One other thing that people complain about alot that I need professional opinion on is the global variables. I admit I am guilty of using them often. But my question is in ideal conditions what do I replace them with? I made them public so they save state outside the scope of a subroutine. I could have gone with static but than I would not be able to capture there state for the save simulation code.

Edit: A little follow up question: I think the code (although messy in a few places) is tied together reasonably well. I assume you mean there are better ways to tie code together in a more object driven language. Still more detail on this will be good. Edit: Actually answered this question myself by looking on the DB3 Core module that was just released. However, DB2 was never built object oriented, and refactoring it in a major way like this will probably break most of it. :/
Title: Re: Personal news
Post by: Botsareus on March 31, 2016, 03:04:52 PM
Is there anything that could be done with the global variables in DB2 other than changing most of the architecture?
Title: Re: Personal news
Post by: Panda on March 31, 2016, 04:05:59 PM
Is there anything that could be done with the global variables in DB2 other than changing most of the architecture?
Not without tests, really!
Title: Re: Personal news
Post by: Peter on March 31, 2016, 04:36:28 PM
(http://image.slidesharecdn.com/2013-legacy-code-131002164122-phpapp02/95/working-with-legacy-code-6-638.jpg?cb=1380732144)
Title: Re: Personal news
Post by: Botsareus on March 31, 2016, 05:01:08 PM
I get tests.
What I am really asking is mechanics of stuff like this.
The only experience with fully object oriented programming I had was an old XNA book which I never finished reading because I found "Black Art of 3D game programming" to be a far more interesting read. And than XNA got replaced with Unity.
Title: Re: Personal news
Post by: Panda on March 31, 2016, 05:59:57 PM
One way to do it, and probably the most like a conventional global variable, would be to use the Singleton pattern. https://en.wikipedia.org/wiki/Singleton_pattern This is NOT my favourite way to do it.

Another way of doing it would be "giving" each part of the program that needs what was a global variable or a set of them, an instance of a holder for it. i.e.
Code: [Select]
class PreviouslyGlobal {
  private int variable1;
  private int variable2;
  ...
}

class Component1 {
   private PreviouslyGlobal vars;
   
   public Component1(PreviouslyGlobal vars) {
       this.vars = vars;
   }
}

class Component2 {
   private PreviouslyGlobal vars;
   
   public Component2(PreviouslyGlobal vars) {
       this.vars = vars;
   }
}

class Driver {
   void main() {
       PreviouslyGlobal sharedVars = new PreviouslyGlobal();
       Component1 c1 = new Component1(sharedVars);
       Component2 c2 = new Component2(sharedVars);
   }
}


I'm not exactly sure how these would be implemented in VB6.

These are both certain ways of doing it, although not the way of doing it.
Title: Re: Personal news
Post by: Botsareus on March 31, 2016, 06:21:15 PM
The second way vb6 does support classes but I never played with them and DB2 currently uses structures. But I will consider doing that for DB3. Still need to know architecture support for stuff like that. I just realized I can get away with no static variables if I do it this way because the main code or some class somewhere can hold a copy of them and I just fetch them as needed.

Method1 I never knew about actually. Should be a good read.

Thanks for your help Panda!
Title: Re: Personal news
Post by: Botsareus on March 31, 2016, 07:24:12 PM
Actually, I think it will be fun to make DB2 code nice looking one day. And should teach me alot.  :) However, I am not ready for that yet.
Title: Re: Personal news
Post by: Panda on April 01, 2016, 06:08:54 AM
It would still be possible with structures, just the code organisation would be different, i.e. with constructor methods instead of actual constructors. I don't know how VB6 classes work so I can't really comment on them.
Title: Re: Personal news
Post by: Numsgil on April 01, 2016, 02:56:55 PM
One other thing that people complain about alot that I need professional opinion on is the global variables. I admit I am guilty of using them often. But my question is in ideal conditions what do I replace them with? I made them public so they save state outside the scope of a subroutine. I could have gone with static but than I would not be able to capture there state for the save simulation code.

A strongly enforced MVC (https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) distinction would help.  Basically have the simulation state in an isolated bubble, and force communication to/from the simulation to go through specific channels, or at least specific places in code.  The problem with globals is that you can't easily isolate what the side effects of a function are, which makes it difficult to test, and therefore difficult to modify.  Rule one for responsible software engineering: clearly define what the inputs and outputs to a function are.  If the input is the entire simulation, and the output is a slightly modified simulation, how can you ensure code correctness other than eyeballing it?  Instead of passing in the entire simulation as globals, if you passed in just the info for robot X, that would be a step in the right direction.  The narrower the input/output to a function, the easier it is to be sure it's working right and has minimal unintended side effects.

I will say this for the DB2 codebase: the overarching program flow is at least easy to understand.  It's very easy to look at the code and figure out where some feature you'd want to add should go.  But that does no good if you can't be sure you're not breaking something.  Even simply refactors run the very real risk of breaking some feature or other, and we don't have good ways to know that something's broken.  Even in a traditional video game, you can find bugs just by playing.  With DB, if something is broken it just means that there might be some robots somewhere that don't work quite right.  That's hard to catch.

Quote
Edit: A little follow up question: I think the code (although messy in a few places) is tied together reasonably well. I assume you mean there are better ways to tie code together in a more object driven language. Still more detail on this will be good. Edit: Actually answered this question myself by looking on the DB3 Core module that was just released. However, DB2 was never built object oriented, and refactoring it in a major way like this will probably break most of it. :/

Wouldn't have to be OO, though that's certainly the most common approach.  It's more a matter of clearly separating code responsibilities, and you can do that in any language, VB6 included (I don't think VB6 forces you to write bad code).  One part of code to manage DNA, one part of code to manage metabolic things like nrg and body and venom building, one part to draw things, etc. and making sure that the parts only communicate when they have to and through specific places in code.  The problem with the code right now is that each part talks with each other part, often in strange places in code.  Especially stuff around how the UI reads/writes data.  Like, I wouldn't be surprised if there's some code in the DNA execution that updates a UI widget somewhere.  That's convenient, easy, and wrong.  Instead, you'd want the DNA to store relevant info in some debug data attached to the robot instance, and the UI widget to read from that debug data during some sort of "push sim data to the UI" method.  Then you can test the creation of the debug data separately from the updating of the UI widget.  It's not nearly as easy, and it's all sorts of extra hoops to jump through to get a new feature in, but it means you can test both halves in isolation.
Title: Re: Personal news
Post by: Botsareus on April 01, 2016, 03:37:02 PM
Thanks Numsgil.

Some of it seems tricky, but it definitely got me thinking.