# GMLscripts.com

Discuss and collaborate on GML scripts

You are not logged in.

## #61 2011-07-28 01:16:11

xot
Registered: 2007-08-18
Posts: 1,201

### Re: CHALLENGE: Conway's Game of Life

Mark Owen's site for his WireWorld computer has thorough descriptions of the standard building blocks that go into any computer: signals, diodes, gates, flip-flops, adders, etc. Unfortunately, a few of the more complicated parts are not documented, including the BCD-encoder, display demultiplexer, and 7-segment decoders.

It's also worth checking out Golly for some other simple WireWorld circuits.

I've neglected to properly credit David Moore for his work on the circuit design, and Michael Fryers should be credited for actually providing the program that calculates the prime numbers. This circuit is a general purpose computer and it can conceivably run any program that can be written with its rather spartan instruction set. Incredibly, it only has one instruction (moving the contents of one register to another), but a handful of its 64 registers are special purpose and perform some useful functions (rather than just supplying storage), such as bit-wise and math operations on other registers and a primitive form of flow control.

I found this while trying to track down Michael Fryers. It's a GPU/GLSL-based CA library which supports WireWorld. I'd love to see it in action. The shader code is so much more simple and straightforward than my method.

Abusing forum power since 1986.

Offline

## #62 2011-07-28 15:06:57

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

I'm modifying your example to allow editing...

The harder part is synchronizing; an electron is six pixel in length. It means you have to setup you components/tracks to travel 6 pixel in 6 iterations. So I added a grid, a pause, a Iterate, and some line drawings. I'll add the simpler gates. Not worried about multiplexors... to though to grasp

I'll post the moded version soon.

Offline

## #63 2011-07-28 19:32:04

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Offline

## #64 2011-07-30 23:23:26

xot
Registered: 2007-08-18
Posts: 1,201

### Re: CHALLENGE: Conway's Game of Life

Cool. Do you plan to continuing to work on this, like with more prefabs (gates, diodes, and such)? I wonder how hard it would be to make an object-oriented editor that could draw connecting traces automatically while keeping the timings correct. Could save a lot of work in the end. I have to believe the WireWorld computer was similarly tool-assisted.

Mike Dailly is making me feel guilty for drawing surfaces to themselves. I've never had problems any more severe than some artifacting (which would be enough to break this), but he doesn't paint such a rosy picture. I trust his expertise, and I really shouldn't be doing it in any event, so I'll probably rework it to be more DirectX compliant. *sigh*

Abusing forum power since 1986.

Offline

## #65 2011-07-31 02:07:36

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

Well, I was thinking you I could add an option to make your own components by drawing them and simply provide a select rectangle method to add the components to a library

And from my experience, a tool a simple as a paint program (supporting a grid layout) can do the job just fine... The only real problem is the track lengths.  That could be accomplished crudely by checking the out and in points on the components... Or a special "Make Track" function that would automatically snake a track and make sure the entire distance is 6 or 12 or 18....

Sounds like a plan. You know of a method to snap lines to fit a dist mod 6 line between 2 points with snaking if required to hard fix the distance?

Last edited by icuurd12b42 (2011-07-31 02:15:08)

Offline

## #66 2011-07-31 04:08:20

xot
Registered: 2007-08-18
Posts: 1,201

### Re: CHALLENGE: Conway's Game of Life

I'm imagining something that constructs lines with six pixel blocks, with the ability it insert one or more kinked blocks to fit the length. Not very pretty or clever, I'm afraid.

|......|......|......||......|......|......||xxxxxx|######|xxxxxx| 6|......|......|......||......|......|......||......|......|......|

|......|......|......||......|.#....|......||xxxxxx|#.#...|xxxxxx| 7|......|..#..#|......||......|...##.|......||......|......|......|  |......|......|......||......|.##...|......||xxxxxx|#..#..|xxxxxx| 8|......|..#..#|......||......|...##.|......||......|......|......||......|..#...|......||......|.#.#..|......||xxxxxx|#..#..|xxxxxx| 9|......|..#..#|......||......|...##.|......||......|......|......||......|..##..|......||......|.#..#.|......||xxxxxx|#..#..|xxxxxx| 10|......|..#..#|......||......|...##.|......||......|......|......|

|......|..#...|......||......|.#.#..|......||xxxxxx|#..#..|xxxxxx| 11|......|..#..#|......||......|..#..#|......||......|...##.|......|

Abusing forum power since 1986.

Offline

## #67 2011-07-31 14:17:47

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

It somewhat looks like what I what thinking of

I think this can be managed by tiling sprites as opposed to drawing lines.

and only these 2 solutions are possible if you connect 2 points closer than a full grid size

All images created to fit in a grid and not to interfere with neighboring grid cell data and start point and end point are on the same raster line

