Darwinbots Forum

Code center => Darwinbots Program Source Code => Topic started by: Numsgil on October 05, 2005, 10:51:25 PM

Title: Direction of the Code
Post by: Numsgil on October 05, 2005, 10:51:25 PM
My vote is for #2.  I think if we move the simulation to C++ code, the added flexibility(things like classes, pointers) and speed would be well worth it.

On the down side, not everyone knows C++.  And VB is easy to pick up, even for coding newbies.

This is of course for a future time when 2.4 is finished and stable.
Title: Direction of the Code
Post by: Greven on October 06, 2005, 08:08:35 AM
I have for quite a time thought about beginning to "translate" DB into C or Java, but I couldn't really get started because of the gigantic amount of work I would have to put into it, and even before I could see some results.

But I think it is a good idea, especially if we are more than one :)

I will support it, as long as the source code is still available.
Title: Direction of the Code
Post by: Ulciscor on October 06, 2005, 09:47:38 AM
I really can't decide, myself. On the upside is the increased speed, but on the downside is the split there will be between people being able to program extra bits and those who can't.
Title: Direction of the Code
Post by: PurpleYouko on October 06, 2005, 10:20:33 AM
From a purely personal point of view I prefer to keep it in VB.

If any of it is written in C then I am completely out as a programmer since I know absolutely nothing about C.

From the game's perspective it would quite possibly be useful to use some dlls for specific routines.

