Author Topic: Best approach for building a layer  (Read 15679 times)

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Best approach for building a layer
« Reply #15 on: 2009-09-01, 10:41:57 AM »
Wow!  I followed your advice bluemonkmn and with a good cleanup of the unused collision masks, it's definitely way faster to load the game!

Thanks! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: Best approach for building a layer
« Reply #16 on: 2009-09-01, 10:48:46 AM »
do you have an updated copy up?
Looking to the skies.....

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Best approach for building a layer
« Reply #17 on: 2009-09-01, 11:29:27 AM »
I just uploaded an updated version if you want to take a look at it SmartBoy16. :)  Just waiting for bluemonkmn to approve it. :)

If you want to try the stuff that is in the test room, just launch the game as is.  If you want to see the level I am presently building (the reason of this thread), change the start-up map for "VMEntrance".

Can't wait to hear your comments!  ;D
« Last Edit: 2009-09-01, 12:03:01 PM by Vincent »
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Best approach for building a layer
« Reply #18 on: 2009-09-01, 12:00:46 PM »
Approved

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: Best approach for building a layer
« Reply #19 on: 2009-09-01, 05:53:46 PM »
oh no! i think my computer hates your game because i get this error (unless im not doing something right)

this is only during debug mode. in run mode i get a "simpler" error
Looking to the skies.....

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Best approach for building a layer
« Reply #20 on: 2009-09-01, 08:15:44 PM »
Huh? That's weird...

Bluemonkmn, could this be related to some fonctions that have not been moved to partial classes?
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: Best approach for building a layer
« Reply #21 on: 2009-09-02, 12:26:15 AM »
Same error as smartboy16.


bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Best approach for building a layer
« Reply #22 on: 2009-09-02, 05:04:35 AM »
I think it's from textures that are too big for your video card.  If the code is re-organized so that it can be reset without breaking the project, I think you can get a better error message (or just use the new version of display.cs, which probably wasn't customized).  If the graphic sheet sizes are reduced to fit in 1024x1024, then I think the game will work for more people.

This shouldn't be a big deal because 1) there are many unused graphic sheet cells; 2) many are much bigger than they need to be; 3) you can combine multiple graphic sheets into 1 frameset.

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: Best approach for building a layer
« Reply #23 on: 2009-09-03, 12:57:32 AM »
I don't think it's due to the textures being too large for the video card because I have a hd4890 with 1GB of memory. >.>


EDIT://

Quote
Max Texture Width 8192 px
Max Texture Height 8192 px

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Best approach for building a layer
« Reply #24 on: 2009-09-03, 05:01:01 AM »
If I can persuade you to install Visual C# Express (if you haven't already) and run the generated project (vcproj) from in that environment, you might be able to narrow down the problem.  If you get the debug version of OpenTK and replace the delivered version of OpenTK with that, it will check for errors after every step and should give a better error message or at least stop at the right location (if you press Ctrl-Alt-E in the C# environment and check the box to break whenever a Common Language Runtime exception is thrown).

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Best approach for building a layer
« Reply #25 on: 2009-09-03, 07:20:48 AM »
I would really like to know what the problem could be...

Btw, I transferred most of the code I added to partial classes.  But I'm not sure how I could transfer some of the modifications I made into partial classes.  I didn't simply add some functions, some times, I modified existing functions, etc.  Do you have a suggestion bluemonkmn?  Could I, somehow, override a function that is into the source code by another one in the partial classes I added and make sure my version of the function is the one that is called?

Thanks! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Best approach for building a layer
« Reply #26 on: 2009-09-03, 01:13:27 PM »
I've got a quick question about collision masks!  Setting the collision mask at 0 is better because the game doesn't calculate the collision for each pixel in the image.  If you want to make a sprite without collisions, is it better to set a collision mask of 255 rather than any other mask?  So, is 255 considered no collision or does the program calculates each pixel anyway?

Thanks! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Best approach for building a layer
« Reply #27 on: 2009-09-03, 04:55:02 PM »
I would really like to know what the problem could be...

Btw, I transferred most of the code I added to partial classes.  But I'm not sure how I could transfer some of the modifications I made into partial classes.  I didn't simply add some functions, some times, I modified existing functions, etc.  Do you have a suggestion bluemonkmn?  Could I, somehow, override a function that is into the source code by another one in the partial classes I added and make sure my version of the function is the one that is called?

Thanks! :)

You can't override a function with the same name in the same class.  But you could rename your version of the function and call that one instead, couldn't you?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Best approach for building a layer
« Reply #28 on: 2009-09-03, 05:33:01 PM »
I've got a quick question about collision masks!  Setting the collision mask at 0 is better because the game doesn't calculate the collision for each pixel in the image.  If you want to make a sprite without collisions, is it better to set a collision mask of 255 rather than any other mask?  So, is 255 considered no collision or does the program calculates each pixel anyway?

Thanks! :)

Alpha level of 255 is not optimized away.  It will create a collision mask full of empty pixels.  If you want a particular sprite to not be involved in collisions, remove it from the sprite category that is used with collision testing.  Unfortunately there is no built-in way to remove individual states or frames from a sprite category, so only the entire sprite can be removed or included in collision testing.  Another possibility is to set the alpha level to 0 (as an optimization), then if a collision occurs, check the current state/frame of the sprite that was hit to see if you want to allow collisions for that state/frame.  You may be able to further optimize this (at runtime -- this will not affect startup time) by setting the solid size of the sprite state to 1x1 because when you perform a collision test between a frame that has alpha set and a frame that has alpha = 0, I believe SGDK2 will create a rectangular mask in order to perform the collision test.  A pure/simple rectangular collision test is only performed when both frames being tested have an alpha level of 0.  But having a 1-pixel collision mask and a rectangle is pretty simple too.

Of course if you have separate sprites for performing collision tests like KainSlashZone, it's easier to exclude the frames from collision testing because the whole sprite is designed only for collision testing.  If a particular state should not collide with anything, just put 0 frames in it ( think that's allowed), and nothing will be tested.  Or de-activate the collision sprite when the associated sprite should not be colliding with anything.

Another thought: you could "pretend" that the sprite is inactive when it should not be colliding with anything.  For example, in addition to checking "isActive" on the sprite, you could have a custom property "isSolid" on the sprite and, in a customized version of TestCollisionMask, skip sprites that have isSolid currently set to false.

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Best approach for building a layer
« Reply #29 on: 2009-09-03, 09:58:39 PM »
Oh!  :surprise:

I like the idea of the "isSolid" property! :)

Thanks for the suggestion.  I think I'm going to create of list of the things I have to change.  Otherwise, I'm going to forget some.

Thanks again! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com