Last edited by icuurd12b42 (2011-07-31 14:35:54)

Offline

## #68 2011-08-03 00:01:58

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

Added s and l for strict and straight lines

http://www.host-a.net/u/icuurd12b42/wir … o_edit.gmk

Offline

## #69 2011-08-29 03:47:11

xot
Registered: 2007-08-18
Posts: 1,201

### Re: CHALLENGE: Conway's Game of Life

OK, this guy wins the award for Most Insaniest CA Engine Creator. He's built Conway's Life in Minecraft.

Runner Up:

Abusing forum power since 1986.

Offline

## #70 2011-09-04 00:09:58

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

Yeah, some minecraft people are plain old nuts designing this sort of stuff

look at all the minecraft computers

Last edited by icuurd12b42 (2011-09-04 00:10:18)

Offline

## #71 2011-09-04 14:39:01

xot
Registered: 2007-08-18
Posts: 1,201

### Re: CHALLENGE: Conway's Game of Life

I just watched a video where a guy broke the meme and actually built Minecraft in Minecraft using redstone. Obviously it's greatly simplified and is "only" a 2D platformer with gravity and block placing/destroying. Quite a feat of engineering and patience.

</offtopic>

Abusing forum power since 1986.

Offline

## #72 2011-09-04 23:23:31

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

Yeah, I saw that. I think it's great! Now I imagine that is a great way to build nano circuitry. You're right in it.

Offline

## #73 2011-10-28 12:40:31

xot
Registered: 2007-08-18
Posts: 1,201

### Re: CHALLENGE: Conway's Game of Life

Slashdot reports:

Slashdot wrote:

djeps sends in this excerpt from the Physics arXiv Blog:

"Japanese scientists have built a cellular automaton from individual molecules that carries out huge numbers of calculations in parallel. ... At the heart of their experiment is a ring-like molecule called 2,3-dichloro-5,6-dicyano-p-benzoquinone, or DDQ. This has an unusual property: it can exist in four different conducting states, depending on the location of trapped electrons around the ring. What's more, it's possible to switch the molecule from one to state to another by zapping it with voltages of various different strengths using the tip of a scanning tunnelling microscope. It's even possible to bias the possible states that can form by placing the molecule in an electric field. Place two DDQ molecules next to each other and it's possible to make them connect. ... When one molecule changes its state, the change in configuration ripples from one molecule to the next, forming and reforming circuits as it travels."

I've been waiting many years for a story like this to inevitably appear. Exciting times!

Abusing forum power since 1986.

Offline

## #74 2011-10-28 15:51:52

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

Offline

## #75 2011-11-27 11:27:40

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

So, I was thinking if I could use the method to make realistic looking, visually and reactively, fire spread across a texture.

I was watching a WW1 Red Baron movie last night and at one point they shoot a flare at a anti bomber air balloon and the fire spread along the balloon skin and I thought I could try to implement this effect as a surface.

Setup:
Top Down view
An air ship has a sprite, it draws itself with draw sprite.
Overlaid on the sprite is the fire surface, after draw sprite, draw surface_part or a uv'ed primitive is drawn over.
The place where the fire burned would be opaque and black
The edges where the fire is burning would be a mixture of fire colors and semi transparent.
The final result would be a blending of the original sprite burning at the edges and turning black, the original texture or sprite gradually burning away.

My initial attempt at the spreading is this

Information about object: FireSkinObj

Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>

Create Event:
execute code:

global.FireSurf = -1;
global.FireTex = -1;
sprite_set_alpha_from_sprite(FireChunk_spr,FireChunk_spr)

End Step Event:
execute code:

if(!surface_exists(global.FireSurf))
{
global.FireSurf = surface_create(512,512)
if(!surface_exists(global.FireSurf))
{
global.FireTex = -1;
exit;
}
surface_set_target(global.FireSurf);
draw_clear_alpha(c_black,0);
}

surface_set_target(global.FireSurf);

off = 4;
//draw_surface_ext(global.FireSurf,-off,0,1,1,0,c_white,.25);
//draw_surface_ext(global.FireSurf,off,0,1,1,0,c_white,.25);
//draw_surface_ext(global.FireSurf,0,-off,1,1,0,c_white,.25);
//draw_surface_ext(global.FireSurf,0,off,1,1,0,c_white,.25);
draw_surface_ext(global.FireSurf,choose(off,-off),choose(off,-off),1,1,0,c_white,.5);

if(mouse_check_button_pressed(mb_left))
{
draw_sprite_ext(FireChunk_spr,0,mouse_x,mouse_y,1,1,0,c_white,1);
}
draw_set_blend_mode(bm_normal);
surface_reset_target();
global.FireTex = surface_get_texture(global.FireSurf);

Draw Event:
execute code:

