News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ervin

Chunky Pixel Collision

Started by ervin, 15:35, 15 December 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Optimus

Wow! I loved reading this thread from the beginning till this point.
First of all the very constructive programming discussion. The improvement, the impressive examples.
I also see some new coders on the CPC working on projects with a good spirit for optimize and experimentation.
I wouldn't have discovered these attempts if I kept reading some other CPC forums only. I guess it would be nice to visit more frequently cpcwiki forum :)


Now that would be a very nice engine for space harrier style game. With so many zoomed big sprites I wouldn't mind even if this game was running at 6fps. It would still be impressive. About the precalced zooming sprites it's a good idea. Because the graphics screen is of bigger pixels one could store few different zooming levels of the same sprite in much less memory used. It's a good idea and the realtime zoom would be much slower. I was thinking about this and I think I had seen some example C64 preview game with zooming fullscreen sprites like this but I can't find it (it wasn't a known one but it impressed me at the time).


Every trick here is nice, starting with the classic use of PUSH and POP to write/read data fast, SET/RES techniques to move to next line (a trick I haven't considered before (my mistake), but proved great in my recent wolfenstein wall column rendering engine, oh I also jump to arbitary line so that I only do one SET or RES per line at best) and the technique to split in 8 blocks is marvelous. Definitelly this thread is a nice set of ideas if I want to make something similar in the future or for any other sprite ideas.


Good luck with the rest of the project. I'll be watching the wikiforums more frequently I think.

ervin

#76
Thanks for the kind words Optimus!
I was VERY impressed by your raycasting engine, by the way.

It will indeed be a Space Harrier style game, at least in the game's viewpoint.
But it won't be a shooter.

At the moment I'm struggling with creating a 3d road.
I'm getting there, bit by bit, but as with everything coded so far, I'm stumbling across ideas and tricks along the way, and that takes a bit of time.  :(

But if I can replicate the 3d road in my brain into something on the cpc, I reckon it'll look pretty cool.
Then it'll be time to see if my theories about the scaled sprites will work...

Regarding the c64 game, I wonder if you could have been thinking of something by Chris Butler.
His work was phenomenal. Space Harrier, Thunderblade, the magnificent Powerdrift and of course Turbo Charge.
He was a bit of a genius.

This is an interesting article about his work:
http://www.mayhem64.co.uk/butler.htm

His amazing work with the c64 has been one of the main inspirations behind my little project.  8)

[EDIT] I think I may have figured out a very efficient technique for a 3d road! With hills! I'm very excited by it, as it seems very doable. No code yet, as I'm still thinking through the technique.

Anyone else often solve programming problems in the shower, or while stuck in traffic?

ervin

#77
Woohoo! Something worth reporting!

I've been working on a hill algorithm since my last post, and it has been really difficult.  :(
I've been through a number of ideas and algorithms, and I've finally found one which works.  8)

At the moment it only exists in a side-view scrolling line, representing each "piece" of road that will eventually be drawn in the familiary into-the-screen style. It has allowed me to mess with hills and also with the tilting of the view, in order to get a feel for how it should all fit together. The road pieces also change colour, to simulate the colour cycling that was common for 3d roads back in the day.

It's all data-driven, which means it should be fairly easy to generate roads in-game (well, at the start of a level), when I get to that stage. Hopefully soon...

Even in it's current unoptimised state, it runs quickly, so I have high hopes for a very efficient 3d road routine.

sigh

I would just love to see this in action.

ervin

#79
Do you mean the road hills prototype?
Or the 3D road?

I can show you the prototype once I fix a little bug, but the 3D road will take a bit longer.  :-[
(It ain't pretty though... it is purely functional)!

sigh

Any of those would be great to see just to get an idea of how well it's working and whats achievable.

ervin

Alrighty, hopefully I have something presentable very soon!  :) 

redbox

Quote from: ervin on 10:33, 26 February 11
Alrighty, hopefully I have something presentable very soon!  :)


Yay, am really looking forward to this.

ervin

Man, this 3d road thing is driving me nuts!
I'm probably being too ambitious, but I have a vision in my head that I want to see through to fruition.
I will keep going until I figure it out!

Gryzor

Crossing fingers... I guess we're all behind you :)

sigh

Quote from: ervin on 15:41, 13 March 11
Man, this 3d road thing is driving me nuts!
I'm probably being too ambitious, but I have a vision in my head that I want to see through to fruition.
I will keep going until I figure it out!

Sending you positive programming energy.

TFM

Quote from: sigh on 00:19, 14 March 11
Sending you positive programming energy.

Me too!  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

ervin


ervin

Alrighty!

It looks like all that positive energy worked, because I think I've FINALLY figured out a good method for creating a road on the fly!

Once again, the idea came to me when I was away from the keyboard. Funny how that sort of thing happens.

I have 13 different road segment designs, and they can be combined in all sorts of ways to create a road with all sorts of heaving and lurching going on.

Please be aware that this is not a 3D road yet - it is simply a side-on view representing the data flowing through the "road queue". That data will be converted into a 3D road soon, with any luck.

I also need to implement view tilting, which will be represented in the 2D view as the relevant bits of road moving up and down.

If you're wondering why only the centre of the screen is being drawn to, it's because my road will be comprised of 30 segments going off into the distance, and the 2D view displays 30 chunky pixels.

If you want to see the 2D view in action, please load up the attached cpc4.dsk in your emulator of choice, and RUN"CPCROAD"

You'll be able to choose which of the 13 segments to view; simply type in a number from 0 to 12 and press Enter. The road segment will then be created and shown to you. Entering 0 will give you a flat road segment.

Segments have a variable length, calculated randomly (with some bounds placed on them).

Also, the hills/dips have random steepness (there are 15 different steepnesses (is that a real word?) for the program to choose from). The result is a very dynamic road.

When I finally get to put it in the game, I'll probably have to limit the severity of hills/dips during the earlier levels, and ramp it up (pardon the pun) on higher levels.

Now, I'll get back to work on the tilting routines!

Gryzor

Wow. Lines. Lines are good. I love lines.

Just kidding :D

ervin

Hahahaha.  :laugh:

In time, these lines will develop into a fully operational battle station!

No, hang on, that's not right.

They will develop into a 3D space laneway thingy!
Yes indeed.

TFM

 ;D  I'm sure they do! And what we see now is already amazing! I like it! ;D
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

redbox

I think I can just about see how you're going to do this...  ;)

ervin

Quote from: redbox on 11:36, 31 March 11
I think I can just about see how you're going to do this...  ;)

Ooh! Do tell!
I'm interested to know what you are thinking.

Incidentally, I've got the tilting working to some extent now, but there are still errors.  :'(

sigh

That was very interesting (and smooth). I'm looking forward to seeing the 3D version as it's hard to picture at the moment.

sigh

Anymore progress on this?

ervin

Hi there.

Yes indeed, progress continues, with work being done on it almost every day.

The road code needed to be totally rewritten, as it was wrong, quite frankly.
No matter what I did, I couldn't figure out how to make the view "tilt" when going up or down hills.
After studying HEAPS of videos of old racing games (Outrun, Lotus, Chase HQ etc etc etc...) it finally dawned on me that I don't need to tilt the view, as none of those games did. It was all an illusion!

So I completely rewrote the code, and now it works beautifully, creating a random road in real-time, from about a dozen segment types. I've begun work on displaying it in 3D, but there's still much to do. The road stripes are working nicely though.  :)

I've also taken a detour to revisit the giant Savage sprite.
I'm not happy with the amount of memory he takes up, so I'm working on a version of him that stores colour data in a much more efficient format, but of course this requires a rewrite of the sprite processing code.  :o

I looked at messing with the CRTC to repeat 4 pixel lines for my fat pixels, instead of doing them in software.
But I just couldn't figure out how to make it work in a real-time game, where the amount of time or clock cycles between each frame can vary dramatically. So I had to shelve that idea.  :(

Bryce

Getting the road to look like it's tilting isn't very difficult. The normal "triangle" road that's usually used to give the 3D effect has straight sides. Curving the two lines inwards gives the road an uphill or downhill curvature and bulging the lines outwards will give the effect of going over the cresent of the hill. Not sure how you'd achieve this in software (not my strong point), but maybe a variable could be used to determine the amount of curvature in your drawing routine, with a table of values to define the inclination for each part of the course?

Below is my badly drawn example, showing 1) straight road, 2) Road curving up or down 3) Cresent of hill. (Yup, I can't draw either :) )

Bryce.

arnoldemu

OUT &BC00,9:OUT &BD00,3
OUT &BC00,0:OUT &BD00,127

it may not work on all monitors, modulators etc
but it can give an 8k screen
problem: every other line is border colour

but it's a crazy idea and may help?

you asked for crazy ideas?

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

ervin

Thanks for the tips/ideas Bryce and Kev.
Any ideas are worth considering!

Powered by SMFPacks Menu Editor Mod