Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / BASIC 2D dynamic lighting !!!!

Author
Message
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 18th Apr 2008 04:44 Edited at: 23rd Apr 2008 18:45
Haha, i wrote my own this time

So, me and a friend have decided we are on a quest to make another version of Commandos. The old game were you play the role of a team of British commandos infiltrating Nazi lines, very secretly...

If anyone has every played that game, you will know that you can have the field of view displayed for one enemy. this is helpful becuase it shows you were the guard can see, and were he cant.

We noticed that this was almost exaclty like a "2d dynamic light", and so i tried to code one with no media. i figured i get the jist down with mostly basic 2d commands, and i did.

Move light : mouse
Change light direction : up/down


That part works... the issue comes when you try and add sprites...
basicly, i want their to be a sprite inbetween the lines. Then i figured you could stretch it to be the right size so it wouldnt go through objects, but would stop on one. I thought that the section of code toward the end that is commented out would accomplish this, but it instead, it blinks around, and rotates like crazy. if you only have 1, it just blinks, and doesnt rotate though.... This is really confusing me, cause i have no idea what is causing the sprites to blinck so much...

If you guys dont mind, could you take a look at my code and see whats wrong with it???


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
da power pwnerer
17
Years of Service
User Offline
Joined: 28th Jul 2006
Location: Pittsburgh, PA
Posted: 24th Apr 2008 01:17 Edited at: 24th Apr 2008 01:18
Instead of using cls in the main loop, use sync near the end of the loop.



-Dan

EDIT: You do have sync in your loop, so just take out cls.


http://Freewebs.com/noobisoft
Come to Noobisoft's website today!
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 24th Apr 2008 02:57 Edited at: 24th Apr 2008 02:59
testing that out....
nope, theres still a blinking issue.


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 25th Apr 2008 19:33
i really need some help... 100 plus views, and almost no help


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 27th Apr 2008 00:32 Edited at: 27th Apr 2008 00:52
edit: hold the phone... i was able to replicate the blinking. i'll look into it some and post back.

Virtual Nomad
AMD XP 1800+ (~1.6 Ghz) / 1.5 GB RAM
ATI Radeon 8700LE 128 MB / Windows XP
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 27th Apr 2008 23:39
thank you. ill be waiting.


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 28th Apr 2008 06:37 Edited at: 28th Apr 2008 06:38
well, i've given up on trying to make this work and didn't want to NOT respond and have you thinking i was still working on it.

i recommend:

1) go through and make sure all parameters are of the right type; same with some of the math variables (incorrect types). you've got a lot of internal conversions going on that aren't going to help matters.

2) rename some of your variables. names like "l", "l#", and "o" are very confusing when trying to track what's going on.

3) after you've "straightened" things up, post the issue in the DBPro or Newcomers forum; i expect you'll get more help in one of those forums.

sorry i couldn't sort this out for you. believe me, i did try! the code has potential so i hope you get it ironed out.

good luck!

Virtual Nomad
AMD XP 1800+ (~1.6 Ghz) / 1.5 GB RAM
ATI Radeon 8700LE 128 MB / Windows XP
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 14th May 2008 14:25
Its been a while since i last checked this forum, and even thought this looks old, i'll post what the problem was and the solution i found, though a good test might prove me wrong.

Main problem was that you where asigning the ID of some Boxes you used for collision, to the red lines that appeared on screen. So, it would bassically detect collision with those lines also.
Now, correct me if im wrong, but is that right? I didn't think so, so i changed the range from wich you assigned those ID to the red lines.

Here is where i changed things...
You assign ID range 1 to 20 to Boxes, so i'll change the ID range of the red lines from 11-41 to 21-60.


You created the red lines with a ID ranging from 11 to 50, but range 1 to 20 is already being used, so changed it to 21 to 60




Here is all the code as i tested it...




Tell me if its working the way it should.
Hope it helps.

Further on my stuff at...
TurboSquid.com
The3dStudio.com
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 14th May 2008 22:44 Edited at: 14th May 2008 22:48
OMG! i thought this was dead, and i was just about to make another thread in the new comers corner!

lets see, after testing the first time, i get all the red sprites pointing in the oppoisite direction of the white lines, and no boxes to cast shadows. ill go check it out and post back.

Thank you so much, cause what you said sounds very true from what i recall.

EDIT:
YES! it worked. omg, i lovey you. the code you supplied didnt do the trick, but what you said was infact the problem. here is the good code to any one who wants it. and, omg, thank you.




This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 16th May 2008 16:56
Cool!

Unterseeboot - Has you played it?
Los Mineros are on leave...

Login to post a reply

Server time is: 2024-05-06 17:59:48
Your offset time is: 2024-05-06 17:59:48