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.

Code Snippets / Tutorial wish list

Author
Message
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 4th Mar 2005 19:43
Sorry im posting this one here, but if some of you noticed im posting some simple tutorials on this forum and i will keep them coming for new comers.
So i want to pick requests here if you have one.
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 21st Mar 2005 20:51
how about scrolling in all directions in 2d? i cannot find a tutorial on that =\

and ofcourse shooting...but maybe that missle code i downloaded somewhere will be good enough to learn off of....

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 22nd Mar 2005 01:56 Edited at: 23rd Mar 2005 04:12
you talkin about somethin like this?

UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 25th Mar 2005 15:57 Edited at: 25th Mar 2005 17:14
hmm inttresting i'll see if that actually works =)

Nope dosnt actually work but your code has put me onto something =) i'll post my code if i get my thoery to work

[edit #2]

What i need is some code that will detect when the spaceship is to close to the edge of the screen so it will scroll so that way the ship will in terms always be in the center of the screen.

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Mar 2005 17:43 Edited at: 25th Mar 2005 18:14
ah you mean background scrolling,
okay ill make one for you

Edit: allright, here is a quick one and there are surely other ways to make this.
this is just a quick and messy one

fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 25th Mar 2005 17:49 Edited at: 25th Mar 2005 17:50
All you do is make a GIGANTIC background and scroll it depending on the keys you press. Then powerups can randomly appear.

How about a custom input tut?

www.war3forums.net

A.K.A Death Stalker
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Mar 2005 18:17 Edited at: 25th Mar 2005 18:19
if you make these changes, you can narrow the scroller borders



@Nitrixik Studios:
english is not my native language, explain custom input so ill try to help you
fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 25th Mar 2005 18:38
What I mean is pretty much the insides of the "input" command in DBPro. (how the command works)

www.war3forums.net

A.K.A Death Stalker
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Mar 2005 19:42
i think theres no reason nor a sense to customise the input command
or, i just didnt get your point

anyways here is a piece even it may not be what you need

fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 25th Mar 2005 20:35
Well mainly, I am perplexed by the flashing line. How is that done?

www.war3forums.net

A.K.A Death Stalker
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Mar 2005 20:51
thats not a tutorial topic i can handle
fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 25th Mar 2005 21:30
what about......................

adding values to 2d arrays while always having the (_,i) i value have the same max value?

www.war3forums.net

A.K.A Death Stalker
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Mar 2005 22:41
Like this?

dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 25th Mar 2005 23:07
How about simple AI. Nothing fancy, just moves in a lineforward 5 steps, turns and thats the end. Or as simple as possible.

It has been said that the body is a slave to the mind. Only the mind knows no freedom.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Mar 2005 23:55
Well, AI is not a simple tutorial subject either and i cant handle it in a moment. please try to ask more simple tasks that you are stucked with.

for the 5 steps forward and backward in a straight line check following (again theres a more simple way to do this):
dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 26th Mar 2005 00:36
I know Ai is not simnple, I've tried it many times before. Anyway, thanks.

It has been said that the body is a slave to the mind. Only the mind knows no freedom.
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 26th Mar 2005 03:22
Cucumber its really nice of you to make all this code for people but the whole basis of making tutorials is to put in rem (`) commands to tell the people what the code does...just remember that once im donw with my game (which has rem commands and explanation of code) im am going to make a little tutorial in a read me file or maybe word pad so i can make the diffrent words color coded so people will understand it better...but anyhow just keep that in mind showing people code dosnt mean they'll understand it without explanation.

BTW nice scroll code i'll see how well i can butcher it and make it my own =) (don't worry i'll put you in the credits for making the code if i actually do use it.)

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 26th Mar 2005 04:44
There you go UnderLord
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 26th Mar 2005 10:20
lol nice

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 27th Mar 2005 08:32
umm how about doing things with the backbuffer pointer

X-Patch x-patch.exe(gui):75% make.exe:5% x-patch.dll(runtime dll):0% developed on win xp home sp2
fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 27th Mar 2005 08:39
Thanks, just what I needed.

www.war3forums.net

A.K.A Death Stalker
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 27th Mar 2005 16:00
okie lets see.....waaaaaaa

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 27th Mar 2005 23:12 Edited at: 27th Mar 2005 23:13
i dont know what back buffer is, and i dont know how to point it either.
Maybe you should explain more about what you need.
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 28th Mar 2005 08:49
ok in dbp get backbuffer ptr returns the pointer of the backbuffer

do u not know what pointers are

X-Patch x-patch.exe(gui):75% make.exe:5% x-patch.dll(runtime dll):0% developed on win xp home sp2
sadsack
21
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 28th Mar 2005 10:39
hello CuCumber,
could make a simple rocket (cube) with thrust,velocity and gravity?
thank you
renny
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 28th Mar 2005 15:35
in ref to back buffer pointer ....

this is like a pointer to the DX device context that is the
screen surface. Its called the back buffer because thats where all
DX stuff is drawn. Then, when the sync command is called, the back buffer is swopped out to with the front buffer and rendered to the screen while you continue drawing on the new back buffer ...


Not too usefull from within DB, however, you could pass this pointer to a DLL that "knows" what to do with it ... such as drawing
additional graphics ...
re faze
20
Years of Service
User Offline
Joined: 24th Sep 2004
Location: The shores of hell.
Posted: 28th Mar 2005 17:24
can i do zfog like this - is the scene depth info in there too or is the backbuffer just an image?
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 28th Mar 2005 20:22
@SadSack:
i suggest searching the forums before asking, but here i found one cool piece of code for you,it was in my archives and i dont remember the writer actually.
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 28th Mar 2005 20:25
for the other guys asking for backbuffer, i dont think i can help you with that you should ask to more experienced guys here.
Also id like to help you with less complicated and more generic stuff next time.
thanks
sadsack
21
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 29th Mar 2005 11:12
I did put thrust, velocity and gravity in the search and got nothing
that code is just what I was looking for. thanks
renny
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 30th Mar 2005 02:41 Edited at: 30th Mar 2005 02:43
Sadsack you might want to take a look at the code i got off the codebase and butcherd well sort of butchered.

the code will be put in one of my tutorials i am making this is great thrust and warp code =)

Remember that you have to put everything from the "if upkey()=" and down in a DO-LOOP so that way it will work.

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 16th Apr 2005 23:56 Edited at: 16th Apr 2005 23:56
If you do feel like doing an A.I later on here's some basic concepts of a simple A.I...well atleast in my mind, this is how I'd handle it:

Create a few boxes:
- Box 1 is the user
- Box 2 is the A.I
- Box 3 is an obstruction on the map

Create a pyramid object, rotate it 90 degrees and position it as a limb on the A.I (this pyramid will be the A.I's line of site)

Have a simple randome movement function doing the following:
- Pick a random number between 1 and 7
- If 1, make the A.I move forward
- If 2, make the A.I move backward
- If 3, make the A.I turn left
- If 4, make the A.I turn right
- If 5-7 just stay normal, in other words dont do anything. (Dont know if there's a probability function out there that would allow you to just use an if 5 and set 5's probability higher than the other).
I figure you wouldn't want him moving all the time so thats why there's more probability on standing still.

Then, check for collision with the pyramid. If box 1 (our user) collides with pyramid 1(the A.I's site) you could...
- Color the A.I blue
or
- Move the A.I forwards and if the A.I collides with the user go to a screen saying "you lose"

As a little top-offer just check if the pyramid collides with the 3rd box, if it does set a variable to 1, then when your checking if the user collides with the pyramid, check if the variable equals 1, if it does than ignore the process because the A.I cant see you, if it equals 0 then go ahead and follow through with the process.

Finally, set the pyramid to ghost so you can see where the A.I is looking.

If you wanted to make this into a little game just add like a small sphere near the A.I and your goal is to get the sphere, if you collide with the sphere then display "You win!".

Im still quite a noob but that's my take on a simple A.I in 15 mins.

UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 18th Apr 2005 06:26
hmm thats nice.

I need a AI tutorial because i don't know where to even start with AI or even how to start with it im totally lost in that subject...im lost in the sauce so to speak heh.

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
sadsack
21
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 18th Apr 2005 10:50
hello underlord,
That code worked very well, thanks sorry it took so long for me to get back here.

renny
CuCuMBeR
22
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 20th Apr 2005 01:07
sorry guys, i was away for some health problems but now im back and ready to help if anyone needs
NoteJam
20
Years of Service
User Offline
Joined: 11th Apr 2005
Location:
Posted: 20th Apr 2005 16:42
I would like you to do a demo on how to use the windows dll named winmm and how to call its midiShortMsg and send note on/note off messages.

This would allow me to write some neat algo music composer programs, but I am stumped on how to set the varibles for a dll call to a windows api dll.

Login to post a reply

Server time is: 2025-05-19 00:58:43
Your offset time is: 2025-05-19 00:58:43