Jump to content
F.L

my start with RB+ - barbarian project- need help

Recommended Posts

The first object in rapinit.s is called "text/particle layer" for a reason :). All print commands actually write to that layer. As long as you have that layer active you'll get transparent text on screen. If for some reason you don't want to use that mechanism you'll have to write your own text printing functions that write on other objects.... which is not really recommended :)

 

So the question is: does print not work for you with the 4 scenarios? Does it work for 1 only and not for the rest? More details please!

  • Like 1

Share this post


Link to post
Share on other sites

Ok !

Yes it's for the 4 scenaries : to write the score of players and the time of each round.

I must remember everithing is a sprite with jaguar

I have an idea. I will make a "hole" at the right place in the 4 scenaries for seeing the text ! ;)

Share this post


Link to post
Share on other sites

You can move the particle text layer to the bottom of the list. Then the text will appear above everything else. You must make sure you have an active object at the top though.

Edited by Sporadic
  • Like 4

Share this post


Link to post
Share on other sites

You can move the particle text layer to the bottom of the list. Then the text will appear above everything else. You must make sure you have an active object at the top though.

 

in rapinit i have moved particle text layer behind my first scenary and now i can write on it, thanks. but i have a problem with the 3 others....

 

Well you could define all the sprites as raptor objects but as you say it'll be a LOT of work! Also it will slow down raptor processing a bit, and we can't have that!

 

One way to slow down your animations is to change the sprite_animspd property (either in rapinit.s or at runtime). This will make the animation slow down by frames. So if your screen displays at 60fps then you can make your animation run at 30fps, 15fps and so on. But that won't work if you want your animation to update at, say, 40fps.

 

So here's another way of doing this. Here's a spritesheet from nyandodge, zoomed up x4:

 

attachicon.gif_nyancat.png

 

Each frame is 32 pixels wide by 11 pixels high. We can use this to our advantage! If you know the address of the first frame it's very easy to find the address of the second. Basically you need to add height * ( width * no_of_bits_per_pixel ) / 8 to your address. So in the above example our picture is 4 bits per pixel so we need to add 11*(32*4)/8=176 bytes. The third frame is then 176*2 bytes from the start, etc etc. So you can keep a frame counter and when it reaches 40 calculate and set the sprite's gfxbase and set it using rsetobj (or rlist which is recommended).

 

Hope I didn't screw up the maths above and that it helps you :)

 

i am still stuck on the adress of the second frame of a sprite sheet....

for the example nyancat, each frame is 176 bytes

so if i want to display the second frame of the nyancat, i must do

 

DIM frame1%

frame1=RGETOBJ(1,R_sprite_gfxbase)

rsetobj(1,R_sprite_gfxbase,frame1+(176) )

 

it is correct ?

for my 4 background, i want to use a sprite sheet.it is a good idea ?

each frame is 320*200. in rapinit i load an image of 320*800

each frame does 200*(320*4)/8 = 32000 bytes

but when i do +(32000) to my background , it makes glitches...at screen ???

i must have not understand something....

it is a better idea to swap my 4 background ?

Share this post


Link to post
Share on other sites

 

it is correct ?

for my 4 background, i want to use a sprite sheet.it is a good idea ?

each frame is 320*200. in rapinit i load an image of 320*800

each frame does 200*(320*4)/8 = 32000 bytes

but when i do +(32000) to my background , it makes glitches...at screen ???

i must have not understand something....

it is a better idea to swap my 4 background ?

Edited by sh3-rg

Share this post


Link to post
Share on other sites

i am still stuck on the adress of the second frame of a sprite sheet....

for the example nyancat, each frame is 176 bytes

so if i want to display the second frame of the nyancat, i must do

 

DIM frame1%

frame1=RGETOBJ(1,R_sprite_gfxbase)

rsetobj(1,R_sprite_gfxbase,frame1+(176) )

 

it is correct ?

I just tested the following in nyandodge:

 

- In rapinit.s change sprite_maxframe to 0 in the player's sprite

- In nyandodge.bas add the following lines outside the main loop:

dim frameno as int
frameno=0
- Inside the main loop (immediately after the DO instruction) add the following lines:

    frameno=(frameno+1) band 7
    rsetobj(1,R_sprite_gfxbase,(int)strptr(BMP_PLAYER)+176*frameno)
And that gives me control over the animation. Notice the (int)strptr() in there - that gives the address of the object.

 

for my 4 background, i want to use a sprite sheet.it is a good idea ?

each frame is 320*200. in rapinit i load an image of 320*800

each frame does 200*(320*4)/8 = 32000 bytes

but when i do +(32000) to my background , it makes glitches...at screen ???

i must have not understand something....

it is a better idea to swap my 4 background ?

Well, there are glitches and there are glitches :), so what do you mean when you say "glitches"?

 

I'm not sure if using a spritesheet for your backgrounds is a good idea - your backgrounds are 320x200 and the viewscreen can be 320x240 or 320x256. So I would guess that if you place the object on screen you'd see some lines from other maps as well! So probably 4 different objects that have their active attributes changed is probably better.

  • Like 3

Share this post


Link to post
Share on other sites

yes, differents objects with active attributes is better. i have done this first time.

but i cant write on them.

i have moved particle/text layer after them and i can write on only the scenary just before the text layer,

and the other scenaries before this one are not visible... it's strange

 

something strange too, the position of my text is not the same if i launch the rom with project tempest or virtual jaguar

project tempest is 4 pixels bottom

wich emulator is 100% working like the real hardware ?

