It is currently Wed Jan 16, 2019 12:39 am

 All times are UTC - 7 hours

 Page 2 of 2 [ 16 posts ] Go to page Previous  1, 2
 Print view Previous topic | Next topic
Author Message
 Post subject: Re: Erratic enemy movement?Posted: Mon May 28, 2018 12:45 pm

Joined: Thu Jul 23, 2015 7:54 pm
Posts: 183
Location: USA
thefox wrote:
Sogona wrote:
For flying enemies, I was also thinking about trying polar coordinates to achieve some interesting flying patterns. Just having a variable for angle and radius. The only real issue with this is that you’d need subpixels for it to look good at all, and that’d make the look up table for conversion huge.

I don't understand why you'd need a huge lookup table for this.
You’re right, actually. I’d thought about it a while back and figured out I’d only need 64 values for 0-pi/2 radians and can combine sine and cosine since they’re essentially the same; like Tepples pointed out. I’d just forgotten about these tricks. And using 16-bit values for subpixel precision would only be 128 bytes. So I guess that isn’t too bad.

tepples wrote:
You'd need maybe a 64-entry cosine table, but then you'd need to multiply that by the speed to get the rectangular velocity. An 8-bit by 8-bit multiply takes a scanline and a half unless you do it through a quarter square lookup table.
I’d want speed and final cartesian positions to be 16-bit. I haven’t really looked into 6502 implementations for multiplication/division. Are there any 16*16->16 where the result is just rolled over if it exceeded 65,535? I’d guess this would take a bigger performance hit unless there are other tricks I don’t know about.

I also couldn’t decide if I wanted to just leave the screen coordinates as they were (leave (0,0) as the origin and have Y go downward as it increases) or add 128 to X and Y and then negate Y to try and “fake” cartesian space.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 2 of 2 [ 16 posts ] Go to page Previous  1, 2

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 3 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki