Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Mutating Programs

This thread is locked; no one can reply to it. rss feed Print
Mutating Programs
CGamesPlay
Member #2,559
July 2002
avatar

I can't believe you guys are running those. I hope at least you have everything backed up. I mean, even if they don't kill your whole HD, they might just casually overwrite a few files or something...

BUt, if you want to continue to be reckless:

You guys are only modifying the data section. You can't touch the code. When it changed the path, it was changing something in the data section. If you want to do really kewl and stupid (as in dangerous) stuff, look up the header of PE executables, and set the flag to make the code section writeable. That way you really change what the program is doing. Whenever you got pointer errors (access violations), it was probably because the code was trying to write to it's own code section and couldn't. You might have wanted to code these in ASM also, much less bloat.

Or wait, you were changing the file on disk, not in memeory, weren't you? Ok, disregard all that :P

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Irrelevant
Member #2,382
May 2002
avatar

Following the idea of making a specialised enviroment, I have some questions for the masses:

  • How low level should the opcodes be? Assembly-esque (direct register use and whatnot), or higher level (registers, stack, etc automated)?

  • If assembly (or lower), how many registers, stack size, etc?

  • How much memory would the enviroment have?

  • Should its HD be a disk image, or could each progranism have its own file?

  • If disk image, how big?

  • If files, should they be restricted to a 'disk' folder, or be free to wander the (real) HD? (The second option would be more fun, methinks, but you'd need to log the location of all the files.) *

  • Should a program be able to kill other processes, as well as delete their files?

  • Should the processor handle memory leaks, or would the progranisms be forced to use their initiative and invade lost memory?

  • The advantage of using an enviroment to track and run the progranisms is that you can still have them popping up unexpectedly on your desktop, but the enviroment can block attempts to overwrite or delete files not on its list (so your non-progranism files are safe).

I might have a shot at an enviroment, but I'll wait for our ideas to settle a bit. I don't want to write something noone wants. :-/

<code>//----------------//</code>Here be l33tsp33x0rz.

X-G
Member #856
December 2000
avatar

For level: I say machine opcodes. Shared memory is likely a bad idea, though, if you want multi-tasking. Have the stack be as large as you feel is necessary. Registers? Depends on what you need. You're going to need things like an IP, an accumulator and data register, etc.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Irrelevant
Member #2,382
May 2002
avatar

Right, so, progranisms shouldn't be allowed to mess with each other while they run, right? Just with each other's files?

In that case, is there any point in multitasking, or would just running progranisms sequentially off a buffer do just as well? That is, taking the progranism from the top of the buffer, running it, and adding any new progranisms to the bottom of the buffer.

Actually, that would remove the point of having delays. OK, I just answered my own question. But would multitasking still be worth it if they can't mess with each other?

If you wanted to reduce the havoc they could wreak on each other, but still allow some sabotage, you could kill any access violating progranism, but leave the change changed.

[edit]
My thoughts on memory sizes:

65536 byte RAM (2 byte memory bus)
256 byte stack (1 byte stack pointer)

Registers:

Accumulator (1(?) byte)
X + Y reg's (1(?) byte each)
instruction pointer (2 bytes)
flags (As big as necessary. 2 bytes is pro'lly max.)
stack pointer

The memory address register, memory data register, instruction register and so on can be automated if it's working at Assembly level, but if it's right down at machine code then they'd be needed as well.

<code>//----------------//</code>Here be l33tsp33x0rz.

Billybob
Member #3,136
January 2003

As I recall correctly, stacks are low level, not high level. Built directly into the processor. Anywho, I feel that all of us should make our own VM :) Why do I feel this? Because it's good practice, I mean, who doesn't want to make their own VM :) It helps you to understand how computers work, which is a requirement when you get into deep engine design. So yea, we'll all make our own VM, find out which one is best, and if we can't decide which is best, we'll squeeze 'em together into a mega VM 8-)

Here's my idea for a processor design:
*7 32-bit registers: A, B, C, D, E, F, G
*2 32-bit memory pointers: H, I
*8000 bytes of stack

Why so many registers? When I did my first custom VM(processor emulator) I did that whole Xh, Xl, thing, which basically gives you extra registers without the CPU having to store more registers....well that idea blows, this is a VM and the number of registers doesn't matter in a VM, so I went all out and put 7 32-bit registers >8)

Why so much stack? cause...I like stack.

Operations include: MOV, ADD, SUB, MUL, DIV, AND, OR(EOR), XOR, BSL(<<), BSR(>>), LJP(local jump), GJP(global jump), INC, DEC, MMV(Memory Move), IF operations, PUSH, POP, INT

