Thursday 30 April 2015

A C3/DS Agent PRAY File

PRAY files are used to compile agents and make them appear in the C3 or DS Creator, by explaining to the game how they should appear in the creator and what files are included in the agent file.  We're going to go through this example PRAY file line by line, explaining what each part does.   PRAY files can be saved as .txt files, or .ps (PRAY Source) files and can be used with a variety of tools (PrayBuilder, easyPRAY, Monk, etc.) to create agent files.

Typically, the commentary is below the code.

"en-GB"
This lets the game know that this section of the PRAY code is for the English engine. 

group AGNT "My Awesome Agent (C3)"
The name in the C3 Creator - this must be different from the DS name.  The tag AGNT is necessary for the Creator to identify this as an object kind of agent, instead of, say, a breed's egg agent.

"Agent Type" 0

This marks the file as suitable for injection.

"Agent Animation File" "myawesomeagentimage.c16"

This is where you specify the name of the sprite file that will be used to display the agent on the C3 Creator's screen.

"Agent Animation Gallery" "myawesomeagentimage"
This also refers to the image of the agent portrayed on the Creator screen. This section will be used to fill in the NEW: command, and as such the name of the sprite file is entered without the file extension.

"Agent Animation String" "0"
This can be used to specify the animation sequence displayed on the Creator screen, but 0 is fine for non-animating display pictures.  If you're animating a string, do not enclose the sequence in square brackets. "1 2 3 255" is ok.

"Agent Bioenergy Value" 0
This is used to specify the amount of bioenergy it costs you to create this agent in Creatures 3.  A value of 0 here makes this a free agent.  The amount of bioenergy yielded by recycling the agent is determined by an object variable in the cos file for the agent.

"Remove script" "enum X X XXXX kill targ next scrx X X XXXX 1 scrx X X XXXX 2"
This allows you to specify a chunk of code that will allow the agent to be removed from the game, simply by clicking the remove button on the Creator machine.  Replace the XXes with your classifers and don't forget to use scrx to remove the scripts as well!

"Script Count" 1
Specify how many COS files are needed for this agent not how many event scripts there are! Usually this will be just 1 file, unless you like to keep your events and installations in separate files.

"Script 1" @ "myawesomeagentscript.cos"
For each script specified above there needs to be one of these lines. This gives a name to each script file needed.

This following section is where you tell your agent what files it needs to run.  It does not include them in the file.

"Dependency Count" 3
Specifies how many external dependencies this agent will use. Each sprite file, catalogue file or sound file counts as a separate dependency.

"Dependency 1" "myawesomeagentimage.c16"
This section is for declaring the name for each dependency specified above.

"Dependency Category 1" 2
This section is to state where each dependency should reside, with respect to the Creatures 3 directory structure. It tells the game where to unpack that file to.  There needs to be one of these lines for each dependency.

0 is for the main C3 directory.
1 is for the Sounds folder.
2 is for the Images folder.
3 is for the Genetics directory.  (Used in breeds.)
4 is for the Body Data directory. (Used in breeds.)
5 is for the Overlay Data directory.  (Used in clothes!)
6 is for the Backgrounds directory. (Used for metarooms.)
7 is for the Catalogue directory.
10 is for the My Creatures directory. 

"Dependency 2" "chwp.wav"
"Dependency Category 2" 1
"Dependency 3" "myawesomeagent.catalogue"
"Dependency Category 3" 7

And now we're done with the C3 portion of the code.

group DSAG "My Awesome Agent (DS)"
This lets the game know that this name is for the DS creator.  It needs to be different from the C3 name.

"Agent Type" 0
This marks the file as suitable for injection.

"Agent Description" "My Awesome Agent is awesome and makes a noise."
This appears in the DS creator when the player looks through their list as a description of the agent.

"Agent Description-fr" "Ma Awesome Agent est impressionnant et fait un bruit."
"Agent Description-de" "Mein Awesome Agent ist genial und macht ein Gerausch."

