View Full Version : New IDE for fooling around, light games
beepy
2005.03.02, 01:32 PM
Hello,
I'm working on a development system for kids and hobbiests. My guiding principle in developing it has been to make it as approachable as possible. I was greatly inspired by the simplicity Apple brought to complex creative applications like GarageBand and iMovie.
Here are some screenshots:
http://biggerplanet.com/playkode/d1-3.jpg
http://biggerplanet.com/playkode/d1-2.jpg
http://biggerplanet.com/playkode/d1-1.jpg
I am currently at least several months away from a beta, so there are still plenty of nonworking features and bugs. However, I am hoping to gauge interest and to recruit testers of varying degrees of experience.
You can download version D1 here (please don't post this URL anywhere else):
PlayKode D1 (1.37MB) (http://biggerplanet.com/playkode/PlayKodeD1.zip)
Here are some pretty lame and badly written sample projects:
D1 Sample Projects (762K) (http://biggerplanet.com/playkode/d1_sample_projects.zip)
Please let me know what you think.
Some technical details:
uses lua as its scripting language
zero compile time
can make stand alone applications
can do fullscreen
uses OpenAL for sound
3D suppport is currently very limited
If you're interested in helping to test this in the upcoming months, please send me a message using the form at:
biggerplanet.com/contact (http://biggerplanet.com/contact)
Thanks.
blobbo
2005.03.02, 02:05 PM
Let me be the first to say that this is by far the most promising project I've seen in a long, long time.
The user interface is terrific and very understandable. You manage to abstract away the tough bits of programming and leave something that's very useable! Incredible, incredible work!
I'm just blown away. Something like this is usually commercial. The sample projects are impressive, as well.
Collision detection built-in would be the clincher for me. I'd start using this, I'm sure. How are you compiling these apps? Is it using OpenGL?
OneSadCookie
2005.03.02, 02:15 PM
This looks really, really neat. I'm looking forward to giving it a go :)
beepy
2005.03.02, 02:16 PM
Thanks Blobbo.
Yes, all the graphics are OpenGL. The IDE itself is Cocoa. The stand-alone apps it generates are actually just a runtime packaged with the project. In fact, if in the Finder you click on a PlayKode generated application and select Show Package Contents, you can navigate to the project file that created the application.
Further, PlayKode project files are themselves packages. If you open a PlayKode package in the Finder, you can find all the code and media files inside.
I agree there needs to be built in collision detection. I don't yet know how I will implement it, either technically or in the UI.
blobbo
2005.03.02, 02:40 PM
I'd be interested to see some benchmarking of this on different systems. I'm on a dual 2.5ghz g5 right now at school - I'd be interested to see how the sample projects perform on my home mac.
Things that aren't readily obvious: how to make it display in window instead of fullscreen for testing other than changing the script?
skyhawk
2005.03.02, 02:50 PM
things I am interested in:
performance (how well does it scale)
how easy is it to use these sprites? is it just as easy to make a space shooter as a tilable RPG?
fullscreen/window (should be apple-M or apple-F in ALL applications, but that is just my opinion)
how simple is collision detection? how accurate?
and last, how much?
beepy
2005.03.02, 05:48 PM
I suppose it scales reasonably well. Obviously, you're not going to write Doom IV with it. The IDE in its current state certainly isn't designed to handle organizing thousands of images.
The sprites are as easy to use as I could make them. They are currently the only class of 2D image. To make a sprite: mySprite = sprite.new("imageName") To draw a sprite: mySprite:draw( x, y) or sprite.draw( mySprite, x, y) (Actually, I don't remember if you can really create sprites yet using that simplified form I gave above, but you're supposed to be able to).
I think putting an Apple-key command in for switching between fullscreen and windowed mode is a great idea, for both the IDE and the runtime.
There's no built-in collision detection yet, so accurate collision detection isn't possible yet.
How much? Good question. I would really like to have a very functional free version, and still have a paid version that's worth paying extra for. Not sure how that's going to work yet.
I don't know what the price will be, but I do think REALbasic and BlitzBasic are too expensive for a tinkerer -- not overpriced for what they are, but for the kind of user I am aiming for, I would want something more comfortably priced.
lightbringer
2005.03.02, 06:29 PM
Impressive.
ChrisD
2005.03.02, 06:51 PM
Thanks Blobbo.
I agree there needs to be built in collision detection. I don't yet know how I will implement it, either technically or in the UI.
Dan said I was in trouble and need to take a look at your app ;)
a very easy aproach for starters.
Add sphere based collison.
speres that fit inside a tile.
That add a group and type property to each sprite.
Then a user would asign a sprite like the player to a group called PLAYER.
And all other sprites to a group called ENEMY.
Then the player would get an event if it hit any object not in its group.
Type might be used for a sub type..
Example a group might be ENEMY and a sub group of that might be POWERUP
Ok collison GROUP is the group the object belongs to.
And collision TYPE is what it runs into.... looking at my own notes :)
So a player runs into enemies and stops.
and a POWER up waits for a player to run into it and then modifies things.
OneSadCookie
2005.03.03, 02:51 PM
absolute must: real-time clock with at least millisecond accuracy. Kinda hard to work without one :)
that said, I made this: http://onesadcookie.com/~keith/Cookies.zip in some spare time yesterday. The performance seems quite good, though on a 2x2.5 that doesn't mean a great deal.
It uses a horrible disgusting ugly hack where it tries to get a real-time timer with sub-second accuracy by reconciling os.clock() with os.time(). This technique works very poorly if you have any other programs running in the background, and works better as the game uses more CPU time, so I've got an unnecessary write each frame to waste some cycles :) Anyway, here's the code, if anyone's playing with this stuff and until we get a proper timing function :)
last_time = nil
last_clocks = nil
last_answer = nil
clocks_per_second = 1
function time()
if last_time == nil then
last_time = os.time()
last_clocks = os.clock()
last_answer = last_clocks
end
local clocks = os.clock()
local time = os.time()
local dclocks = clocks - last_clocks
local answer = (dclocks / clocks_per_second) + last_answer
if time > last_time then
clocks_per_second = (clocks - last_clocks) / (time - last_time)
write('clocks per second: ', clocks_per_second)
last_time = time
last_clocks = clocks
last_answer = answer
end
return answer
end
beepy
2005.03.03, 04:22 PM
OneSadCookie,
thanks so much for being the first brave soul to write a PlayKode program (other than myself). It's a real thrill for me to see.
Regarding timing issues: the current default (and so far, only) behavior for PlayKode is to max out at 60 FPS. This is just for simplicity's sake -- having a constant FPS means there's one less thing for beginners to worry about. Sorry that's not in the docs yet.
There should be a way to remove the throttle, and a way to get an accurate millisecond-resolution time.
OneSadCookie
2005.03.03, 04:35 PM
maxing at 60 is one thing, but if the program isn't making 60 on slower hardware it doesn't help. I stand by my statement that millisecond-accurate timing is an urgent requirement, and I'd like to see the throttle off, too :)
it looks to me like sprites are being pixel-aligned as they're drawn. is there a way to turn off this behavior? it causes funny jiggling amongst the cookies, and scaled and rotated sprites won't gain anything from it anyway...
OneSadCookie
2005.03.03, 04:55 PM
Ah, it looks like rotated/scaled sprites don't get pixel aligned. That seems like a good compromise.
A newer version, using my new knowledge of how the timing works :) : http://onesadcookie.com/~keith/Cookies.zip
Duane
2005.03.03, 05:47 PM
how do I keep the window created with graphics.activate() open?
iefan
2005.03.03, 09:35 PM
Ah, it looks like rotated/scaled sprites don't get pixel aligned. That seems like a good compromise.
A newer version, using my new knowledge of how the timing works :) : http://onesadcookie.com/~keith/Cookies.zip
So does it do anything beside drop cookies? I get about 50-55 fps on my 12-inch PowerBook G4
OneSadCookie
2005.03.03, 10:27 PM
it drops ever-increasingly many spinning randomly-sized cookies. isn't that enough for you?!
see, that framerate is why I need proper timing. the fps indicator should be red at that speed, showing it's below 60 and therefore objects are not moving at the intended speed.
aaronsullivan
2005.03.03, 10:45 PM
This is great. Don't stop improving this! :) It will be a great prototyping tool even for "serious" game programmers. Really love the layout and the "iLife approach."
If only I had tools like this when I first started. :D
kberg
2005.03.04, 12:15 AM
Oh cool! This looks really great, excellent work! :)
geezusfreeek
2005.03.04, 03:11 AM
I haven't tried it out yet, but I must say that this is probably the most impressive-looking GUI for a game IDE I have seen... like... ever.
beepy
2005.03.04, 12:38 PM
it drops ever-increasingly many spinning randomly-sized cookies. isn't that enough for you?!
see, that framerate is why I need proper timing. the fps indicator should be red at that speed, showing it's below 60 and therefore objects are not moving at the intended speed.
I can't explain the pixel-alignment that was happening. I'll have to look into it.
I will note that you're creating a sprite every frame to render the FPS, which is a relatively expensive process. PlayKode doesn't yet have a method to display frequently changing text like this. This results in a lower FPS and less smooth animation, as all those sprites get created and destroyed.
I made a number sprite class for another sample project. You can enter it into PlayKode automatically by clicking here (playkode://com.biggerplanet.playkode/?action=new&script=require%28%22Class%22%29%0AnumberSprite%20% 3D%20class.new%28%29%0A%0Afunction%20numberSprite. new%28%20fontName,%20fontSize,%20color,%20width%29 %0A%09local%20result%20%3D%20%7B%20sprite%20%3D%20 %7B%7D%7D%0A%09local%20color%20%3D%20color%20or%20 %7B%20red%20%3D%201.0,%20green%20%3D%201.0,%20blue %20%3D%201.0%7D%0A%09%0A%09for%20i%20%3D%200,%209% 20do%0A%09%09%0A%09%09result.sprite%5B%0A%09%09%09 string.char%28%0A%09%09%09%09string.byte%28'0'%29% 20%2B%20i%0A%09%09%09%29%5D%20%3D%20sprite.string% 28%20i,%20fontName,%20fontSize,%0A%09%09%09sprite. alignLeft,%20nil,%20color.red,%20color.green,%20co lor.blue%29%0A%09end%0A%09result.sprite%5B'-'%5D%20%3D%20sprite.string%28'-',%20fontName,%20fontSize,%0A%09%09sprite.alignLef t,%20nil,%20color.red,%20color.green,%20color.blue %29%0A%09result.sprite%5B'.'%5D%20%3D%20sprite.str ing%28'.',%20fontName,%20fontSize,%0A%09%09sprite. alignLeft,%20nil,%20color.red,%20color.green,%20co lor.blue%29%0A%09result.sprite%5B','%5D%20%3D%20sp rite.string%28',',%20fontName,%20fontSize,%0A%09%0 9sprite.alignLeft,%20nil,%20color.red,%20color.gre en,%20color.blue%29%0A%09result.sprite%5B'%2B'%5D% 20%3D%20sprite.string%28'%2B',%20fontName,%20fontS ize,%0A%09%09sprite.alignLeft,%20nil,%20color.red, %20color.green,%20color.blue%29%0A%09result.sprite %5B'e'%5D%20%3D%20sprite.string%28'e',%20fontName, %20fontSize,%0A%09%09sprite.alignLeft,%20nil,%20co lor.red,%20color.green,%20color.blue%29%0A%09%0A%0 9result.width%20%3D%20%28width%20or%20fontSize%29% 20or%2012%0A%09return%20numberSprite:initInstance% 28%20result%29%0Aend%0A%0Afunction%20numberSprite: render%28%20v,%20x,%20y%29%0A%09local%20v,%20x,%20 y%20%3D%20v%20or%200,%20x%20or%200,%20y%20or%200%0 A%09local%20l,%20z%20%3D%20string.len%28%20v%29,%2 0string.byte%28'0'%29%0A%09for%20i%20%3D%201,%20l% 20do%0A%09%09local%20b%20%3D%20string.sub%28%20v,% 20i,%20i%29%0A%09%09%0A%09%09if%20self.sprite%5Bb% 5D%20~%3D%20nil%20then%0A%09%09%09self.sprite%5Bb% 5D:draw%28%20x,%20y%29%0A%09%09end%0A%09%09x%20%3D %20x%20%2B%20self.width%0A%09end%0Aend%0A%0A%0A). Note -- this will replace whatever text you have in PlayKode's frontmost window, so click with caution.
Here's what's in that link, a snippet for a numberSprite class:
require("Class")
numberSprite = class.new()
function numberSprite.new( fontName, fontSize, color, width)
local result = { sprite = {}}
local color = color or { red = 1.0, green = 1.0, blue = 1.0}
for i = 0, 9 do
result.sprite[
string.char(
string.byte('0') + i
)] = sprite.string( i, fontName, fontSize,
sprite.alignLeft, nil, color.red, color.green, color.blue)
end
result.sprite['-'] = sprite.string('-', fontName, fontSize,
sprite.alignLeft, nil, color.red, color.green, color.blue)
result.sprite['.'] = sprite.string('.', fontName, fontSize,
sprite.alignLeft, nil, color.red, color.green, color.blue)
result.sprite[','] = sprite.string(',', fontName, fontSize,
sprite.alignLeft, nil, color.red, color.green, color.blue)
result.sprite['+'] = sprite.string('+', fontName, fontSize,
sprite.alignLeft, nil, color.red, color.green, color.blue)
result.sprite['e'] = sprite.string('e', fontName, fontSize,
sprite.alignLeft, nil, color.red, color.green, color.blue)
result.width = (width or fontSize) or 12
return numberSprite:initInstance( result)
end
function numberSprite:render( v, x, y)
local v, x, y = v or 0, x or 0, y or 0
local l, z = string.len( v), string.byte('0')
for i = 1, l do
local b = string.sub( v, i, i)
if self.sprite[b] ~= nil then
self.sprite[b]:draw( x, y)
end
x = x + self.width
end
end
so, for example, you could add:
import("numberSprite")
fpsNumbers = numberSprite.new()
to the beginning of main, then call
fpsNumbers:render( frame_rate, -256, 256)
It'll only be one color, but you could make a second red instance of numberSprite.
DavidJJ
2005.03.05, 09:10 AM
how do I keep the window created with graphics.activate() open?
I second this question. How do I keep the window created with graphics.activate() open?
beepy
2005.03.05, 11:23 AM
I second this question. How do I keep the window created with graphics.activate() open?
Sorry I missed that one. Do you want the window to remain open past the end of the execution of the program? For what purpose?
Fruity
2005.03.05, 11:49 AM
Hmm.. it keeps crashing here.. I get the icon in the dock, and see the menus, then I'm told it has quit unexpectedly.
10.2.8, system in sig. (too old system.. that explains it. :))
crash-logs. (the third time I tried opening it by dragging a project onto the app.. don't know if it reported differently.)
**********
Date/Time: 2005-03-05 17:51:40 +0100
OS Version: 10.2.8 (Build 6R73)
Host: Erlend-Dietrichs-maskin.local.
Command: PlayKode
PID: 546
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000006
Thread 0 Crashed:
#0 0x90131df0 in CFRelease
#1 0x97e201a4 in _decodeObjectBinary
#2 0x97e4cad8 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:]
#3 0x97e0c724 in -[NSArray initWithCoder:]
#4 0x97e20328 in _decodeObjectBinary
#5 0x97e284a4 in _decodeObject
#6 0x930adfb0 in -[NSView initWithCoder:]
#7 0x9314adf4 in -[NSCustomView initWithCoder:]
#8 0x97e20328 in _decodeObjectBinary
#9 0x97e284a4 in _decodeObject
#10 0x930fdc4c in -[NSNibConnector initWithCoder:]
#11 0x930f1444 in -[NSNibOutletConnector initWithCoder:]
#12 0x97e20328 in _decodeObjectBinary
#13 0x97e4cad8 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:]
#14 0x97e0c724 in -[NSArray initWithCoder:]
#15 0x97e20328 in _decodeObjectBinary
#16 0x97e284a4 in _decodeObject
#17 0x9314a354 in -[NSIBObjectData initWithCoder:]
#18 0x97e20328 in _decodeObjectBinary
#19 0x97e284a4 in _decodeObject
#20 0x931b3cb4 in loadNib
#21 0x930eaaa4 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#22 0x9314a228 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#23 0x93149fe8 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#24 0x0003cae4 in -[outputControlController awakeFromNib]
#25 0x930adde4 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:]
#26 0x931b3d08 in loadNib
#27 0x930eaaa4 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#28 0x9314a228 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#29 0x93149fe8 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#30 0x0000cce4 in -[pkProjectDocument windowControllerDidLoadNib:]
#31 0x93174dc0 in -[NSWindowController _windowDidLoad]
#32 0x931c7a6c in -[NSWindowController window]
#33 0x931cabf0 in -[NSWindowController showWindow:]
#34 0x931cabb0 in -[NSDocument showWindows]
#35 0x931f1114 in -[NSDocumentController openUntitledDocumentOfType:display:]
#36 0x9318af14 in -[NSDocumentController _openUntitled]
#37 0x9318ae30 in -[NSApplication _doOpenUntitled]
#38 0x93161d80 in _requiredAEEventHandler
#39 0x91b56570 in aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*)
#40 0x91b590cc in dispatchEventAndSendReply(AEDesc const*, AEDesc*)
#41 0x91b56478 in aeProcessAppleEvent
#42 0x96a83778 in AEProcessAppleEvent
#43 0x9308e698 in _DPSNextEvent
#44 0x930a0824 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#45 0x930b23f4 in -[NSApplication run]
#46 0x931605cc in NSApplicationMain
#47 0x0000b208 in _start (crt.c:267)
#48 0x8fe19154 in _dyld_start
Thread 1:
#0 0x90073ba8 in mach_msg_trap
#1 0x90005ed0 in mach_msg
#2 0x90148938 in __CFRunLoopRun
#3 0x90180f04 in CFRunLoopRunSpecific
#4 0x94652f80 in HALRunLoop::OwnThread(void*)
#5 0x946591e0 in CAPThread::Entry(CAPThread*)
#6 0x90020c28 in _pthread_body
Thread 2:
#0 0x90042588 in semaphore_timedwait_signal_trap
#1 0x9003e7b4 in _pthread_cond_wait
#2 0x946444fc in CAGuard::WaitFor(unsigned long long)
#3 0x94644130 in CAGuard::WaitUntil(unsigned long long)
#4 0x94642b20 in HPIOThread::WorkLoop()
#5 0x9465919c in HPIOThread::ThreadEntry(HPIOThread*)
#6 0x946591e0 in CAPThread::Entry(CAPThread*)
#7 0x90020c28 in _pthread_body
PPC Thread State:
srr0: 0x90131df0 srr1: 0x0000f030 vrsave: 0x00000000
xer: 0x00000000 lr: 0x90131de0 ctr: 0x90131dc8 mq: 0x00000000
r0: 0x97e201a4 r1: 0xbfffd5d0 r2: 0x28004242 r3: 0x00000000
r4: 0x906ade3c r5: 0x00000000 r6: 0x00000064 r7: 0x61726368
r8: 0xa0131de0 r9: 0xa0131de0 r10: 0x00000000 r11: 0xa7df1618
r12: 0x90131dc8 r13: 0x00000000 r14: 0x00000000 r15: 0xa309a288
r16: 0x01d60880 r17: 0xa309a7c4 r18: 0xa309a288 r19: 0xa309a7c4
r20: 0xa7defc68 r21: 0x0000000c r22: 0x00000000 r23: 0x01d653c0
r24: 0x97f14ffc r25: 0x00000000 r26: 0x00000864 r27: 0x01d64a20
r28: 0x00000000 r29: 0x00000000 r30: 0x00000000 r31: 0x90131de0
**********
Date/Time: 2005-03-05 17:54:07 +0100
OS Version: 10.2.8 (Build 6R73)
Host: Erlend-Dietrichs-maskin.local.
Command: PlayKode
PID: 549
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000006
Thread 0 Crashed:
#0 0x90131df0 in CFRelease
#1 0x97e201a4 in _decodeObjectBinary
#2 0x97e4cad8 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:]
#3 0x97e0c724 in -[NSArray initWithCoder:]
#4 0x97e20328 in _decodeObjectBinary
#5 0x97e284a4 in _decodeObject
#6 0x930adfb0 in -[NSView initWithCoder:]
#7 0x9314adf4 in -[NSCustomView initWithCoder:]
#8 0x97e20328 in _decodeObjectBinary
#9 0x97e284a4 in _decodeObject
#10 0x930fdc4c in -[NSNibConnector initWithCoder:]
#11 0x930f1444 in -[NSNibOutletConnector initWithCoder:]
#12 0x97e20328 in _decodeObjectBinary
#13 0x97e4cad8 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:]
#14 0x97e0c724 in -[NSArray initWithCoder:]
#15 0x97e20328 in _decodeObjectBinary
#16 0x97e284a4 in _decodeObject
#17 0x9314a354 in -[NSIBObjectData initWithCoder:]
#18 0x97e20328 in _decodeObjectBinary
#19 0x97e284a4 in _decodeObject
#20 0x931b3cb4 in loadNib
#21 0x930eaaa4 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#22 0x9314a228 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#23 0x93149fe8 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#24 0x0003cae4 in -[outputControlController awakeFromNib]
#25 0x930adde4 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:]
#26 0x931b3d08 in loadNib
#27 0x930eaaa4 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#28 0x9314a228 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#29 0x93149fe8 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#30 0x0000cce4 in -[pkProjectDocument windowControllerDidLoadNib:]
#31 0x93174dc0 in -[NSWindowController _windowDidLoad]
#32 0x931c7a6c in -[NSWindowController window]
#33 0x931cabf0 in -[NSWindowController showWindow:]
#34 0x931cabb0 in -[NSDocument showWindows]
#35 0x931f1114 in -[NSDocumentController openUntitledDocumentOfType:display:]
#36 0x9318af14 in -[NSDocumentController _openUntitled]
#37 0x9318ae30 in -[NSApplication _doOpenUntitled]
#38 0x93161d80 in _requiredAEEventHandler
#39 0x91b56570 in aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*)
#40 0x91b590cc in dispatchEventAndSendReply(AEDesc const*, AEDesc*)
#41 0x91b56478 in aeProcessAppleEvent
#42 0x96a83778 in AEProcessAppleEvent
#43 0x9308e698 in _DPSNextEvent
#44 0x930a0824 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#45 0x930b23f4 in -[NSApplication run]
#46 0x931605cc in NSApplicationMain
#47 0x0000b208 in _start (crt.c:267)
#48 0x8fe19154 in _dyld_start
Thread 1:
#0 0x90073ba8 in mach_msg_trap
#1 0x90005ed0 in mach_msg
#2 0x90148938 in __CFRunLoopRun
#3 0x90180f04 in CFRunLoopRunSpecific
#4 0x94652f80 in HALRunLoop::OwnThread(void*)
#5 0x946591e0 in CAPThread::Entry(CAPThread*)
#6 0x90020c28 in _pthread_body
Thread 2:
#0 0x90042588 in semaphore_timedwait_signal_trap
#1 0x9003e7b4 in _pthread_cond_wait
#2 0x946444fc in CAGuard::WaitFor(unsigned long long)
#3 0x94644130 in CAGuard::WaitUntil(unsigned long long)
#4 0x94642b20 in HPIOThread::WorkLoop()
#5 0x9465919c in HPIOThread::ThreadEntry(HPIOThread*)
#6 0x946591e0 in CAPThread::Entry(CAPThread*)
#7 0x90020c28 in _pthread_body
PPC Thread State:
srr0: 0x90131df0 srr1: 0x0000f030 vrsave: 0x00000000
xer: 0x00000000 lr: 0x90131de0 ctr: 0x90131dc8 mq: 0x00000000
r0: 0x97e201a4 r1: 0xbfffd5d0 r2: 0x28004242 r3: 0x00000000
r4: 0x906ade3c r5: 0x00000000 r6: 0x00000064 r7: 0x61726368
r8: 0xa0131de0 r9: 0xa0131de0 r10: 0x00000000 r11: 0xa7df1618
r12: 0x90131dc8 r13: 0x00000000 r14: 0x00000000 r15: 0xa309a288
r16: 0x01d60880 r17: 0xa309a7c4 r18: 0xa309a288 r19: 0xa309a7c4
r20: 0xa7defc68 r21: 0x0000000c r22: 0x00000000 r23: 0x01d653c0
r24: 0x97f14ffc r25: 0x00000000 r26: 0x00000864 r27: 0x01d64a20
r28: 0x00000000 r29: 0x00000000 r30: 0x00000000 r31: 0x90131de0
**********
Date/Time: 2005-03-05 17:54:38 +0100
OS Version: 10.2.8 (Build 6R73)
Host: Erlend-Dietrichs-maskin.local.
Command: PlayKode
PID: 554
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000006
Thread 0 Crashed:
#0 0x90131df0 in CFRelease
#1 0x97e201a4 in _decodeObjectBinary
#2 0x97e4cad8 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:]
#3 0x97e0c724 in -[NSArray initWithCoder:]
#4 0x97e20328 in _decodeObjectBinary
#5 0x97e284a4 in _decodeObject
#6 0x930adfb0 in -[NSView initWithCoder:]
#7 0x9314adf4 in -[NSCustomView initWithCoder:]
#8 0x97e20328 in _decodeObjectBinary
#9 0x97e284a4 in _decodeObject
#10 0x930fdc4c in -[NSNibConnector initWithCoder:]
#11 0x930f1444 in -[NSNibOutletConnector initWithCoder:]
#12 0x97e20328 in _decodeObjectBinary
#13 0x97e4cad8 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:]
#14 0x97e0c724 in -[NSArray initWithCoder:]
#15 0x97e20328 in _decodeObjectBinary
#16 0x97e284a4 in _decodeObject
#17 0x9314a354 in -[NSIBObjectData initWithCoder:]
#18 0x97e20328 in _decodeObjectBinary
#19 0x97e284a4 in _decodeObject
#20 0x931b3cb4 in loadNib
#21 0x930eaaa4 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#22 0x9314a228 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#23 0x93149fe8 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#24 0x0003cae4 in -[outputControlController awakeFromNib]
#25 0x930adde4 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:]
#26 0x931b3d08 in loadNib
#27 0x930eaaa4 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#28 0x9314a228 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#29 0x93149fe8 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#30 0x0000cce4 in -[pkProjectDocument windowControllerDidLoadNib:]
#31 0x93174dc0 in -[NSWindowController _windowDidLoad]
#32 0x931c7a6c in -[NSWindowController window]
#33 0x931cabf0 in -[NSWindowController showWindow:]
#34 0x931cabb0 in -[NSDocument showWindows]
#35 0x931c5500 in -[NSDocumentController _openDocumentFileAt:display:]
#36 0x93284320 in -[NSDocumentController _openFile:]
#37 0x9320882c in -[NSApplication _doOpenFile:ok:tryTemp:]
#38 0x932086c4 in _tryToOpenOrPrint
#39 0x93161f44 in _requiredAEEventHandler
#40 0x91b56570 in aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*)
#41 0x91b590cc in dispatchEventAndSendReply(AEDesc const*, AEDesc*)
#42 0x91b56478 in aeProcessAppleEvent
#43 0x96a83778 in AEProcessAppleEvent
#44 0x9308e698 in _DPSNextEvent
#45 0x930a0824 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#46 0x930b23f4 in -[NSApplication run]
#47 0x931605cc in NSApplicationMain
#48 0x0000b208 in _start (crt.c:267)
#49 0x8fe19154 in _dyld_start
Thread 1:
#0 0x90073ba8 in mach_msg_trap
#1 0x90005ed0 in mach_msg
#2 0x90148938 in __CFRunLoopRun
#3 0x90180f04 in CFRunLoopRunSpecific
#4 0x94652f80 in HALRunLoop::OwnThread(void*)
#5 0x946591e0 in CAPThread::Entry(CAPThread*)
#6 0x90020c28 in _pthread_body
Thread 2:
#0 0x90042588 in semaphore_timedwait_signal_trap
#1 0x9003e7b4 in _pthread_cond_wait
#2 0x946444fc in CAGuard::WaitFor(unsigned long long)
#3 0x94644130 in CAGuard::WaitUntil(unsigned long long)
#4 0x94642b20 in HPIOThread::WorkLoop()
#5 0x9465919c in HPIOThread::ThreadEntry(HPIOThread*)
#6 0x946591e0 in CAPThread::Entry(CAPThread*)
#7 0x90020c28 in _pthread_body
PPC Thread State:
srr0: 0x90131df0 srr1: 0x0000f030 vrsave: 0x00000000
xer: 0x00000000 lr: 0x90131de0 ctr: 0x90131dc8 mq: 0x00000000
r0: 0x97e201a4 r1: 0xbfffd540 r2: 0x28004242 r3: 0x00000000
r4: 0x906ade3c r5: 0x00000000 r6: 0x00000064 r7: 0x61726368
r8: 0xa0131de0 r9: 0xa0131de0 r10: 0x00000000 r11: 0xa7df1618
r12: 0x90131dc8 r13: 0x00000000 r14: 0x00000000 r15: 0xa309a288
r16: 0x01eeffe0 r17: 0xa309a7c4 r18: 0xa309a288 r19: 0xa309a7c4
r20: 0xa7defc68 r21: 0x0000000c r22: 0x00000000 r23: 0x01ef43f0
r24: 0x97f14ffc r25: 0x00000000 r26: 0x00000864 r27: 0x01ef3e60
r28: 0x00000000 r29: 0x00000000 r30: 0x00000000 r31: 0x90131de0
beepy
2005.03.05, 12:03 PM
Hmm.. it keeps crashing here.. I get the icon in the dock, and see the menus, then I'm told it has quit unexpectedly.
10.2.8, system in sig.
Sorry, it requires Mac OS X 10.3. It looks like it's crashing loading the window resources, which include controls that didn't exist in Mac OS X 10.2.
DavidJJ
2005.03.05, 08:05 PM
Sorry I missed that one. Do you want the window to remain open past the end of the execution of the program? For what purpose?
No, I basically don't understand how to just open a window and leave it open until I hit CMD-Q or the red close window button. Just to get a window to appear and stay at first, then I'll try my hand at putting something in it.
OneSadCookie
2005.03.06, 03:23 AM
there's a simple example in the event-handling documentation (I think the section is called "input"). Basically, you've got to loop, accepting events, until an event you like comes by.
beepy
2005.03.06, 09:46 AM
No, I basically don't understand how to just open a window and leave it open until I hit CMD-Q or the red close window button. Just to get a window to appear and stay at first, then I'll try my hand at putting something in it.
When your program ends, the graphics window ends with it, just as any sounds that might have been playing will stop playing.
I think the easiest way to fool around with graphics is not to worry about creating a window. Like this:
graphics.activate()
graphics.clear()
graphics.drawRectangle( 0, 0, 10, 10)
graphics.refresh()
Which will draw a little white rectangle. The graphics pane will show whatever the graphics were showing at the last graphics.refresh() call.
Maybe what you're asking for is an interactive mode -- one in which you can type some code, have it execute immediately and have its context persist, so you can type more code that uses the same context. That feature would be useful, but it won't be in PlayKode 1.0.
socksy
2005.03.29, 03:43 AM
I have been messing around with this application and find very good. Don't even think about dropping this app!
I have had some problems getting sound to work. With the demo of the sidescroller, sound does work perfectly. I tried implementing the sound using the found instructions and the few examples over the reference code bit but they still don't seem to work, I only got it to make a static type sound, once. The other times after that it was a lot shorter which makes it a lot harder to hear with the PlayKode play sound. I tried with the code found in the sidescroller with resources and sound all defined. The same result kept happening. I also tried making an app with the build app thing and that time, absolutely nothing happened apart from a menu...
I believe there must be something wrong with the file, but the code I used (just in case):
resources = {}
resources.sounds = {}
resources.sounds.shoot = sound.load('Bazooka')
sound.play( resources.sounds.shoot)
I will upload the file or app if you believe that that is the problem.
Thanks, socksy.
HowardG
2005.03.29, 12:58 PM
Beepy,
You might try something like this in the - (id)init of your application. It would politely tell them they need MacOS 10.3 to run your IDE and then just quit without crashing.
- (id)init
{
SInt32 MacVersion;
if (Gestalt(gestaltSystemVersion, &MacVersion) == noErr && MacVersion < 0x1030)
{
NSRunAlertPanel (@"Warning",@"PlayKode requires MacOS version 10.3 or higher in order to run.",@"OK",nil,nil,nil);
[NSApp terminate:self];
}
}
Regards,
Howard
beepy
2005.03.31, 11:28 AM
I have had some problems getting sound to work...
What I suspect is happening is that your program ends before the sound has a chance to play. When a PlayKode program ends, all the sounds that are currently playing get stopped. The easiest thing to do (at this early stage of PlayKode's development) is to not end your program until the user does something, like presses a key.
This is complicated by PlayKode's immature state -- there's no way to check to see if a sound is playing, for example, and in the version I posted here, the event queue isn't cleared when a program runs, so you can can get stray input events.
Further, there's no documentation about sound formats. PlayKode tries to use QuickTime to parse formats it doesn't recognize. AIFFs are special cases, as PlayKode tries to respect their looping data. There may be limitations I can't remember off the top of my head -- I can't remember what I did about multi-channel (like stereo) sounds, for example.
Here's an expansion of your snippet (paste into PlayKode (playkode://com.biggerplanet.playkode/?action=new&script=aSound%20%3D%20sound.load%28'Bazooka'%29%0A assert%28%20aSound%20~%3D%20nil%29%0A%0Asound.play %28%20aSound%29%0Awrite%28'press%20any%20key'%29%0 A%0A--%20first%20wait%20until%20there%20are%20no%20event s%20%28work%20around%20bug%20in%20playkode%20d1%29 %0Alocal%20event,%20value%20%3D%20input.nextEvent% 28%29%0A%0Awhile%20event%20~%3D%20nil%20do%0A%09%0 A%09event,%20value%20%3D%20input.nextEvent%28%29%0 Aend%0A%0A--%20now%20wait%20for%20for%20any%20down%20event%20% 28mouse%20button%20or%20keyboard%29%0A%0Arepeat%0A %09event,%20value%20%3D%20input.nextEvent%28%29%0A until%20type%28%20value%29%20%3D%3D%20'boolean'%20 and%20value%0A%0A) ):
aSound = sound.load('Bazooka')
assert( aSound ~= nil)
sound.play( aSound)
write('press any key')
-- first wait until there are no events (work around bug in playkode d1)
local event, value = input.nextEvent()
while event ~= nil do
event, value = input.nextEvent()
end
-- now wait for for any down event (mouse button or keyboard)
repeat
event, value = input.nextEvent()
until type( value) == 'boolean' and value
beepy
2005.03.31, 12:05 PM
Beepy,
You might try something like this in the - (id)init of your application. It would politely tell them they need MacOS 10.3 to run your IDE and then just quit without crashing.
Thanks, HowardG. I do that check now in the application delegate's awakeFromNib method, which seemed to work on my Mac OS X 10.2.8 test system.
socksy
2005.03.31, 01:54 PM
Thanks for the help, the thing was I was under the impression that the program would still be in use when sounds were playing (or anything was happening) as the code in the input reference just repeated to check whether or not something had been pressed, then print something if it hadn't. To test this myself I repeated the code write("All Hail Cheese!!!") a few hundred times and it stayeed up to process them all. Does it not regard playing the sound as part of processing it?
beepy
2005.03.31, 02:23 PM
Does it not regard playing the sound as part of processing it?
The program doesn't wait to execute the next instruction after a sound has begun playing, otherwise everything would freeze whenever a sound was played. Likewise, the program doesn't wait for all sounds to finish playing when it ends, since some of those sounds could be very long (like music) or looping (never ending).
However, it's not unnatural to expect that the playing of sound to be treated as a single step that ends when the sound finishes playing. I think the answer here is that the documentation needs to be completed.
socksy
2005.03.31, 03:26 PM
*Starts writing tutorial for complete beginners*
beepy
2005.04.01, 11:57 AM
*Starts writing tutorial for complete beginners*
While you're at it, write the FAQs and PlayKode reference manual as well, would you?
socksy
2005.04.01, 12:49 PM
FAQs
Is kode a mispelling of code?
No, Kode is not a miss spelling of code, it is thus code that is spelt incorrectly.
:p
I think I'll just stick with the tutorial for beginners, thank you very much ;)
jessimko
2005.04.02, 04:06 AM
Wow, this looks cool. I never imagined that the kind of interface Apple uses for their i-Apps would be so fitting for an IDE. But everything you need is right there in front of you. Nice work!!
Even the little sound effects are great. Keep up the good work. This could be a huge hit among educators.
socksy
2005.04.20, 02:02 PM
Problem: When building an app, it doesn't stay up with that code...
Yet again I tricked it by putting All Hail Cheese for a long time so that it would stay up...
Here (http://www.zen22638.zen.co.uk/snd.zip) is a zip file of the app I made. I also find it a great idea to let sounds play together, on several "learning program making" things they wait until one sound is finished before the they play another.
Tutorial is under progress,
socksy/snakey
socksy
2005.04.20, 02:25 PM
And how do you make the links to playkode? I got stuck with the carriage return :blush:...
I thought it was going to be %0A...
beepy
2005.04.20, 05:30 PM
I added a menu command "Copy as URL" which I used to make those links. That feature is not in the version of PlayKode I made available from here. However, you can modify Apple's AppleScript (available on this page (http://www.apple.com/applescript/scripteditor/12.html)) to generate PlayKode links instead. Or you can just wait for the next publicly available version of PlayKode.
There's something really bizarre going on with your sample app that I can't explain. Hopefully you're one of the handful of people who let me know you'd be willing to beta/pre-beta test and we can figure out what's going on when that testing gets underway.
socksy
2005.04.21, 01:50 PM
If you double click (or just run from terminal with "/Users/you/Desktop/snd.app/Contents/MacOS/PlayKode\ Host; exit") the binary then it will work as predicted...
I'm gonna try and see if making a speific key to press changes much.
*Doesn't and starts deleting random menus from the nib menu file*
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.