Jump to content

Photo

my start with RB+ - barbarian project- need help


56 replies to this topic

#26 ggn OFFLINE  

ggn

    Stargunner

  • 1,240 posts
  • Location:Athens, Greece

Posted Thu Nov 9, 2017 1:45 AM

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!
  • F.L likes this

#27 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Thu Nov 9, 2017 2:00 AM

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 ! ;)

#28 Sporadic OFFLINE  

Sporadic

    Moonsweeper

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

Posted Thu Nov 9, 2017 2:03 AM

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, Thu Nov 9, 2017 2:03 AM.


#29 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Thu Nov 9, 2017 4:46 PM

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 ?



#30 sh3-rg OFFLINE  

sh3-rg

    River Patroller

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

Posted Thu Nov 9, 2017 4:56 PM

 

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, Thu Nov 9, 2017 4:57 PM.


#31 ggn OFFLINE  

ggn

    Stargunner

  • 1,240 posts
  • Location:Athens, Greece

Posted Fri Nov 10, 2017 12:41 AM

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.

#32 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Fri Nov 10, 2017 8:16 AM

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, Fri Nov 10, 2017 8:38 AM.


#33 Shamus ONLINE  

Shamus

    Dragonstomper

  • 618 posts
  • Moo, er, Roar!
  • Location:Ur-th

Posted Fri Nov 10, 2017 9:35 AM

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



#34 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Fri Nov 10, 2017 5:54 PM

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, Fri Nov 10, 2017 5:54 PM.


#35 ggn OFFLINE  

ggn

    Stargunner

  • 1,240 posts
  • Location:Athens, Greece

Posted Sat Nov 11, 2017 2:44 AM

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 :).

Attached Files


Edited by ggn, Sat Nov 11, 2017 10:21 AM.


#36 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Sat Nov 11, 2017 8:08 AM

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 :)

#37 CyranoJ OFFLINE  

CyranoJ

    River Patroller

  • 4,843 posts
  • RAPTOR in LOCAL
  • Location:Adelaide, SA

Posted Sat Nov 11, 2017 8:35 AM

 

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.



#38 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Sat Nov 11, 2017 12:56 PM

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, Sat Nov 11, 2017 12:57 PM.


#39 ggn OFFLINE  

ggn

    Stargunner

  • 1,240 posts
  • Location:Athens, Greece

Posted Sat Nov 11, 2017 1:20 PM

A very big thanks to all your help


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

#40 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Sun Nov 12, 2017 3:24 AM

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, Sun Nov 12, 2017 3:43 AM.


#41 Welshworrier OFFLINE  

Welshworrier

    Chopper Commander

  • 191 posts

Posted Sun Nov 12, 2017 4:05 AM

It's a long declaration, so allocating 32 bits per element. Your image is 16 bits per element so you require half the amount.
  • F.L likes this

#42 ggn OFFLINE  

ggn

    Stargunner

  • 1,240 posts
  • Location:Athens, Greece

Posted Sun Nov 12, 2017 4:29 AM

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 :).

#43 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Sun Nov 12, 2017 4:30 AM

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


  • ggn likes this

#44 sh3-rg OFFLINE  

sh3-rg

    River Patroller

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

Posted Sun Nov 12, 2017 6:41 AM

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.



#45 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Sun Nov 12, 2017 12:23 PM

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



#46 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Wed Nov 15, 2017 4:10 PM

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, Wed Nov 15, 2017 4:13 PM.


#47 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Sun Nov 19, 2017 3:36 PM

hello

the dev is in good way

all the animations are available (some little sprites are missing) and i must down the speed of the game

i have done a video of the source and the build of the new beta rom

 

 

 


Edited by F.L, Sun Nov 19, 2017 3:42 PM.


#48 Sporadic OFFLINE  

Sporadic

    Moonsweeper

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

Posted Sun Nov 19, 2017 3:45 PM

Looking great! Good job :)


  • F.L likes this

#49 CyranoJ OFFLINE  

CyranoJ

    River Patroller

  • 4,843 posts
  • RAPTOR in LOCAL
  • Location:Adelaide, SA

Posted Sun Nov 19, 2017 4:48 PM

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



#50 F.L OFFLINE  

F.L

    Space Invader

  • Topic Starter
  • 42 posts
  • Location:France

Posted Mon Nov 20, 2017 4:41 PM

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:





Reply to this topic



  


0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users