Jump to content

Photo

New Prototype - Driving thing


128 replies to this topic

#1 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Sun Aug 23, 2015 11:32 AM

Hi all,

 

Thought i'd share a little progress on a separate prototype i've been playing around with.

 

Only spent a few hours messing around so far, just needed a break from AstroStorm.

 

You can guess from the screenshot what it is.

 

There is no "forward" movement yet, that's probably next.

 

Just use Dpad to move the road direction around to see the road curve and uphill/downhill (this would be automated in a game by the track layout - you would move your car).

 

 

 

 

Attached Files

  • Attached File  road.abs   217.8KB   20 downloads
  • Attached File  road.png   28.87KB   12 downloads

Edited by Sporadic, Sun Aug 23, 2015 11:33 AM.


#2 sh3-rg OFFLINE  

sh3-rg

    River Patroller

  • 3,388 posts
  • doge + tie = dothemath
  • Location:BOLTON, England

Posted Sun Aug 23, 2015 12:47 PM

GGN is going to laugh when he sees this, I showed him this page I was looking at (Lou's Pseudo 3D page) and I was mumbling on about how I'd like to make something like that and how I might go at it.

 

Really impressed, it looks so tidy, I can just imagine the backdrop bobbing to the horizon, feels so slick - you have to keep doing stuff with this, loads of games could be possible once you get it moving.

 

:thumbsup:



#3 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Sun Aug 23, 2015 1:03 PM

GGN is going to laugh when he sees this, I showed him this page I was looking at (Lou's Pseudo 3D page) and I was mumbling on about how I'd like to make something like that and how I might go at it.

 

Really impressed, it looks so tidy, I can just imagine the backdrop bobbing to the horizon, feels so slick - you have to keep doing stuff with this, loads of games could be possible once you get it moving.

 

:thumbsup:

Haha excellent :) Nice coincidence there!

 

I know the page you mention. Ive had something like this running on Android before but I could not think how to go about it in rb+.

 

It's not as quick on the real Jag as the emulator but im sure optimisations can be made. 

 

No clever tricks here. It's a static image, full road with perspective (what you see when you start it up). 

 

There are then 150 1px high sprites which each point to sequentual lines in the image. These simulate scanlines.

 

Before the "game" starts it works out the speed of each line in x and y. The further away it is, the faster it moves.

 

Then in the main loop when you move, it just iterates the 150 sprites and sets the xadd and yadd to that lines speed.

Next frame the speed is zeroed again.

 

There might be more efficient ways but I dont know them lol.



#4 ggn OFFLINE  

ggn

    Stargunner

  • 1,357 posts
  • Location:Athens, Greece

Posted Sun Aug 23, 2015 1:15 PM

Want movement controls NAO!

#5 ggn OFFLINE  

ggn

    Stargunner

  • 1,357 posts
  • Location:Athens, Greece

Posted Sun Aug 23, 2015 1:16 PM

Seriously, totally wicked stuff!

#6 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Sun Aug 23, 2015 1:33 PM

Want moment controls NAO!

Was thinking about switching the CLUT for each scanline to similate movement. Kind of colour cycle it.



#7 sh3-rg OFFLINE  

sh3-rg

    River Patroller

  • 3,388 posts
  • doge + tie = dothemath
  • Location:BOLTON, England

Posted Sun Aug 23, 2015 1:42 PM

Thanks for the explanation, I was going to ask but you already offered it :)

 

Did you try out a chunkier version with double lines at all to half the object count?

 

Was thinking about switching the CLUT for each scanline to similate movement. Kind of colour cycle it.

 

I don't have the experience of you guys when it comes to this stuff, but I know CLUT flipping or colour cycling are cheap and effective :) Before you mentioned that, I was thinking of an animated road texture, having it as an auto-animating raptor object and adjusting the rate of animation to simulate faster and slower speeds... maybe RMotion could help here - it's something I need to look into. but yeah, colour cycling would be much more controllable than that, flipping through CLUTs might work but sort of feels less controllable after a quick thought... loading different sets of 16 into the CLUT sections might also work as a slightly less hassley and more hands-off way of going through the colours... I just make 2x2 sprites for assets.txt to give me a range of colour palettes quickly.

 