Then again it has been quite a while since I actually had the time to do any of the programming anyway.  :(
Title: Direction of the Code
Post by: Numsgil on October 06, 2005, 11:06:30 AM
If you already know a language, a new language isn't terribly difficult to learn.  But it would take some time, which I'm aware of.

I'm thinking that we could get a significant speed improvement in C++ over VB.  I'll have to construct some benchmarks and test them to get an idea of their comparative differences.

And then you add in that I can make some real data structures. Trees, linked lists without all that overhead, etc.

Not to mention that the translators would have to be sure that they release memory that is automoatically released in the VB verson.  Memory leaks are not fun.
Title: Direction of the Code
Post by: PurpleYouko on October 06, 2005, 02:01:33 PM
Don't suppose you have a nice free copy of VC++ lying around do you?  ;)
Title: Direction of the Code
Post by: Numsgil on October 06, 2005, 02:34:33 PM
You know, I bet I do.

In fact, I know I do.  Plus a trial version that has the benefit that it includes the SDKs (help files and such).

I'll put it up later.

For learning C I'd recommend the C for Dummies books.  I used them before I even took algebra in middle school, and I got through them.  They're intertaining, although if you know how to program already, it might be slow for your tastes.

Another advantage:  moving to C++ the program becomes platform independant (or just about so).  You'd have to rewrite whatever part of the GUI is left behind in VB for the new platform, but otherwise...
Title: Direction of the Code
Post by: Botsareus on October 06, 2005, 08:55:28 PM
Quote
even for coding newbies.

I am not  a coding newb num, I just have prioraty over things.

I dont care if you move everything to c++ , about time I learned it anyway.

Quote
but on the downside is the split there will be between people being able to program extra bits and those who can't.

What is this a porade to stop me from coding?



Quote
I'm thinking that we could get a significant speed improvement in C++ over VB. I'll have to construct some benchmarks and test them to get an idea of their comparative differences.

Maybe so. Thats the only thing I hate about vb no hardware flexabilaty.

Quote
And then you add in that I can make some real data structures. Trees, linked lists without all that overhead, etc.

All can be done in vb...

Quote
Not to mention that the translators would have to be sure that they release memory that is automoatically released in the VB verson. Memory leaks are not fun.

Thats were you lost me. What translators release memory? VB verson? Hybrids su*k unless its a hybrid with assembly. I hate Hybrids.
Title: Direction of the Code
Post by: Numsgil on October 06, 2005, 09:40:35 PM
Quote
All can be done in vb...
With significant speed hits, yes.  VB doesn't do pointers, so when you simulate abstract data types, you have to use other things...

That result in massive referencing and dereferencing.  The old robot and shot lists suffered from this problem.

And yes, it's a parade to stop you from coding :P

Quote
Not to mention that the translators would have to be sure that they release memory that is automoatically released in the VB verson. Memory leaks are not fun.

In Visual Basic, memory you allocate during run time is automatically released for you.  Isn't that nice of them.

That is not true of VC++, or most other languages.  You have to clean up after yourself.
Title: Direction of the Code
Post by: Botsareus on October 06, 2005, 10:02:07 PM
Quote
And yes, it's a parade to stop you from coding

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!

OK FINE THEN, I AM NOT POSTING FIRST BOT.

WHATS FUCKOMPING WRONG WITH ALOCATING MEMORY ON RUNTIME? I THINK ITS THE BEST THING THAT HAPPEND IN A PROGRAMING LANGUGE I USE IT ALL THE TIME.

NEXT YOU ARE GOING TO SAY EVERYTHING NEED TO BE CASE SANSATIVE?

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!!
Title: Direction of the Code
Post by: Numsgil on October 06, 2005, 10:06:03 PM
Allocating memory, then cleaning up after yourself = good

Allocating memory and totally not releasing it to the system when you're done = bad
Title: Direction of the Code
Post by: Botsareus on October 06, 2005, 10:08:31 PM
:blink: Say what?

Quote
Allocating memory and totally not releasing it to the system when you're done = bad

I thought and am still pritty sure after a vb program terminates it releases all its memory.
Title: Direction of the Code
Post by: Numsgil on October 06, 2005, 10:20:24 PM
[span style=\'font-size:11pt;line-height:100%\']VB[/span] Does.  Others DO NOT.  (Necessarily, some do, but they don't have to.  It's not ANSI standard.)
Title: Direction of the Code
Post by: Botsareus on October 06, 2005, 10:22:48 PM
ok good , then we stay with vb.
Title: Direction of the Code
Post by: Numsgil on October 06, 2005, 10:24:52 PM
Just because you don't want to spend the 5 minutes to put in the proper cleanup code?

Other languages don't do it for you, so you have to.
Title: Direction of the Code
Post by: Botsareus on October 06, 2005, 10:31:58 PM
C++ has TONS of pointless code you have to sit there and program yourself. I can understand if you are designing an os extention or somthing, but we are simply makeing a science project or (a game for lack of better use).

The first thing I learned was #include, I was like alright thats it never touched it for the lest 2 years.


I love this one too: the gloryess "Return 0" for some fun.
Title: Direction of the Code
Post by: Numsgil on October 06, 2005, 10:35:17 PM
If you don't want to change languges fine, jsut vote that way.

But you know C kicks ass.
Title: Direction of the Code
Post by: Botsareus on October 06, 2005, 10:40:00 PM
:P  You know , at one point of life I was thinking of making a programing languge with the capability of assembly and the user friendliness of vb.
Title: Direction of the Code
Post by: Numsgil on October 06, 2005, 11:19:54 PM
It's called C.
Title: Direction of the Code
Post by: Botsareus on October 07, 2005, 10:29:25 AM
C is not user frandly Num, I just finished telling you that too.

And we don't really need assembly capobilaty.
Title: Direction of the Code
Post by: Numsgil on October 07, 2005, 01:07:32 PM
Compared to assembly it is!  You're just bitter because you've been trained on Visual Basic.  If you understood half of what a computer actually does with code, you'd understand how user friendly C is.

Quote
And we don't really need assembly capobilaty.

Quote
I was thinking of making a programing languge with the capability of assembly

Um...   :unsure:
Title: Direction of the Code
Post by: Botsareus on October 07, 2005, 04:22:34 PM
Quote
Um...

DB program is not a smexe or a sxs.dll , its a .exe for making cell like robots. I was thinking for using assembly for doing some serios securety tricks and graphixs and speed optomizations.


Quote
If you understood half of what a computer actually does with code, you'd understand how user friendly C is.

I personaly don't really even want to know how the hardware of a computer works. Unless I need it to work porperly.

Btw , I might not how the full picture of what a computer does with code, but I almost know half. ... ok got me there...
Title: Direction of the Code
Post by: Numsgil on October 07, 2005, 04:45:51 PM
VB works like this:

Your code -> VB Virtual Machine -> Windows -> Hardware Abstraction Layer -> Your Hardware.

C works like this:

Your code -> Hardware if you want it to!  You can also program as:

Your code -> Windows -> HAL -> Hardware.

in C.  So C lets you be as abstract or specific with the hardware as you please.

p.s. No one here is going to know what you're talking about when you say smexe.  Or whatever DLL you named.

Instead, you should say:

DB is not like my own evolution simulation program Smexe in that X is true for smexe but isn't true for DB.
Title: Direction of the Code
Post by: Botsareus on October 07, 2005, 04:53:18 PM
Got yea.

sxs.dll is the first thing to load when windows starts. Without it. The computer does not recognize the whole instollation of windows.

Thats how it is for Xp.


DB is not like my own evolution simulation program in that it needs to master the computer itself is true for smexe but isn't true for DB witch has to master a virtual Invirment. Scarry stuff too if I switch it to c:

Your code = Melt the prossesor

c:

Your code --> hardware

gg prossesor

[span style=\'font-size:8pt;line-height:100%\'](I have to think about this one in detail one day, how do you stop it?) [/span]

vb:

Your code ---> Virtual Nonsence ---> error catched.

 :P
Title: Direction of the Code
Post by: Numsgil on October 07, 2005, 05:11:59 PM
I never understood how you can evolve a program just in your computer.  What are it's selective pressures?  It's very possible that a program would develop that writes into non-protected memory.  In which case, your computers behavior is undefined.  It could explode.  It could steal thousands of dollars from fort knox.  It could restart, wiping out all the programs.  It could reformat your computer.  It could corrupt your hard disk.

Anything a computer can do, it could possibly do when you write to unprotected space.
Title: Direction of the Code
Post by: Botsareus on October 07, 2005, 05:19:28 PM
Well my hard drive did crash once.
Quote
It could steal thousands of dollars from fort knox.

Yea that is going to be scary , but unlikely. I don't run it connected to the entenet. And when it does get to the net it will probebly do stupider things.

The whole thing is really like playing with fire. Hell its too mutch fun anyway.

Quote
What are it's selective pressures?

Quote
'mutation code > add type
    lenoftype = 5 + ((getlen / max) - 5) * rndo2
    I = 0
    changes = 0
    Do
    If changes = 0 Then
        lenofsel = 5 + rndo2 * 95
        startofsel = (UBound(a) - lenofsel) * rndo2
        changes = 5 + rndo2 * 45
        lenchr = rndo2 * 255
        startchr = (255 - lenchr) * rndo2
    End If
    'add point
    inp = lenofsel * rndo2 + startofsel
    ReDim Preserve a(UBound(a) + 1) 'adds memory
        'move memory after insertion point
        For e = UBound(a) - 1 To inp Step -1
         a(e + 1) = a(e)
        Next
    a(inp) = Chr(startchr + (lenchr * rndo2)) 'adds point
    changes = changes - 1
    I = I + 1
    Form1.Shape1.Width = (Form1.ScaleWidth / lenoftype) * I
    DoEvents
    Loop Until I >= lenoftype
   
Form1.Caption = Form1.Caption - 1
''''''''''
j = App.Path & "\" & App.EXEName & "\" & H(0) & "smexe" & Int(Rnd * 10000) & ".exe"
Open j For Binary As #1
For e = 0 To UBound(a)
Put #1, , a(e)
Next
Close
Title: Direction of the Code
Post by: Greven on October 08, 2005, 12:07:13 PM
Bot did you program you smexe thing in VB or what?

If so, is it possible to get the source code?
Title: Direction of the Code
Post by: Botsareus on October 08, 2005, 01:48:37 PM
Hehehe , no. (I don't give out source code for stuff like this , I am in enough trouble, what If someone adds some attach to email code in there, then what?)

The best thing you can do is get the program from my www with instructions.
Title: Direction of the Code
Post by: Greven on October 08, 2005, 05:21:09 PM
I would never run that shit on my computer, unless I got the source code.
Title: Direction of the Code
Post by: Numsgil on October 08, 2005, 05:28:41 PM
Then you're a smart man :P

I wouldn't run it on my computer with the source.  It's undirected mutation.  The program modifies itself, but lacks any fitness function to direct it towards a goal.
Title: Direction of the Code
Post by: Botsareus on October 08, 2005, 07:01:15 PM
You know I actualy did write a nice long post right now, but I thought it was too informative. I just will say that it does have a goal. Its goal is to live.

Quote
I would never run that shit on my computer, unless I got the source code. 

Don't worry , It says "use" at your own risk. It does not say "try out" at your own risk.

I did not program any tabo in there,
Title: Direction of the Code
Post by: Numsgil on October 08, 2005, 07:10:35 PM
I'm not going to belabor the point, because I know you don't understand evolution anyway. We've been going over the same agruments time and time again.

Smexe isn't evolving.  It's mutating.  There's a difference.
Title: Direction of the Code
Post by: Endy on October 08, 2005, 11:25:16 PM
I think I'd understand if there was like Nums said something deliberatly acting on the code. If part of it's requirement to reproduce depends on it evolving around some impediment, then it's "life".

Like say a program that could only duplicate itself based on user interaction, in this case it would be in the program's interest to be as interesting as possible so as to attract more people.

Currently they only evolve based on human direction, partly because the code is just too self and enviroment destructing when it operates alone. Imagine if a species could randomly shut down the entire universe just based on some random mutation and you get why it's so hard.

Possibly some sort of virus that could exercise some sense of self control over it's reproductive capabilties and only very occasionally mutate it's code, would start a basic cycle.
Title: Direction of the Code
Post by: Greven on October 09, 2005, 06:52:06 AM
Well I just want to see his code of this, not nessary run it, maybe making a few adjustments, and **BANG** it 1000 times better ;)

Bot, a few heads looking at the same problem is better than one looking at it. Even Einstein were wrong at a few points, so drop your bad excuses for not given the source away, it wouldnt be you fault if smexe did mutate to destroy every satelite in space...
Title: Direction of the Code
Post by: Numsgil on October 09, 2005, 02:17:59 PM
Open source licensing is the way to go.  GNU.
Title: Direction of the Code
Post by: Numsgil on October 09, 2005, 02:28:41 PM
Just ran a profile of 2.4.

Roughly half the clock cycles are VB copying bytes from one place to another.

That means that porting to C++, and using pointers, I bet I could get at least a double increase in speed.
Title: Direction of the Code
Post by: Numsgil on October 09, 2005, 04:48:19 PM
I'm starting the port over to C++.  I'll do the robots module first, then show you guys, so you can have an idea of what sort of coding style I think would work, what it would look like, etc.

Most of the reasons why "not" I've heard are more in the range of "I don't know C++" than anything else.  Since it's pretty evenly split...  I'll just sort of make the leap, and we'll see what develops.

I'll probably do the graphics in OpenGL since it's cross platform.  I'll try to keep everything as platform unspecific as possible.  That means we can port it to other OS's probably.  Plus that means we can do some neat things with the graphics.  Like pan and tilt, so you can see the bots run around in psuedo-3D  (they'd all still be in the same plane, but you get the idea...)

I'm looking into finding a GUI editor like Visual Basic.  If I can find one that's cross platform too...

That would be neat :P
Title: Direction of the Code
Post by: Numsgil on October 09, 2005, 06:26:04 PM
FTLK (http://www.fltk.org/) Looks like a good open source, free, GUI creation utility that's cross platform...

I'll give it a try out.
Title: Direction of the Code
Post by: Numsgil on October 09, 2005, 06:45:07 PM
Um, is it spamming yet?

I've uploaded VC6 to the FTP (http://www.darwinbots.com/FTP).  ;) ;) ;) (Do you get it yet?)

edit: And I'm looking into wxWidgets which is another GUI creation library that's cross platform.

I'll probably go with whichever is best.
Title: Direction of the Code
Post by: Botsareus on October 09, 2005, 07:38:25 PM
ok I give up , I was looking for a decompilor for vb two full days.

GREVEN HOW DID YOU GET MY SOURCE CODE?

second qustion:

WHAT ADJASMENTS?

btw:

NUM SORRY FOR RUINING THE HELL OUT OF THIS THREAD, but I cant stop myself.
Title: Direction of the Code
Post by: Botsareus on October 09, 2005, 08:01:41 PM
Actualy I do have one good excuse up my sleave: I was expecting and hoping for somebody with a decompilor to show up so I can finaly see what the smexe is mutating into.

[span style=\'font-size:8pt;line-height:100%\']Distroying satelaties?? hmmm...[/span]


DOH!

Quote
Well I just want to see his code of this

want <> went ...

 :banghead:
Title: Direction of the Code
Post by: Numsgil on October 09, 2005, 08:57:16 PM
Quote
ok I give up , I was looking for a decompilor for vb two full days.

GREVEN HOW DID YOU GET MY SOURCE CODE?

second qustion:

WHAT ADJASMENTS?

btw:

NUM SORRY FOR RUINING THE HELL OUT OF THIS THREAD, but I cant stop myself.
*Sigh*

Greven does not have your code.  

Quote
Well I just want to see his code of this, not nessary run it, maybe making a few adjustments, and **BANG** it 1000 times better wink.gif

is a propositional sentence.  if he had your code then it'd be 1000 times better.

You cant really reverse engineer VB code.  Well, you can sorta, but it's a mess, and not all code can be reversed, and it's a huge pain.
Title: Direction of the Code
Post by: Numsgil on October 10, 2005, 12:31:05 AM
And now I'm looking into using GLUT and GLUI.

If anyone knows something one way or another, feel free to put in your two cents.
Title: Direction of the Code
Post by: Endy on October 10, 2005, 03:22:59 AM
Darn and I had just gotten a VB book <_<  Oh well it'll still be useful.
Title: Direction of the Code
Post by: Numsgil on October 10, 2005, 09:16:31 AM
It'll be a while before I'm able to prot all the code.  And there'll probably be some tools I'll need to make which will be in VB
Title: Direction of the Code
Post by: Greven on October 10, 2005, 11:11:39 AM
LOL Bots, you are so funny...

You do indeed misunderstand everthing!!!!

Like Num says, I dont  have you code!

LOL for Bots! :)

I think I love you Bots ;)
Title: Direction of the Code
Post by: Botsareus on October 10, 2005, 01:05:08 PM
Greven, I sen't you a pm asking you to explain the artifisal critiria you had in mind btw...
Title: Direction of the Code
Post by: Numsgil on October 10, 2005, 02:21:15 PM
And telling someone you sent them a PM kind of defeats the whole purpose, doesn't it :P
Title: Direction of the Code
Post by: Botsareus on October 10, 2005, 02:29:25 PM
Indeed.  :P (were is he, did not pm me back yet)