I think that's it.... The whole local/global jump idea is this: local jump will jump in reference to the program's memory, global jump will jump in reference to the WHOLE memory. Now, I haven't given direct support for function calls, because I believe I shouldn't, I'll give support for it in the Assembler which will convert it to the pure machine version(PUSH registers, LJP), this'll give progranisms more control...although maybe I don't want them to have that much controll...hmm...maybe I'll give support for it...ya. The VM will be multitasking, no access violations to allow for hacking. I think that's about it, so far I've written up the MOV portion of the OPCode document, I'm dumb!, all those registers take a long time write(81 different combinations, excluding a constant...which would make it 90).

8-)

LSd016
Member #3,561
May 2003

Quote:

As I recall correctly, stacks are low level, not high level. Built directly into the processor.

No, the stack is in ram, and the cpu has a pointer to its current position(ESP).

____________________________________________
[update soon]

Billybob
Member #3,136
January 2003

Still, the point stands, the feature is built into the processor, your program doesn't have to handle pushing, poping, and keeping an ESP pointer. ;D

But yea, I thought it was in the CPU...guess it wouldn't make too much sense in the CPU....anywho, thanks for pointing that out.

Carrus85
Member #2,633
August 2002
avatar

Um, I was wondering, does anyone know of any good tutorials on VM Development? I've googled like mad and I get all sorts of JavaVM crap, that doesn't really help...

LSd016
Member #3,561
May 2003

Obviously you could find processors with built-in stack(like 256 bytes), in simple electronic devices. But not in PC.

____________________________________________
[update soon]

Billybob
Member #3,136
January 2003

Carrus85, there isn't much too it. Just build your interpreter and then add stuff like multitasking to it. If you really want some help though, search for info on emulating things like the nintendo, that'll help with writing the interpreter.

Carrus85
Member #2,633
August 2002
avatar

Besides, what the heck is the point of having the stack in the processor? Just write a class that encapsulates the stack, or just use the STL class, and BINGO! Stacks Made Easy...

BTW... PLEASE Someone tell me where a tutorial on designing VMs is located.

EDIT
--------------
William Hmm... That is what I thought.

Personally, I was thinking about customizing the VM commands so they are designed around the our "evolution" concept. True, it would be quite high level, but that isn't an issue.

I just need to figure out how to implement logic of some form.

X-G
Member #856
December 2000
avatar

Quote:

Besides, what the heck is the point of having the stack in the processor?

Speed.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Carrus85
Member #2,633
August 2002
avatar

X-G said:

Speed.

True, but with todays processors, stacks in the processor or stacks in the CPU don't make a lot of difference. I mean, the TI89 has a processor stack, but that only helps to a certain extent.

Billybob
Member #3,136
January 2003

yea, RAM is fast, but seeing as how it's getting faster, it isn't fast enough :). But personally I'd rather have faster CPUs than a big stack sitting in the CPU, plus the stack in a CPU wouldn't be used because for Windows and other OSs to operate in a multitasking environment, they must change the stack from program to program...the RAM system works great cause all you have to do is swap out the ESP.

psundlin
Member #175
April 2000

And the difference between processor and CPU is?
AFAIK it the same thing. Or is there something i don't know about?

X-G
Member #856
December 2000
avatar

Heatley: That's why you don't see CPU stacks on normal x86 CPU's, but more usually in embedded systems.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Billybob
Member #3,136
January 2003

Quote:

But yea, I thought it was in the CPU...guess it wouldn't make too much sense in the CPU

yea, I figured that out...re-organized my logic and junk.

Umm, CPU is a dangerous word. Originally I think it meant processor(Centeral Processing Unit), but now adays it can also be used to describe the computer as a whole...anywho, I was just using it as a synonym for processor.

CGamesPlay
Member #2,559
July 2002
avatar

Well, nowadays, people call the monitor the computer, and the case the CPu :P

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Billybob
Member #3,136
January 2003

That's probably cause of the Mac and how some of their comps are just a monitor with a computer crammed into the base of the monitor...anywho, I'm on OPCode 01BC after documenting MOV, ADD, SUB, MUL, DIV, AND, and EOR...my hand hurts.

Johan Halmén
Member #1,550
September 2001

Is this the longest thread in GD&C ever?

I have an old idea of making a life simulation where I would let bugs (beetles) evolve and mutate. They would contain a set of genes, one determinig the sex (xx and xy) and lots of others determining outlook, behaviour, fertility etc. Compared to your mutating progranisms this might not be as exciting, but it wouldn't harm my computer.

A good prologue or trailer for Terminator 4: "Back in the early 21st century, some geeks on an Internet site discussed what would happen, if a computer program were given a possibility to mutate. Little did they know what their..." Feel free to continue.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Richard Phipps
Member #1,632
November 2001
avatar

Johan,

I actually saw someone who made a program that simulated evolution and breeding for beetles shapes over 15 years ago on the spectrum. Pretty impressive for the time. :)

Stefan Hendriks
Member #1,957
March 2005

Is 'copying and changing randomly some bytes' really ai? I would say no.