You can also add French, German, Italian (it), Spanish (es) and Dutch (nl) descriptions.

"Web Label" "Creatures Caves"
"Web URL" "www.creaturescaves.com"
This causes part of the Creator machine to store your website's address and can be used to launch your site in their web browser from their game.  The game already does the http:// and the last / automatically. 

"Agent Animation File" "myawesomeagentimage.c16"

This is where you specify the name of the sprite file that will be used to display the agent on the DS Creator's screen.

"Agent Animation Gallery" "myawesomeagentimage"

This also refers to the image of the agent portrayed on the Creator screen. This section will be used to fill in the NEW: command, and as such the name of the sprite file is entered without the file extension.

"Agent Animation String" "0"

This can be used to specify the animation sequence displayed on the DS Creator's screen, but 0 is fine for non-animating display pictures. If you're animating a string, do not enclose the sequence in square brackets. "1 2 3 255" is ok.

"Agent Sprite First Image" 0
Used by the agent injector to display your agent to the player.

"Remove script" "enum XX XX XXXXX kill targ next scrx XX XX XXXXX 1 scrx XX XX XXXXX 2"
This allows you to specify a chunk of code that will allow the agent to be removed from the game, simply by clicking the remove button on the Creator machine. Replace the XXes with your classifers and don't forget to use scrx to remove the scripts as well!

"Script Count" 1

Specify how many COS files are needed for this agent not how many event scripts there are! Usually this will be just 1 file, unless you like to keep your events and installations in separate files.

"Script 1" @ "myawesomeagentscript.cos"

For each script specified above there needs to be one of these lines. This gives a name to each script file needed.

Note that this cos file is the same as the one in the C3 section - this assumes that the cos file itself checks if you're running C3, C3 docked with DS, or DS standalone.

Another way of doing it is to include a "myawesomeagent C3.cos" in the C3 section, and a "myawesomeagent DS.cos" in the DS section.  If you do so, the script count for each section remains 1. 

"Dependency Count" 3

Specifies how many external dependencies this agent will use. Each sprite file, catalogue file or sound file counts as a separate dependency.

"Dependency 1" "myawesomeagentimage.c16"

This section is for declaring the name for each dependency specified above.

"Dependency Category 1" 2

This section is to state where each dependency should reside, with respect to the Docking Station directory structure. It tells the game where to unpack that file to. There needs to be one of these lines for each dependency.

0 is for the main DS directory.
1 is for the Sounds folder.
2 is for the Images folder.
3 is for the Genetics directory. (Used in breeds.)
4 is for the Body Data directory. (Used in breeds.)
5 is for the Overlay Data directory. (Used in clothes!)
6 is for the Backgrounds directory. (Used for metarooms.)
7 is for the Catalogue directory.
10 is for the My Creatures directory.

"Dependency 2" "chwp.wav"
"Dependency Category 2" 1
"Dependency 3" "myawesomeagent.catalogue"
"Dependency Category 3" 7

And now we're done with making sure our agent displays properly in the creators and will unpack to the right places.  But we still need to include the files in our agent!!!

It is important to make sure that all the files that you expect your user to not have (the new images, new catalogues, and new sounds) are listed here, or they will not be included in the agent.  This will create a "dependency error" for the user.  They are listed twice because they are stating the destination and source names, which are usually the same. One of these lines is needed for each file you require for the object.


inline FILE "myawesomeagentimage.c16" "myawesomeagentimage.c16"
inline FILE "chwp.wav" "chwp.wav"
inline FILE "myawesomeagent.catalogue" "myawesomeagent.catalogue"

Now to look at it all together:
"en-GB"

group AGNT "My Awesome Agent (C3)"