Looking forward to see where you take this.



#8 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Sun Aug 23, 2015 1:56 PM

I had thought about doing half the resolution (chunkier scanlines) but was going to fall back on that if too slow.

 

I was also thinking that animating the road could be a way to do it but clut switching might be easier. (I'm no artist) . Depends if it adds much slow down.

The benefit of animating the road would be that it could look textured and the stripy lines could be removed. But I do like the Outrun look :)



#9 sh3-rg OFFLINE  

sh3-rg

    River Patroller

  • 3,388 posts
  • doge + tie = dothemath
  • Location:BOLTON, England

Posted Sun Aug 23, 2015 2:01 PM

Yeah, that stripy road has a great feel to it.



#10 ggn OFFLINE  

ggn

    Stargunner

  • 1,357 posts
  • Location:Athens, Greece

Posted Sun Aug 23, 2015 2:13 PM

Like sh3 mentioned I was actually discussing some methods on how to draw a road and then bam! you land a binary :).

Anyway my guess is that you're probably doing a ton of rsetobj per frame, which gets slow very fast (rsetobj wasn't really built for performance, just a quick and nasty hack left over from the original raptor basic). We came up with two ideas to speed this up:

a) figure out the addresses you want to rsetobj and lpoke them instead (which is a bit hardcore unless you know the inner workings of raptor a bit)
b) write a command that takes an array of values and move them in consecutive objects. For example, want to set the x value of 150 objects? Load them in an array and then pass the pointer to the function, as well as the attribute you want to change and starting object. Something like powarset(pointer to values, start object, offset, no of objects to change).

If b sounds like something that would help you I can fix something up for you.

#11 sh3-rg OFFLINE  

sh3-rg

    River Patroller

  • 3,388 posts
  • doge + tie = dothemath
  • Location:BOLTON, England

Posted Sun Aug 23, 2015 2:30 PM

rsetobj-powarsetfiykt.png



#12 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Sun Aug 23, 2015 3:58 PM

Like sh3 mentioned I was actually discussing some methods on how to draw a road and then bam! you land a binary :).

Anyway my guess is that you're probably doing a ton of rsetobj per frame, which gets slow very fast (rsetobj wasn't really built for performance, just a quick and nasty hack left over from the original raptor basic). We came up with two ideas to speed this up:

a) figure out the addresses you want to rsetobj and lpoke them instead (which is a bit hardcore unless you know the inner workings of raptor a bit)
b) write a command that takes an array of values and move them in consecutive objects. For example, want to set the x value of 150 objects? Load them in an array and then pass the pointer to the function, as well as the attribute you want to change and starting object. Something like powarset(pointer to values, start object, offset, no of objects to change).

If b sounds like something that would help you I can fix something up for you.

That sounds f@#king awesome! I would definately be interested to check that out.

 

As I've said, this is just a mess around at the moment, so no rush or anything.

 

But having said that, I think a POWARSET command would be an excellent addition anyway!



#13 ggn OFFLINE  

ggn

    Stargunner

  • 1,357 posts
  • Location:Athens, Greece

Posted Mon Aug 24, 2015 1:26 AM

That sounds f@#king awesome! I would definately be interested to check that out.
 
As I've said, this is just a mess around at the moment, so no rush or anything.
 
But having said that, I think a POWARSET command would be an excellent addition anyway!


You might want to check latest repository head for powarset(spr_index, offset, no_of_times, array_of_values) (all parameters longwords). Completely untested of course!

[EDIT]Wanted to call the function powaset to save you some typing :P But since sh3 went into the trouble and made a whole pic to illustrate powarset, powarset it is!

P.S. I really don't mind doing some quick hacks like these to people that go into the trouble of doing some stuff and then hit a performance roadblock. So don't be shy to ask for improvements if you see that some things can be done better!

Edited by ggn, Mon Aug 24, 2015 1:36 AM.


#14 CyranoJ ONLINE  

