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.

Dark GDK / My questions - Sidescroller 3D

Author
Message
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 31st Dec 2008 14:19 Edited at: 2nd Jan 2009 16:02
3D Sidescroller

Current state:


Current Features:
-Animated character
-3D Environment
-Basic Movement

Hopefully upcomming features:
-Shooting
-Something to shoot on

If you feel like you got a piece of code wich could fit in, then you are welcome to contribute
I can give something back if you want


Q:I followed the tutorial about Game level, it said that I could import maps made with FPSC.
But now it apears that the map called universe.dbo in MyGames/universe/Files/levelbank/level1 is locked in the .zip folder. It requires a code to copy it!
A: None yet

Q: I will make my level in Milkshape instead, but now I got another problem. The floor has flipped 90 degrees
A: Exported in .X instead of .3ds

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 31st Dec 2008 18:00
I will make my level in Milkshape instead, but now I got another problem. The floor has flipped 90 degrees

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 31st Dec 2008 18:18
Found it out myself

But now if I want to create a contollable character in my level, does anyone got any hints?

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 31st Dec 2008 18:33
Like a walking dude or like a character controller like one would do with a physics engine like DarkPhysics/PhysX??

A Screen or two with a model, some scene, and maybe numbered arrows - with explainations might help get hints.

you're question is vague - I want to help but don't know what you are in need of exactly.

--Jason

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 31st Dec 2008 20:10
Something like for example Lara croft in Tomb Raider, but the camera only moves sideway.
The player/character can move up, down sides, rotate etc.

Here is a pic of how it looks now + a badly drawn character made in paint But the character should be in 3D.

Attachments

Login to view attachments
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 31st Dec 2008 20:34
We'll I'd personally start by finding a model to use, and preferably one with built in animations, as trying to force animation by manipulating the limbs of boned model or whatever will likely be a waste of time and is probably only acceptable looking if you are making an android.

Picking a model is very important, because the code you write to control the animation, the scaling you might do to make the model fit right into the scene, and the specific rotations you may have to do to get it/her oriented (so walking forward goes forward) will all be quite married to the model you choose. Changing models tends to mean lots of reworking of stuff you may have had done.

Once you have your model picked, write code to load it, and experiment with the scale, rotation etc to get your model into a scene.. make sure you look up the Fix Object Pivot command - it can be a lifesaver. When you load a model that happens to be face down in the mud, you might rotate it to make it stand upright - then calling fix object pivot will make that "transformation" or rotation, or orientation - whatever word you want to use - well.. it makes it the new "home" position one might say.

another thing that is a bit of work but is worth it - is experiment with timers and timer based movement. this makes the game behave the same regardless of CPU Speed. The same techniques can be used to make animation work smoother than simply using the "play object" command. Playing with the animation frames (remember they are float values so you can increment in small steps or larger) yourself using timers will likely prove rewarding when you start to see why I recommend it.

Remember in your game loop to keep the loop going - meaning - think about making your code so it can "do a little" and next go around "do a little more" ... so this way all the things that might need to happen at the same time appear to do so.

Like - Don't write a loop to make animation do a whole loop... is stead advance the frame a bit based on timer stuff... then if the animation frames passes the "walk Loop" handle that.. but move on... next go around it will animate one bit more... in the end should start to look smooth.

Once you have all this kinda going - then I'd say its time to work in those keyboard controls if you havent done so... Rememebr to have perhaps a structure or variables to track what your character is doing - walking, idle, running etc.. and update accordingly - so your keypresses ultimately move your character as well as your charater "reacts" to stopping, or deciding to walk forward etc.

there's some hints but you need to investigate each of the topics I touched on - there is a lot here but that should hopefully get your wheels turning... or legs animating

--Jason

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 31st Dec 2008 23:46
Thanks!
I allready have a character, and I will try to get him functional tomorrow.

Happy new year! 15 min to go

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 15:14
Ok, I got the character model inside my game.
But Since the texturename isnt the same as it was when it was exported the texture doesnt load
Here is my "load and texture character" code:


And could eveything be included in the Main.ccp? Or should I make seperate .ccp or .h ,or whatever thay are called, for character, laoding the level etc. Will they still be able to interact with eachother?

Attachments

Login to view attachments
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 1st Jan 2009 15:23
OK... For starters - SOME *.X files are in binary while others are in a text mode. Open the *.x file with a text editor. If it looks like a couple chars and all blank - its digital - fooey... if its a bunch of numbers and stuff... hunt the text via search for tga dds bmp jpg and png If you get hits... you'll see those are texture filenames. you can either edit here or rename the correct textures to match... Note textures should usually be in same directory as the direct.x files your loading.


Your code has ya applying the texture manually (though its comented out) and this might work - but when I can, I try to let the direct.x file do it.. though there are DEFAINTELY times its better to do it manually.... say one skin for normal, another for dead... alternating the texture is probably less work than loading two models and alternating. Either works though....