"Agent Type" 0
"Agent Animation File" "myawesomeagentimage.c16"
"Agent Animation Gallery" "myawesomeagentimage"
"Agent Animation String" "0"
"Agent Bioenergy Value" 0
"Remove script" "enum X X XXXX kill targ next scrx X X XXXX 1 scrx X X XXXX 2"
"Script Count" 1
"Script 1" @ "myawesomeagentscript.cos"
"Dependency Count" 3
"Dependency 1" "myawesomeagentimage.c16"
"Dependency Category 1" 2
"Dependency 2" "chwp.wav"
"Dependency Category 2" 1
"Dependency 3" "myawesomeagent.catalogue"
"Dependency Category 3" 7

group DSAG "My Awesome Agent (DS)"

"Agent Type" 0
"Agent Description" "My Awesome Agent is awesome and makes a noise."
"Agent Description-fr" "Ma Awesome Agent est impressionnant et fait un bruit."
"Agent Description-de" "Mein Awesome Agent ist genial und macht ein Gerausch."
"Web Label" "Creatures Caves"
"Web URL" "www.creaturescaves.com"
"Agent Animation File" "myawesomeagentimage.c16"
"Agent Animation Gallery" "myawesomeagentimage"
"Agent Animation String" "0"
"Agent Sprite First Image" 0
"Remove script" "enum X X XXXX kill targ next scrx X X XXXX 1 scrx X X XXXX 2"
"Script Count" 1
"Script 1" @ "myawesomeagentscript.cos"
"Dependency Count" 3
"Dependency 1" "myawesomeagentimage.c16"
"Dependency Category 1" 2
"Dependency 2" "chwp.wav"
"Dependency Category 2" 1
"Dependency 3" "myawesomeagent.catalogue"
"Dependency Category 3" 7

inline FILE "myawesomeagentimage.c16" "myawesomeagentimage.c16"

inline FILE "chwp.wav" "chwp.wav"
inline FILE "myawesomeagent.catalogue" "myawesomeagent.catalogue"



Further reading

 Making Agents for Creatures 3 - CDN
 How to create .agent files for Docking Station and Creatures 3 - CDN
 DSAG PRAY Template - CDN
PRAY Mistakes - CDN

Wednesday 29 April 2015

On Strong AI and the Consciousness of Creatures

I think, therefore, I flib.


Over at Creatures Caves, Sparrow314 is gearing up to write an article for university, looking at if strong AI is valid, and if the DS Chichis could be said to be conscious.  It's building on the  Integrated Information Theory 3.0 developed by Giulio Tononi at the Center for Sleep and Consciousness at the University of Wisconsin-Madison, as well as earlier work by pioneers of AI. 

Even though it's at the early stages yet, there's still a lot of discussion going on about the nuts and bolts of how the (creatures) brain works, and the implications of consciousness in norns...  As well as discussion of several historical Creatures documents!  Don't forget to check it out!

Sunday 26 April 2015

An introduction