Edited by F.L

Share this post


Link to post
Share on other sites

No emulator works 100% like real hardware, but VJ (for all its faults, which are many) is closer than PT IMNSHO. :)

  • Like 2

Share this post


Link to post
Share on other sites

hello

 

good news ! i have understand how to manage the adress of a spritesheet and it works good :thumbsup:

i have updated the zip, now all the background and their trees are displayed like this !

 

bad news : despite all my efforts, i dont become to write text of my background...

like sporadic have said to me, i moved the text layer, but it seems it works if only one simply background is before.

if a spritesheet is before, or if i swap the gfx_base, there are glitches on the screen..?

 

so, for writing my text, i have open an hole in my backgrounds. its not beautiful but and it works too ;)

enough coding for tonight

 

good night :sleep:

Edited by F.L
  • Like 1

Share this post


Link to post
Share on other sites

Ok, so I spent a little time with your problem so here's my solution: this sets the 4 backdrops as objects 0-3, the text layer in object 4 and flips between the backdrops. The easiest way to make an object disappear that I could think about is to set its y coordinate to some high value. So I set the invisible objects to (0,700) and the visible ones to (0,16). This is really not a big performance hit on the OP because it simply checks the current scanline number it draws with the y coordinate of each object. Since it goes from 0 to 255 (roughly) the invisible objects aren't processed after a small check.

 

Anyway, hope this helps you :).

background.zip

Edited by ggn
  • Like 4

Share this post


Link to post
Share on other sites

Ok, i will try this !

A very big thanks to all your help, if i do cartridges of the game, i will give you one :)

  • Like 2

Share this post


Link to post
Share on other sites

 

it is correct ?

for my 4 background, i want to use a sprite sheet.it is a good idea ?

each frame is 320*200. in rapinit i load an image of 320*800

each frame does 200*(320*4)/8 = 32000 bytes

but when i do +(32000) to my background , it makes glitches...at screen ???

 

Can you post the spritesheet and a screenshot of it glitched, because a single object and changing the gfxbase should work.

  • Like 3

Share this post


Link to post
Share on other sites

Yes it works like this.

In my rom you can see it.

The glitches came from the moving of text layer

Today i have no time to test the code of ggn, maybe tomorrow

Edited by F.L

Share this post


Link to post
Share on other sites

A very big thanks to all your help

Hey, if there not many customers, there is better support :)

  • Like 2

Share this post


Link to post
Share on other sites

i have tried your background example, i like when an example is clear like that, i understand quicklly !

i will use that for my next update of the rom

in my precedent release, i was using the same method than you for hiding my backgrounds, exept that i did x =400

maybe it was not a good method than y=700 for the hardware and it does the glitches..?

 

edit :

in your example your pictures are 320*200 but why you did in rapinit :

dc.l 160*200 ; sprite_framesz
dc.l 160 ; sprite_bytewid

and it display an image of 320*200 at screen ?.... i dont understand something :?

Edited by F.L
  • Like 2
  • Sad 1

Share this post


Link to post
Share on other sites

dc.l 160 ; sprite_bytewid

 

My pictures are 4 bits per pixel and 320 pixels width. So the amount of bytes per line is (320 (pixels) * 4 (bits/pixel) ) / 8 (bits/byte) = 160 bytes.

 

dc.l 160*200 ; sprite_framesz

 

If you understand the above, then this is easy, 160 bytes per line * 200 lines = 32000 bytes. Also if I remember correctly this variable is only used when animating sprites so it wouldn't matter even if I set it to a wrong value :).

  • Like 2

Share this post


Link to post
Share on other sites

ok, i was declaring 2x and maybe it was because of that it was not working! :thumbsup:

  • Like 1

Share this post


Link to post
Share on other sites

in my precedent release, i was using the same method than you for hiding my backgrounds, exept that i did x =400

maybe it was not a good method than y=700 for the hardware and it does the glitches..?

 

IIRC, when you're sending stuff off screen to not be displayed, it's best to use y as it'll be culled from the object list. If you use x, it'll still factor into calculations each life buffer pass it is present on in y. Also, think there's a danger it will reappear back on the other side of the screen.

Share this post


Link to post
Share on other sites

hello its me again

with your help those days, i have done new important update of the rom ;-) :thumbsup:

try it, you will see what's new :

the 4 scenaries and their trees are here and i can write on them ;)

i have done the animation of the goblin with a sprite sheet .

this is the most difficult animation of this game to reproduce and it works fine

now, i have all i need to do the game (exept the sound) :grin:

this week i will begin the animation of players. there is 63 animations to do.
i think it will take me a few days (weeks ?) . with those animations, the rom will quickly seems like a real game

i will gave you some news of the advancement

see ya

  • Like 7

Share this post


Link to post
Share on other sites

hello

i have found a new method to manage my spritesheet, so the work is in good advancement but i must rename many values

now 6 animations are soon active in the beta rom

i'm happy because the animation is fluid. for the moment ,it's the most fluid animation i've done on a game console. the jaguar is very powerful !! :thumbsup:

only 49 to do ;)

see ya

Edited by F.L
  • Like 4

Share this post


Link to post
Share on other sites

Awesome! What's better than one Barbarian on the Jaguar? Two Barbarians on the Jaguar!

 

and why not 7 barbarians on jaguar ;)

with my engine, it will be easy to do all the others.

one thing could be more cool : to have all the 7 versions in only one rom! :thumbsup:

but for the moment i will finish this one...and there is work to do :grin:

  • Like 5

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...