CyranoJ

    Quadrunner

  • 5,320 posts
  • RAPTOR in LOCAL
  • Location:Adelaide, SA

Posted Mon Aug 24, 2015 2:00 AM

Now that is really nice :)

 

Electraglide....  Outrun....  Road Blasters.....  lots of possibilities.  Just don't make Fatal Run 64 or Desert Bus 64!

 

And, again, as ggn said above - likewise if you think RAPTOR needs something.  As long as the person requesting stuff is actually doing something I'll genuinely listen to suggestions.  I won't even entertain things for people asking for more and doing nothing.



#15 CyranoJ ONLINE  

CyranoJ

    Quadrunner

  • 5,320 posts
  • RAPTOR in LOCAL
  • Location:Adelaide, SA

Posted Mon Aug 24, 2015 2:29 AM

Then in the main loop when you move, it just iterates the 150 sprites and sets the xadd and yadd to that lines speed.

Next frame the speed is zeroed again.

 

There might be more efficient ways but I dont know them lol.

 

OK, if you just want to move for one frame, then don't use xadd, yadd at all.

 

Just add/subtract the value from the current x/y position, and remove the code that zeroes the xadd/yadd.

 

[edit]

Actually thinking about it, that might need RGET and RSET...  (Ahhh BASIC, why can't you do the simplest assembler thing without jumping through hoops?)

 

Hmm I suggest an RMODOBJ command that applies a difference to an existing value ;)


Edited by CyranoJ, Mon Aug 24, 2015 2:42 AM.


#16 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Mon Aug 24, 2015 3:17 AM

You might want to check latest repository head for powarset(spr_index, offset, no_of_times, array_of_values) (all parameters longwords). Completely untested of course!

[EDIT]Wanted to call the function powaset to save you some typing :P But since sh3 went into the trouble and made a whole pic to illustrate powarset, powarset it is!

P.S. I really don't mind doing some quick hacks like these to people that go into the trouble of doing some stuff and then hit a performance roadblock. So don't be shy to ask for improvements if you see that some things can be done better!

Excellent!  I will give it a spin, thank you.

 

If I think of anything then I will definitely say, cheers.

Attached Files



#17 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Mon Aug 24, 2015 3:22 AM

Now that is really nice :)

 

Electraglide....  Outrun....  Road Blasters.....  lots of possibilities.  Just don't make Fatal Run 64 or Desert Bus 64!

 

And, again, as ggn said above - likewise if you think RAPTOR needs something.  As long as the person requesting stuff is actually doing something I'll genuinely listen to suggestions.  I won't even entertain things for people asking for more and doing nothing.

 

Point taken, don't use the digits 6 and 4 in the title  lmao

 

Thank you also for the offer, I will let you know if I think of anything.  Probably the only thing i've come up against so far that might help would be to be able to set the origin for scaling operations in the object file.  Sometimes it definitely helps if the origin is the middle of the sprite rather than in a corner.  This way I wouldn't have to work out the new x position after the object is scaled at runtime to keep it central (otherwise it scales out to the right etc).

 

Cheers  :-D


Edited by Sporadic, Mon Aug 24, 2015 3:27 AM.


#18 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Mon Aug 24, 2015 3:26 AM

 

OK, if you just want to move for one frame, then don't use xadd, yadd at all.

 

Just add/subtract the value from the current x/y position, and remove the code that zeroes the xadd/yadd.

 

[edit]

Actually thinking about it, that might need RGET and RSET...  (Ahhh BASIC, why can't you do the simplest assembler thing without jumping through hoops?)

 

Hmm I suggest an RMODOBJ command that applies a difference to an existing value ;)

RMODOBJ isn't a bad thought.  Then we could just say "move left 1.5 pixels".  

 

I used xadd and yadd because in AstroStorm I started off the other way and found things quite jumpy when over 1 pixel.  Some of these road "scanlines" need to move more than 1 pixel in a frame and it just seems smoother.  I will admit, I didn't try just add/subtracting the x/y as you said though.  I could track the line positions in an array, that way I would only need an RSET.  Plus, if using the new function from ggn I could just POWARSET the whole array   :)

 