I'm starting up this blog because I'm currently studying a subject which is designed to give me the skills to run an already-existing blog.  (Such as a business's blog.)  I figured I should try to make a blog on something that I'm actually interested in as a test, so here goes. 

In class, we'll be using Google Analytics to track visitors, so you'll see that I have a privacy policy in place.  If you don't want to be tracked, there's some information in there on how to disable tracking. 

I've also reblogged a relevant post from The Conversation which is under a Creative Commons license - you can read more about that on my copyright page.

I've added some of my COBs and COS files to the site in the downloads page - it's very much a work in progress, and just because something isn't there yet, doesn't mean I think it's bad. 

Please have a browse-around the website, leave some comments or contact me - see what you make of it.

Saturday 25 April 2015

Teachers need confidence to teach coding properly

Andrew Manches, University of Edinburgh
Michael Gove is ploughing ahead with plans to gather an elite team of computer science experts to help bring coding into schools. He has rightly acknowledged that teaching programming in schools is vital if we want to equip the next generation with the skills they will need in working life but it is essential that we get the process right.
At this early stage, it is paramount that we don’t overlook the importance of broad knowledge and confidence. It will not be enough for this new breed of teachers to be able to code themselves.
So far, we’ve got a problem with the age at which we start encouraging children to learn programming. Clubs are springing up all over to encourage them and toys and tools are on offer too but most appear to be aimed at children over eight – children who have already been at school for three years. Three years may not seem like a long time to a grown-up but it is significant in the context of a child’s learning and their attitude.
Gove is right that we need to take a more strategic approach and right that it needs to start at an early age. But aiming at the early years carries great responsibility. There is a great risk of not doing it right and wasting time that could be spent teaching pupils other things.

How do you do it right?

All kinds of tools are being developed to encourage coding for fun and teachers already have expertise in the particular learning needs of children but it’s not yet clear how easily this expertise can be mapped onto teaching coding.
While Gove’s elite force of programming experts may know everything there is to know about coding, how much do they know about teaching and, crucially, how much do they know about teaching different age groups?
Teaching is not just a process of imparting knowledge to an attentive child. To compare it to reading, it is not enough to know how to read to teach it to others.
Learning needs to be engaging, social and interactive. It is also vital that the process is creative. Children shouldn’t just be taught a series of procedures, they need to be able to explore different, novel, personal ideas and to share them with others. And it needs to be relevant and meaningful to a child’s different experiences beyond the classroom.
The type of tools we use in the classroom will help. It’s not enough for pupils to learn how to move a robot in a certain direction. The tools must enable them to understand how coding could address a range of problems in different ways and, preferably be adaptable to suit their own interests.
But the teacher will play the most significant role. With confidence and knowledge of the building blocks of coding and how this relates to the real world, they can adapt these tools. They could even create their own resources and might not even need digital tools to do it. A well-trained teacher might, for example, get their students to give each other instructions like robots. They can offer context to their classes by helping them understand how coding affects our daily lives, from its use in Google and Facebook to streetlamps and hand driers.
A well-informed teacher can also play a part in redressing gender imbalance by making sure that when the class talks about famous people in technology, women are part of the discussion. After all, there are more and more high-profile women in the industry with every passing day.
But to do all this, they need to have an active understanding themselves. To date, we are lacking research into what makes good coding pedagogy and the area is yet to have a significant place in teacher training. This issue in particular has been a concern for the best part of thirty years and has still not been addressed.
Some teachers are already intersted in the subject and can often be found at BETT, an event that focuses on technology and education. But Gove’s aim is for all teachers to play a part. He, and they, need to appreciate that it will take more than the ability to code to make this happen.
The Conversation
This article was originally published on The Conversation. Read the original article.

Friday 24 April 2015

Meerk Toy



***create the Meerk Toy
*Make the rest of the instructions run in one tick
*(happens automatically for injection scripts with the CAOS Tool though,
*this is just a good habit to get into).
*Commands that stop the script running all in one tick include: slow, over, wait and endm
inst
*create one under the Norn garden
*Create a simple object with a classifier of family=2, genus=21 and species=1000.
*Family 2, Genus=21 shows that this is a toy object.
*The sprite file to use is called 'meerk', and you should use all the images starting at 0.
*Put the finished creation at image plane 5000.
new: simp 2 21 1000 "Meerk" 0 0 5000
*Give it attributes of 199 - (gravity, boundaries, activateable, pickupable)
attr 199
*hand can click on it - activate 1
*When the hand clicks on it that will launch an activate 1 event
clac 0
*can be picked up, hit, activate1 (push) and 2 (pull)
bhvr 43
*Acceleration due to gravity = 3
accg 3
*Not very elastic ... when it hits the floor 0 percent of its velocity remains
elas 0
*High friction ... will not slide down slopes.
fric 100
*Use image number 59
pose 59
*Define a point on the object where it will be picked up from (pickup handle).
*If you look in the sprite file you'll see that each frame is 72x56 pixels.
*Therefore the point (40,30) is slightly right and down of the centre of this sprite.
puhl -1 40 30
*if a test move to the norn terrarium is safe, move the toy to the norn terrarium.
doif tmvt 1850 950 eq 1
mvto 1850 950
*if not, move it safely to a random spot in the bottom of the DS norn meso.
*(rand chooses an X position of between 748 and 1550, but the height is fixed at 9547).
else mvsf rand 748 1550 9547
*ends the doif statement
endi
*make the camera move to show you where the toy is.
cmrt 0


**activate 1 (push) event
*This marks this chunk as being an activate 1 event script for
*any object that has the classifier 2 21 1000. This will be stored in the scriptorium.
scrp 2 21 1000 1
*Next time the hand clicks on this object it will launch an activate 2 event.
clac 1
*Give a stimulus to whatever activated (this will be ignored if the FROM object isn't a creature).
*Giving a stimulus lets the creature learn lessons from this.
*Stim 97 is the number you need to use for a toy, as it will reduce boredom in most cases.
stim writ from 97 1
*animate! Use the frames specified, in order.
*The 255 at the end means 'loop this sequence forever'.
anim [94 95 96 97 98 98 97 96 95 94 255]
*Play a sounds effect from the object - Mb_2 happens to be a sound effect from the music box
*but you can use any sound file you like!
sndc "mb_2"
*wait for a while (around 6-7 seconds). This allows the music to finish playing
*before the toy changes pose (in the next line)
wait 130
*Go back to the sitting down pose
pose 59
*End of the activate 1 event script.
endm

**activate 2 (pull) event
*This marks this chunk as being an activate 2 event script for any object that has the classifier
*2 21 1000. This will be stored in the scriptorium.
scrp 2 21 1000 2
*Same stimulus as the activate 1 event
stim writ from 97 1
*different animation than before, the last number in the anim is the 'sit' pose.
anim [22 23 24 25 26 27 28 29 30 31 32 33 59]
*Give the object some velocity in an upward direction.
setv vely -15
*Play a sound effect
sndc "ct_1"
*Next time the hand clicks on this object it will trigger an activate 1 event
clac 0
*End of the activate 2 event script
endm

**hit event
*This marks this chunk as being a hit event script for any object that has the classifier 2 21 1000.
*This will be stored in the scriptorium.
scrp 2 21 1000 3
*Same stim as before
stim writ from 97 1
*Play a sound effect, a metallic-sounding hit effect.
sndc "hit_"
*Animate
anim [70 71 72 73 74 75 76 77 78]
*Do not carry on with the rest of this script until the animation has finished playing.
*In this case when the object reaches pose 78 the script can carry on.
over
*Wait a little while (about half a second)
wait 10
*Change pose back to sitting on the floor
pose 59
*End of the hit script
endm

**pickup event
*This marks this chunk as being a pickup event script for any object
*that has the classifier 2 21 1000. This will be stored in the scriptorium.
scrp 2 21 1000 4
*'I have gotten' stimulus
stim writ from 18 1
*Change pose
pose 0
*End of the pickup script
endm

**drop event
*This marks this chunk as being a drop event script for any object
*that has the classifier 2 21 1000. This will be stored in the scriptorium.
scrp 2 21 1000 5
*'I have dropped' stimulus
stim writ from 19 1
*Change pose
pose 59
*End of the drop script
endm

*A remove script part is a very good habit to get into.
*It allows you to easily remove all objects and their scripts with the press of a button.
****REMOVAL
*This is a special command that is only used by the CAOS Tool.
*It marks the area below as being the remove script.
*This section will only be injected by selecting the 'inject remove script' from the CAOS Tool.
rscr
*Enumerate across all the objects that have a classifier of 2 21 1000
*(in case you've forgotten this is the Meerk toy we've just been making!)
enum 2 21 1000
*Kill it
kill targ
*Chose the next meerk toy
next
*Remove the activate 1 script for object 2 21 1000
scrx 2 21 1000 1
*Remove the activate 2 script
scrx 2 21 1000 2
*Remove the hit script
scrx 2 21 1000 3
*Remove the pickup script
scrx 2 21 1000 4
*Remove the drop script
scrx 2 21 1000 5