In fact, true ai can never really exist into a machine. Machines always need instructions from a user(input) so the machine will always act based uppon its given knowledge.

An evolutionary type of program would be for instance:

- a program that continiously scan's its own source.
- a program that only starts by copying itself, but also tries out other abilities
- a program that 'learns' how to code another function to clear up 'the mess' (breeded programs that are not needed anymore)
- etc...

the problem remains-> programs will never learn this if they don't know they CAN learn this.

I have been working almost 3 years on a Counter-Strike BOT AI. And some dude just came in smashing the entire Bot concept idea because all counter-strike bots are NOT REAL ai. They are purely 100% given instructions, acting they way they do because the programmer tells them to act like this. Even when using statistics and arrays with low/high scores using trial/error systems and such, it is still hard coded. Because-> the bot never will try another aproaches but the given one by the user.

I have made a little, 'ai document', here it is:

Quote:

ProblemResult(int problem)
{
// problem attributes
for (every attribute)

return()
{
- most found attribute property
}
}

Example:
Can i move from A to B.
attributes:
- able to move? (do i have feet, have wings?)
- can i go from a to b?
- <any other attribute available you can think off>

when all true, the function returns true and executes
the given problem/task. If not, it will not execute the
task/problem. Assuming that every task/problem should
be solved, the program should loop through every attribute
and try to solve this:

- able to move? (false)
- do i have feet? (true)
- freezetime over? (false)

if no more attributes left, the program knows the
problem is now 'freezetime'. The sollution would be
'wait for freezetime to be over' so this attribute will
turn into TRUE.

PROBLEM: How to identify attributes or problems?

POSSIBLE SOLLUTION: Given by the coder... when the situation is unknown the coder should
make the problem aware of it. Danger is that the program would be to hard-coded with
problems and therefor the identification function is delicate and very hard to code.

------------ exploring the map ----------------

.... to be continued?

AI is nothing but 'problem solving' as for every human actually. A simple example would be 'pick up a glass'. For us, we see the glass, reach, grab, take it and perhaps drink. For an AI its different, whats a glass? (AI needs user input, it is not able to 'learn' that itself), how to reach? do i have instruments for that? (arms? hand? , etc) when reached, what to do? grab? whats that? etc...

if the user will insert the commands for the computer:

function: grab()
{
use arm to reach, if not reachable, use legs to move closer
grab object with hand
move arm back and hold object in front of body
}

... AI is a tough thing, gets ya dizzy (certainly at this time. :S)

psundlin
Member #175
April 2000

Quote:

In fact, true ai can never really exist into a machine. Machines always need instructions from a user(input) so the machine will always act based uppon its given knowledge.

I disagree. I know we don't have the knowledge to create a real AI, but there is also so much we don't know about this whole idea. We don't even fully understand how our brains work.
I believe mankind will create a real AI in the future.
And i don't think that there will be any problems with robots walking around and killing all of us. :)
If we can make a machine to think, we can also force it to test its actions to some rules. Like the robot laws by Asimov. Or some better ones if needed.

CGamesPlay
Member #2,559
July 2002
avatar

Umm... perhaps you should substitute "AI" with just plain "I"? What we have is exactly that: artifical intelligence. This is a simulated behavior, however gotten. If you think we can't truly teach computers to learn, then you are right, but only because you're being stubborn. Be a creationist: God put humans on this Earth, already we had the knowledge to learn and breed and change. Why not the same for computer programs?

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Billybob
Member #3,136
January 2003

Acording to my crazy logical theories:

There are currently two levels of learning known. The first is what I call brute force learning. This is what the Progranisms mimic. They try random approaches to "life" finding the best ones. This is just like when you hack a password "brute force" you try EVERY combination until one works. Now, this is not what you would call intelegent, but it is learning.

The second level is what we call intelegence. This is where, instead of randomly trying things, the entity trying to learn with use past experiences to influcence the "randomness". It is still random in a sense, but it reorginizes what random ideas it picks first.

I'm not sure whether the second level is possible or not in machines, since machines, like was basically said, are static, they follow only instructions, the instructions may change, but they are still restricted.

There is a way to find out if it is possible though, and I think it is through the first level. Maybe the Progranisms can evolve to the second level? I'm not sure. I have way too many theological questions that need answers before I can decide if this is truely possible. It seems logical, I mean we are all made of the first level of learning anyway(cells), so it would make sense that it would be possible, but we are still limited in knowledge, we don't know all that goes into "life" and thinking...so...whatever.

Let's leave it at that, PLEASE, cause this is a flame war waiting to go off, so let's be civil, please.

Oh, and Johan, your idea is known as Genetic Algorithims I think...not sure, but I think.

BTW, [url http://alifegames.sourceforge.net/] Check that out! Cool stuff, genetic algorithims. The first game kinda blows, cause it is poorly designed you can't turn(eeeee), but it's a nice idea.



Go to: