Nah, bar the audio code that I nicked off Gazmatt wrote:Nice work, korruptor.
Are you using any framework - even a personally developed one - or is this all from-scratch Objective-C?
matt
Show us yer programming projects!
- korruptor
- Baaaaaa!

- Posts: 4291
- Joined: Sun Sep 22, 2002 10:35 am 0
- Location: Under The Northern Lights
- Contact:
Re: Show us yer programming projects!
"Don't go into a trance boys..." :: DJ Mixes
- evilpaul
- Baaaa!

- Posts: 811
- Joined: Wed Sep 29, 2004 2:01 pm 0
- Location: #ukscene, helsinki branch
- Contact:
Re: Show us yer programming projects!
Barney wrote:As I said, I'm learning how to do this as I go - it's all in software at the moment and I'm hoping to be able to do various styles of 2d games with the engine when it's done.
Don't try to write a re-usable engine - it's hard. If it's the first time then you'll probably realise that it's all wrong a few times before you finish. You run the risk of spending more time developing and trying to maintain the engine than the game itself, and you'll end up getting disillusioned. If your aim is to write a game then write a game, not an engine ;)Barney wrote:..any pointers will be greatly appreciated.
[My blog - http://evilpaul.org] [My demos - http://atebit.org] [Twitter - http://twitter.com/evilpaul_atebit][My inspiration - http://bitethis.org]
-
matt
- Sheepie Whore

- Posts: 14826
- Joined: Mon Apr 22, 2002 4:07 pm 0
- XBL Gamertag: gingerbeardman
- PSN: wirehang
- Location: here && there
- Contact:
Re: Show us yer programming projects!
Nice work,korruptor wrote:Nah, bar the audio code that I nicked off Gaz, and some texture stuff from the Crash Landing demo, it's ground up, C++/ObjC
- korruptor
- Baaaaaa!

- Posts: 4291
- Joined: Sun Sep 22, 2002 10:35 am 0
- Location: Under The Northern Lights
- Contact:
Re: Show us yer programming projects!
Cheers 
Full version was finished, bar tweaks, this arvo, so I might push it onto the app store fairly soon. I'll whore it when it's up
Full version was finished, bar tweaks, this arvo, so I might push it onto the app store fairly soon. I'll whore it when it's up
"Don't go into a trance boys..." :: DJ Mixes
-
matt
- Sheepie Whore

- Posts: 14826
- Joined: Mon Apr 22, 2002 4:07 pm 0
- XBL Gamertag: gingerbeardman
- PSN: wirehang
- Location: here && there
- Contact:
Re: Show us yer programming projects!
How long start to finish?
Re: Show us yer programming projects!
I hear what you're saying, and thanks for the feedback :-) Currently, this "engine" is there to provide me with code that will do what I want - namely (at the moment) rendering tiles and sprites, and managing collisions. It currently does layers (made of tiles) and that's itevilpaul wrote: Don't try to write a re-usable engine - it's hard. If it's the first time then you'll probably realise that it's all wrong a few times before you finish. You run the risk of spending more time developing and trying to maintain the engine than the game itself, and you'll end up getting disillusioned. If your aim is to write a game then write a game, not an engine
I'm wanting to start with a simple Jet Set Willy style platformer, and extend the engine as I go. I've got a detailed spec written up from a few months before I started coding. I needed the routines to do the drawing, so I figured I may as well put them in a re-usable form... Besides, the asset manager util that I'm using uses the same routines for drawing your assets, so it's making writing the tools a lot easier.
Questions are arising, however - I'm currently maintaining two masks per tile/sprite. First there's the RGB data, then the alpha-mask (used to blend the tile/sprite into the current DIB) and then a collision mask. Assume that a sprite is moving at 3 pixels/frame, and I want it to stop when it hits a wall. How do I do that? With a collision mask, the sprite is potentially three pixels deep into the wall when I'm notified that it's hit. I've considered testing collision before actually rendering the collision mask into the collision layer, but that will just tell me that it will collide, and not tell me how many pixels I should move in this frame in order to stop adjacent to the wall.
Anyone got any tips for that? I'm trying to avoid a grid-based system, as sprites can be any size rather than a multiple of say, 16 or 32 pixels. Although the layers themselves are tiled on a grid, the sprites are not.
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
- korruptor
- Baaaaaa!

- Posts: 4291
- Joined: Sun Sep 22, 2002 10:35 am 0
- Location: Under The Northern Lights
- Contact:
Re: Show us yer programming projects!
*checks svn*
Quite a while really. I started a version using the unofficial SDK mid-March and worked on that until mid-June. The first version was ground up using CoreSurface which was loads of fun (I learnt a load) but ended up being bog slow, even though I was really pleased with all my colour layering stuff at the time
I started a new project using OpenGL at the start of August, again, ground up on the ObjC side and added all the front-end, xml-rpc and bits and bobs that weren't in the unofficial version. I managed to port a load of the game logic over without any sweat, but this version has loads more stuff than the original. It saved me a load of time though, so was worth it.
Trickiest thing second time around was proper collision detection. That melted my brain for a good couple of days. That's in the bag for next time though...
I've got a nice skeleton now, so I can pretty quickly get a new project up and running, and I've learnt a lot of ObjC so I'm very sure I could do a lot better job of the UI and score upload stuff on the next project. But it works, it's stable and it does a lot more than I originally planned.
Although I do need to do more digging to get the speed up for the next game.
Quite a while really. I started a version using the unofficial SDK mid-March and worked on that until mid-June. The first version was ground up using CoreSurface which was loads of fun (I learnt a load) but ended up being bog slow, even though I was really pleased with all my colour layering stuff at the time
I started a new project using OpenGL at the start of August, again, ground up on the ObjC side and added all the front-end, xml-rpc and bits and bobs that weren't in the unofficial version. I managed to port a load of the game logic over without any sweat, but this version has loads more stuff than the original. It saved me a load of time though, so was worth it.
Trickiest thing second time around was proper collision detection. That melted my brain for a good couple of days. That's in the bag for next time though...
I've got a nice skeleton now, so I can pretty quickly get a new project up and running, and I've learnt a lot of ObjC so I'm very sure I could do a lot better job of the UI and score upload stuff on the next project. But it works, it's stable and it does a lot more than I originally planned.
Although I do need to do more digging to get the speed up for the next game.
"Don't go into a trance boys..." :: DJ Mixes
- korruptor
- Baaaaaa!

- Posts: 4291
- Joined: Sun Sep 22, 2002 10:35 am 0
- Location: Under The Northern Lights
- Contact:
Re: Show us yer programming projects!
Check out "line intersection examples". This is exactly the thing I struggled with for a while, until I found some nice easy math.Barney wrote: Anyone got any tips for that? I'm trying to avoid a grid-based system, as sprites can be any size rather than a multiple of say, 16 or 32 pixels. Although the layers themselves are tiled on a grid, the sprites are not.
You're basically doing a line intersection check between points A & B, that define the edge of your wall, and points C&D which are the start point of your sprite, and the end point it *wants* to move to. If there's an intersection, you can find exactly where, and just move the sprite that far. I've got C examples if you want them...
Edit: for sprites of any size, I'm just cheating and making walls "bigger" by half a sprite width, as it saves loads of faff and look pretty much spot on
"Don't go into a trance boys..." :: DJ Mixes
Re: Show us yer programming projects!
Tricky - some tiles that act as walls have arbitrary outlineskorruptor wrote: You're basically doing a line intersection check between points A & B, that define the edge of your wall, and points C&D which are the start point of your sprite, and the end point it *wants* to move to. If there's an intersection, you can find exactly where, and just move the sprite that far. I've got C examples if you want them...
I'm working on a system that tests collision before it fills the collision DIB with the sprite's mask - if it collides, then it halves the distance moved, if it still collides, it halves the distance moved... etc.
In practice, this should work quite well - there's only likely to be one or two sprites under player control, and they're the ones that have to test. Other sprites are likely wandering paths under CPU control, and know where the walls are anyway... I agree that this might be a limiting factor in what you can do, but it seems the neatest solution so far. Unless the intersecting lines method can be applied quickly to arbitrary shapes, that is
Like your idea of inflating the sprites' collision mask - that might well work! In fact... inflate the collision mask by up to (say) 8 pixels, each layer denoted by a different colour index in the collision mask. When a collision occurs, you can see if it's smaller or larger than the current velocity, and adjust the position to match if necessary. I wonder if that would work?
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
- korruptor
- Baaaaaa!

- Posts: 4291
- Joined: Sun Sep 22, 2002 10:35 am 0
- Location: Under The Northern Lights
- Contact:
Re: Show us yer programming projects!
Mine's not pixel accurate once I start fudging the sizes a little as I'm working from the center of a sprite, but you could handle arbitrary lines easily enough or move the positions you're checking from, although it's more lines to do the check against.
I'm definitely no expert at this
But now I understand the math I can live with the slight inaccuracy as it's solid no matter how fast the sprite is travelling. Some one will pop in here in a minute and tell us the right way to do it 
I'm definitely no expert at this
"Don't go into a trance boys..." :: DJ Mixes
Re: Show us yer programming projects!
I don't think there is one "right way" to do collision detection - it depends on what you're going to use it for. For example, do you need it to be pixel-perfect, or is "close enough" good enough? Do you want things to bounce realistically (modulus of elasticity and all that crap), or is "just bouncing, doesn't matter if it's off by a degree or two" good enough? Or do things simply stop when they hit walls? etc etckorruptor wrote:Mine's not pixel accurate once I start fudging the sizes a little as I'm working from the center of a sprite, but you could handle arbitrary lines easily enough or move the positions you're checking from, although it's more lines to do the check against.
I'm definitely no expert at this :D But now I understand the math I can live with the slight inaccuracy as it's solid no matter how fast the sprite is travelling. Some one will pop in here in a minute and tell us the right way to do it :D
"massive retard™", "full of shit™", "tiny bitch™", "retarted™", "a bit of a one trick pony™", "petty™", "simple minded idealistic twat™", "miserable humourless fucker™"
- nyarla
- Baaaaaa!

- Posts: 2820
- Joined: Tue Jan 14, 2003 1:53 pm 0
- Location: i said kiss me you're beautiful these are truly the last days
- Contact:
Re: Show us yer programming projects!

shaping up nicely now.
- Orangy Tang
- Baaaaa!

- Posts: 1794
- Joined: Sun Apr 25, 2004 5:25 pm 0
- Location: My secret lab
- Contact:
Re: Show us yer programming projects!
[ Triangular Pixels.net - play Snowman Village, Rescue Squad, NiGHTS 4k and more ] [ Development Journal ]
-
matt
- Sheepie Whore

- Posts: 14826
- Joined: Mon Apr 22, 2002 4:07 pm 0
- XBL Gamertag: gingerbeardman
- PSN: wirehang
- Location: here && there
- Contact:
Re: Show us yer programming projects!
that looks great!
what platform?
what platform?