Now as for breaking things up into different files - the reason to do so is to organize your code. But you also have to be aware of something called a circular reference. google is your friend... In short... if FILE_A needs something from FILE_B but FILE_B needs something first from FILE_A - you have a problem.

--Jason

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 15:54
Thanks for you help!

I found the texturepath in the .x file, and changed it. But still it wont show the texture, the model just became grey

Whats the difference between .ccp and .h?

So I can have?:
Main.ccp
Level.ccp
Player.ccp
Enemy.ccp

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 15:57
Now its starting to look like something

Attachments

Login to view attachments
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 1st Jan 2009 16:00
Awesome!

Ok - Typically the file names are *.cpp (Short for "C" "Plus" "Plus").

Header files and Source files (as they are sometimes referred to... even though headers are a form of source code too).... you should have a decent understanding of... that would take a bit more time than I'm willing to give up as I'm busy on a project of my own - HOWEVER ... This site is GREAT for getting your C++ skills up to snuff... I go here myself and use it as a reference whenever I got to go back to the basics: http://www.cplusplus.com

I really like how your scene is shaping up!
--JAson

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 16:03
Thanks! I will try it out myself

Thanks for all your help! And tell me if you want some 3d or 2d

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 16:09
He he, I looked at the site and... Maybe I will find it usefull one day, but I didnt really find something wich can help me rigth now

I basicly only got one last question before I can test things by myself, and that is:
How do I set up more than one .cpp and .h to work together?
I looked into the "Dark Invaders" Source, and I didnt find the red line

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 1st Jan 2009 16:16
You should REALLY take a look at my DarkGDK OOP Wrapper - tons of source code and demos to look at.

header files usually describe what's in the source (*.cpp) files so that you can include them in any other source files that need code from.... The best thing I can tell you is to have a look at this:

http://code.google.com/p/darkgdkoop/ and note there will likely be a newer version comming out in the future.

--Jason

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 17:53
I am getting the hang on this, but now for movement.
I know it should include dbScanCode, dbMoveObjectLeft, dbMoveObjectRight, dbLoopObject (for animation) and something for the camera to move on a specific axis in order to follow the character.

But i just cant get my thumb on it
Any suggestions?

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 1st Jan 2009 18:21 Edited at: 1st Jan 2009 18:23
So you want to follow the character with the camera?

you could just do



