• Portal Prelude 5 1
Currently:  

Author Topic: Portal Prelude  (Read 254332 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Portal X
« Reply #135 on: April 10, 2010, 02:12:24 pm »
Mhmm seems like a good deal :) Make sure the slow one is signifiantly slower too, like, 3x slower or something like that, so we distinguish them easier

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #136 on: April 10, 2010, 02:14:34 pm »
I have it as 4 times slower, and it is looking good ^^

SirCmpwn

  • Guest
Re: Portal X
« Reply #137 on: April 10, 2010, 02:15:36 pm »
Screen?

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #138 on: April 10, 2010, 02:16:56 pm »
Haha soon :P let me just get it up really quick...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Portal X
« Reply #139 on: April 10, 2010, 02:17:20 pm »
I have it as 4 times slower, and it is looking good ^^
Ok seems fine ^^


Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #140 on: April 12, 2010, 12:53:51 pm »
Hmmmm divisions are very slow, and all these divisons by 5 are killing me for collision.  Any way to make them faster?  Or should i think about converting the map size into 4x4 of 8x8?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Portal X
« Reply #141 on: April 12, 2010, 01:54:45 pm »
That sucks x.x, is there a way to maybe adapt the engine for division by 4 or 8 so you can do /2/2/2? I assume this would probably require heavy modification, though x.x. Don't use 8x8 sprites, tho.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Portal X
« Reply #142 on: April 12, 2010, 02:33:58 pm »
When you do this:

{E/5*16+(D/5)+L4}

You can do half as many divisions by combining them first then dividing:

{E*16+D/5+L4}

Depends on how big E is already though, if its always less than 4096 then you can.

EDIT:hmm... I'm actually not sure now it will work, you might have to add a constant somewhere since it needs to be an exact number.
« Last Edit: April 12, 2010, 02:37:25 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Portal X
« Reply #143 on: April 12, 2010, 02:36:41 pm »
When you do this:

{E/5*16+(D/5)+L4}

You can do half as many divisions by combining them first then dividing:

{E*16+D/5+L4}

Depends on how big E is already though, if its always less than 4096 then you can.
Mmm, I don't think that would work, since E/5*16 and E*16/5 will give different results due to truncation
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #144 on: April 12, 2010, 02:59:56 pm »
Yeah i tried that a while back and it doesnt work :( for reasons calc84 understands.  Do you think there is any way around dividing directly by 5?  Maybe involving multiplication and bit shifts?  Or should i try to convert everything to 4x4?
« Last Edit: April 12, 2010, 03:06:33 pm by Builderboy »

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Portal X
« Reply #145 on: April 12, 2010, 03:13:37 pm »
Hmm, if you are doing D/5 and E/5 a lot, you could calculate each of them once and store to temporary vars, perhaps?
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Portal X
« Reply #146 on: April 12, 2010, 03:16:21 pm »
What are you doing exactly that requires so much speed?  Maybe its the method you're using that can be optimized.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #147 on: April 12, 2010, 03:28:21 pm »
Well, that piece of code that Quigibo posted is the heart of my tilemap detection.  It takes a coordinate on screen and finds the tile that it resides in.  Since its used in collision code, that means its called many times each frame, and all with unique values.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Portal X
« Reply #148 on: April 12, 2010, 03:38:02 pm »
Maybe, then, it would be possible to use a power of 2 as your internal coordinate factor (such as 8), and then multiply by 5/8 to get the onscreen coordinates
« Last Edit: April 12, 2010, 03:38:18 pm by calc84maniac »
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #149 on: April 12, 2010, 05:53:38 pm »
Hmmmm but then it becomes tricky to move any object by a single pixel, since your coordinate plane is not evenly divided.  I think i have a way to make it work however by storing the tile data in a different way.  It will take up a tiny bit more memory, but it should not be too bad.

EDIT: Okay 4x4 tiles is officialy not going to work.  After a quick conversion i realized that while the tiles are smaller, it actually leaves me less room to make maps, since corridor would need to be 2 tiles wide (since the character is 5 pixels wide, and it will not be changed).  SO that means that i will try to use Calc84's option, but i will have to write a separate collision sub for the portal gun, which needs to be able to move pixel by pixel.  With so many more objects being added, such as boxes, plasma balls, and other collision things, there is going to be a lot of collision, and therefore it needs to be as fast as possible.
« Last Edit: April 12, 2010, 07:06:17 pm by Builderboy »