if(!surface_exists(global.FireSurf)) exit;
draw_surface(global.FireSurf,0,0);

Where FireChunk_spr is a 32x32 gradient circular fill

The problem is that it's cluncky and the edges have a too abrupt transition then/or becomes blocky.

Anyway I'm passing it on here to see if anyone is interested in the idea.

I was also thinking of merging all the ships in game into a larger fire surface. So I would remap using a textured primitive the region a ship is associated with. A 512x512 surface would be able to hold 64 burning ships.

Anyway, as it is with many of my idea, I lost interest due to my lack of energy.

Last edited by icuurd12b42 (2011-11-27 11:29:28)

Offline

## #76 2011-12-29 20:03:34

Daniel
Member
Registered: 2011-05-04
Posts: 25

### Re: CHALLENGE: Conway's Game of Life

If there's initial variations of the Game of Life that will simply spread like fire consuming every pixel in it's path, then "placing" one should start a fire spread... You just subtract that from the surface of the blimp procedurally, no?

Offline

## #77 2012-04-22 21:54:57

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

Xot, is there a way to modify the logic version of the automata code to leave longer lines on the tracks and possibly have less noticeable tracks. I'd like to see if I can use this to make a top down tron like line effect on the ground and on instances.

Last edited by icuurd12b42 (2012-04-22 22:13:42)

Offline

## #78 2012-04-23 08:35:28

xot
Registered: 2007-08-18
Posts: 1,201

### Re: CHALLENGE: Conway's Game of Life

I'm not sure what you are asking.

Are you talking about the WireWorld CA? You'd like the electron-like "heads" to leave long "tail" trails and the wire-like "conductor" to be less visible? It wouldn't be possible by modifying the CA engine itself, but it should be possible to do it with some separate image processing. This could be done either at the end of a full CA step, or during the CA compositing sequence to save some work.

Basically, you would take the head states and draw them to an accumulation surface with an additive blend. Each step you would also make the exiting pixels on the accumulator fade out with a subtractive blend (normal multiplicative "subtract" or using inverse-additive sequence for a longer/cleaner fade). The accumulator could then be composited (onto the screen or onto another surface) with the conductor pathways drawn more darkly using simple color blending. The conductor pathways could either be filtered out of the CA result, used as-is from the CA result, pulled from the CA compositing sequence, or buffered separately since they are not a dynamic element.

If you want to provide a mock-up of what you want, I can probably knock something together for you if you need it. If you aren't particular about the way it looks, ie. length of the trails / rate of the fade / brightness of the conductor, the effect could be done using only the final CA composite without any costly filtering or mucking about inside the CA routine. That said, mucking about inside the CA routine should probably be done anyway to correct some important flaws that can cause it to fail on some machines or versions of GM.

Last edited by xot (2012-04-23 09:10:47)

Abusing forum power since 1986.

Offline

## #79 2012-04-24 00:09:47

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: CHALLENGE: Conway's Game of Life

Moding your wireworld to do it would be nice.

What you explain is what I imagined I would do... additive draw a few times to ramp up and a fade each step. I've done that before as you may remember you helping out quite often on the subject.

what I have trouble wrapping my head around is fading the tracks. and rampup the electron. If you feel like it I would like that very much

That's why wondered if it was possible to lengthen the electron length to a gradient of multiple pixels instead of 2 pixels and lower the track color to almost black.

Also, does GM have the equivalent grid based math to do this method of automata efficiently. I side tracked from a special effect onto integrating game logic based on the value of a data point on the automata grid.  GetPixel being so darn slow, my idea fell short.

I was thinking to represent an AI's (fake) neural net to the user with this and then it hit me I could grab the electrical state at a point... To define shooting speed for example, a bullet could only shoot when a particular point is ON...

Offline

## #80 2012-04-24 00:31:33

xot
Registered: 2007-08-18
Posts: 1,201

### Re: CHALLENGE: Conway's Game of Life

The ds_grid math routines can speed up part of the process, namely the summing of neighbors using eight ds_grid_add_grid_region() calls with single row/column offsets in each of eight directions. The comparisons and state changes have to be done individually. The parallel summing is a significant savings, however, and it still might be worth trying it grid sizes are small.

If the cells held integers instead of floats, the same GPU rounding error, integer overflow / saturated arithmetic, and masking tricks could possibly be applied to grids. IEEE 754 floats have limited precision with can supply rounding errors, and they actually support saturated arithmetic in the form of ±infinity, so it still might be possible. Game Maker has a history of acting weird when numbers get that large.

I'll post again with an example or two of the fading effect. Your application sounds really intriguing. I've considered using CA similarly but not to such a mechanical extent.

Last edited by xot (2012-04-24 00:47:37)

Abusing forum power since 1986.

Offline