or something like that (That's the first thing in your while loop). so that way the camera would follow the player.

Then to have the player move you would do



And the same for the right except MoveObjectRight, and dbRightKey, etc.

Is that what you were asking though?


EDIT: I never compiled this, so it might be wrong.
EDIT2: Sorry, I just noticed, dbMoveObjectLeft and Right may not work, because they might work relative to where the player is facing(so in this case he's not facing the screen, or away from the screen, so it may move towards or away from the screen.
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 19:31
Thanks! But nothing happens with the movement code
And I cant really see why not.
And since he is not moving I cant see if the cameracode works

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 19:41
Maybe this work:
(My whole code, dont steal )


Its not beatiful, but it kind of works

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 1st Jan 2009 19:48
Ugh... Remember my bit about timer based movement?

How will the movement happen if you only check "left key" once before the loop?

Move the if(dbLeft etc. inside the loop... then report back..
--Jason

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 19:53
Isnt it inside already?

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 1st Jan 2009 20:30


That should work (I didn't compile it though)

You are mistaking a function for a loop. A loop, well loops until it is stopped (in this case if you press esc or something). Here is a while loop, which is a type of loop.



So that's what a loop does, I don't know how well I'm explaining though..
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 1st Jan 2009 20:38
I think you explained pretty well - I think BIG Viking is going to be having a lot of fun with all this...

Each new "cool thing" builds on the toolbox of things ya know

Keep at it!
--JAson

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 1st Jan 2009 20:50
Thanks Jason =)
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 1st Jan 2009 22:59
Thanks both of you! Now I think I understand the looping part.
I have to try the new code tomorrow, I am at the wrong computer right now

We are like the three musketeers

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 2nd Jan 2009 15:29 Edited at: 2nd Jan 2009 16:01
It works! He is actually moving! Thanks!

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 2nd Jan 2009 16:40
Ok, he is moving. But He wont stop I tried with "else" but that just made it even worse
And any ideas on how to get collision?

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Jan 2009 17:11
Ok - Now this is slightly frustrating and I'll tell you why: You should have these answers I believe.

I gave you link above of my DarkGDK OOP library... why? So you could learn from it. Did you?

If you did, you'd see a Sparky Collision demo. If you looked on that web site I posted above for longer than a few seconds - you would have seen links to the download for Paul Johnson's Sparky's Collision (So you can run the demo I provided on collision).

I'm not mad or anything hardly - but I for one won't keep helping on issues that are as simple as [href]www.google.com[/href] followed by darkgdk + collision

I mean - help ya learn to fish - yup... fish for ya... not me

Now - your graphics are looking great - you now definately know about something called Sparky's collision - there is also something called Nuclear Glory - but not many use it as far as I know... and on the slight chance you didn't search basic3d area of the help documentation - there is abuilt in collision system - but it's not as "fast" as sparky's but rumor has it it works on animated characters (while they are animating) while sparky's doesn't.

Now - Go make some more improvements on your code because I like the "look" of the art so FAR!!!!

--Jason

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 2nd Jan 2009 17:15
The animation keeps playing or the object keeps moving?
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 2nd Jan 2009 18:31
Sorry Jason Im just so excited so I forgott about your link

Quote: "The animation keeps playing or the object keeps moving? "


It keeps playing.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 2nd Jan 2009 18:38
No problem... I'm actually quite stoked you are so excited and having a blast with all of this.

I think there is a dbStopObject command to stop the animations - remember what I told you about "DiskMeta" (There is a free lite version) ... the tool like google toolbar... both might do the trick - but again... you could search your own harddrive for "animation" and get every reference to animation and the files - so with a little setup - pointing diskMeta to the directory with the help files for gdk and indexing that as well as the include folder - (Should - could just index the "TheGameCreators/DarkGDK" directory or whatever in one go..

Please keep us posted about your progress...


New warning to control expectations - Remember that your fist "programs" - though a blast you might learn so much in the process you find it easier to start over sometimes as you learn better ways to do things - this is par for the course!!!!

--Jason

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 2nd Jan 2009 19:43 Edited at: 2nd Jan 2009 19:44
Here's some code that should help you, put this after control commands.





Another thing you might wanna do, after looking at your code is use functions. These are really handy little things as they allow you to organize your code.

Here's an example.



So this code does several things.

First of all, it starts in void darkgdk. You ignore everything above it. Then, go through everything until you get to the line




And this line basically sends the computer up to the line



so it does everything in there, and then goes back to where it left off.

Its ok if you don't get it now, I can explain more.

But using functions shouldn't be your priority, you should do that later on when your code gets longer (now that you've already started).
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 2nd Jan 2009 20:28
Jason, the stop command just freezes a frame

And PoK, I added this:

After the controls and got a lot of errors.
Here is the whole code:


And I think I know what you are talking about with functions, and it seems quite easy actually

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 2nd Jan 2009 21:29
My bad, I made a stupid mistake.

change that code I gave you to

Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 3rd Jan 2009 11:42
I still get a lot of building errors

Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 3rd Jan 2009 17:24 Edited at: 3rd Jan 2009 19:43
Take that semicolon out of that if statement so it's like this.




And why do you have dbSync() commented out?

Plus, you're missing a couple semicolons after some lines.

Try this:


EDIT: Uncommented the lines where the objects are loaded
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 3rd Jan 2009 18:15
Quote: "And why do you have dbSync() commented out?"


C++ told me to


Im sorry, but it still wont work
Should I use some kind of function?

Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 3rd Jan 2009 19:23
Well, it compiled for me.
dbSync() is the important call to update the contents of the screen. It's necessary.

Can you post the errors? What's going wrong?
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 3rd Jan 2009 20:34
Now it compiled, but he still wont stop walking
Is there another way?

Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 3rd Jan 2009 21:00
You could use KaosScript for the level, you know. It's a little more advanced than what you're doing, though...
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 3rd Jan 2009 22:17
KaosScript? What does it?

Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 4th Jan 2009 01:20
It makes it easier to save/load your game world. The current version can't write files yet, though.
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 5th Jan 2009 03:51
is this still being worked on? You still have errors compiling?
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 5th Jan 2009 08:48
Yes, I am working on this, but the character wont stop his animations

puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 5th Jan 2009 23:51
A ha!

I think I've got it.

its in this line:



change "dbLoopObject (2, 190, 209);

to

dbStopObject (2);

I don't know if it takes more arguments though, I'll have to check.
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 6th Jan 2009 12:50
This time it didnt even work, but last time I tried with dbStopObject the character just froze in its current frame.

Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 6th Jan 2009 20:43
Sorry it's been awhile since I've posted.

Are you sure that (190, 209) is the loop for the idle frame?
Or is that just more walking?
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 7th Jan 2009 20:13
Its the idle.

Nomad Soul
Moderator
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location: United Kingdom
Posted: 15th Jan 2009 01:43
Whats going on BVG

Just move on from the character anim thing and come back to it.

I guess this is why I couldn't hack DGDK. 1 line of code not working can make you want to scrap the project on a bad day.

This shouldn't be a game breaker though. Ask for help if your having trouble because this looks cool.

Login to post a reply

Server time is: 2024-11-25 11:30:23
Your offset time is: 2024-11-25 11:30:23