Will have to play around more.


Edited by Sporadic, Mon Aug 24, 2015 3:28 AM.


#19 ggn OFFLINE  

ggn

    Stargunner

  • 1,357 posts
  • Location:Athens, Greece

Posted Mon Aug 24, 2015 3:27 AM

OK, if you just want to move for one frame, then don't use xadd, yadd at all.
 
Just add/subtract the value from the current x/y position, and remove the code that zeroes the xadd/yadd.
 
[edit]
Actually thinking about it, that might need RGET and RSET...  (Ahhh BASIC, why can't you do the simplest assembler thing without jumping through hoops?)
 
Hmm I suggest an RMODOBJ command that applies a difference to an existing value ;)


Done, although I didn't like the name, so I named it powadiff instead :P.

#20 CyranoJ ONLINE  

CyranoJ

    Quadrunner

  • 5,320 posts
  • RAPTOR in LOCAL
  • Location:Adelaide, SA

Posted Mon Aug 24, 2015 3:31 AM

post-42253-0-60740400-1440407790_thumb.j

 

It actually looks like one does!



#21 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Mon Aug 24, 2015 3:46 AM

Done, although I didn't like the name, so I named it powadiff instead :P.

lmao  love the name.  Going to name all my variables at work today starting with Powa...

 

You are a machine, thank you  :-o



#22 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Mon Aug 24, 2015 6:46 AM

You might want to check latest repository head for powarset(spr_index, offset, no_of_times, array_of_values) (all parameters longwords). Completely untested of course!

Hi,

 

I just tried to give these 2 new commands a go and get a build error.

Translating .bas file to C... 
 
Compiling C code... 
C:\Rik\basic\PROJECTS\road\build\road.C: In function 'void basicmain()':
C:\Rik\basic\PROJECTS\road\build\road.C:206:46: error: 'powadiff' was not declared in this scope
Build error! 
Translating .bas file to C... 
 
Compiling C code... 
C:\Rik\basic\PROJECTS\road\build\road.C: In function 'void basicmain()':
C:\Rik\basic\PROJECTS\road\build\road.C:206:46: error: 'powarset' was not declared in this scope
Build error! 

I copied my project folder into the new basic\projects from the latest version.  I then copied a rapapp.s out of an existing example (not one of the failing ones) and into my project folder.

 

I'm calling it like this;

powarset(startline, R_sprite_xadd, 150, xpos)

and have also tried;

powarset(startline, R_sprite_xadd, 150, *xpos)

where startline is an int pointing to the first sprite and xpos is an array[150] of ints.  I wasn't sure how to pass the pointer for the array of values to the new commands, I tried both the above.  Not sure if that's related to it not compiling.

 

Thanks



#23 ggn OFFLINE  

ggn

    Stargunner

  • 1,357 posts
  • Location:Athens, Greece

Posted Mon Aug 24, 2015 7:18 AM

Did you copy rbasic.h from the include folder too?

#24 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Mon Aug 24, 2015 9:01 AM

Did you copy rbasic.h from the include folder too?

I copied my project into the new rb+ download. Then copied the rapapp.s from one of the tutorials into my project.  So it should have been using the include fokder fron the git download.

I will double check though. 



#25 Sporadic OFFLINE  

Sporadic

    Moonsweeper

  • Topic Starter
  • 490 posts
  • Probably RB+ing
  • Location:UK

Posted Mon Aug 24, 2015 9:11 AM

Did you copy rbasic.h from the include folder too?

ok, might be my bad.  I just checked the rbasic.h in my basic folder and its the 1.2 version (not today's master one). 

 

So I think I downloaded master, came across the 3 non-compiling projects, changed to 1.2 to test that, still found the 3 non-compiling projects, reported to you, then tried the new powa commands.

 

Forgetting to go back to master!!!!

 

So i'm sorry, looks like my issue.  I've not retested yet, but my rbasic.h looks correct now.

 

Cheers


Edited by Sporadic, Mon Aug 24, 2015 9:12 AM.

  • ggn likes this



Reply to this topic



  


0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users