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 / Does anyone know how to use Rak-Net?

Author
Message
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 14th May 2008 03:28
I am trying to make a game that is online where it is a first person shooter game, and you can talk and stuff. I have two questions-
1. How do you use Rak-Net? Any good tutorials?

2. How would you set it so that it takes in what someone types--
Like when someone presses T, they type something, the computer saves it and when they press enter, the phrase is said? I know in python it is raw_input(".....") Is there something like that in c++?

Also, if you want to make something for the game, like some sort of city or landscape, or any characters, I will try to use them

I know you might think that if I don't even know how to use Rak-Net yet, how could I possibly make a game like that, but trust me, i'll find a way.

Any help to any of the questions, or a model or something will be very helpfull! If you donate a model, send it with your name so I can put you in the credits if I use your model.

Thanks!

~~Its not about what you know, its about how you figure it out.~~
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 14th May 2008 04:07 Edited at: 14th May 2008 04:07
Quote: "How would you set it so that it takes in what someone types--"


You would have to store it to a string first and then maybe you could dbText it or dbPrint it to the screen... I dunno about the details, such as how the input and storing to a string works... And then if you want to do it ovewr a network it gets more complicated...

~~It's not who you are underneath, but what you do that defines you.~~
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 14th May 2008 04:15
Quote: " then maybe you could dbText it or dbPrint it to the screen"

Yeah, I would probably do print screen, I know doing it over the interwebs will be harder, but if I learn how to use Rak-Net, I might get the hang of it.
Quote: "input and storing to a string works"

Yep, that is about as much as I know. I wish it was something like raw_input () or like dbUserTypes ();

~~Its not about what you know, its about how you figure it out.~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 14th May 2008 17:05
learn dbEntry FIRST.. make a program and just keep displaying it: dbPrint(dbEntry) in your loop... and type stuff.

It keeps growing until you dbClearEntryBuffer();

tab = (char)10
Enter=(char)13

You may or maynot see those in this test. Bottom line... its a buffer.

in your loop you copy this buffer to your own string... (what the person it typing).... then you empty the buffer. As you are moving the data into the buffer (preferably char by char in this case.. test for (char)13 ... (enter)... If found... Send what ya have RIGHT THERE to the network, clear your own buffer, and continue the copy from the dbEntry.

Once you copied all the letters etc from dbEntry... dbClearEntryBuffer(); So it doesn't keep growing even though you already processed it. DarkGDK wrote it this way so you can get all the "chars typed" by the user regardless how fast they typed them... (while...) during your game code... so when your code comes back.. you look in buffer... you might have 1 char, or 100!

But DUDE?!?!? How do I copy the dbEntry() thing to my own buffer if its a function call? How do I loop through it? Call it over and over? YIKES!

this is MY way... not necessarily the "right" way LOL...

first make a buffer... I personally make one, 1k long, in a namespace for these kidns of tasks...

char buf[1024];

1024 might be to big.. who knows

then you need to research the strcpy command to copy dbEntry to your buffer. Then you can iterate though this buffer a char at a time and copy to bytes to your screen and a chat line buffer...

char chatbuf[1024]

and during this loop copying char by char from buffer to charbuffer.. when you encounter the char(13) (enter key) or hit the 1024 mark.. Send the text via inet. Set chat buffer to all zeroes so its "clean and empty"... continue loop until you finished reading from "buf". Done? Clean and Empty "buf" to all zeroes.

This is a safe way to do it. I have a way that could accomplish the same thing in my DarkGDK OOP lib... http://code.google.com/p/darkgdk/ but its basically because I have my own string lib in there to ease this sort of thing, likewise C++ comes with the "STDLIB" that has various string functions to help ya... but you're on your own there.. at least from me.. most people use that method so the help will be here.. just I'm not versed enough with it myself to go on and on..

Good luck. BTW - I'm about to release a new and final release of my DarkGDK oop in next day or two and it has a fledgling gui system... and there is a code snip that does exactly what your trying to do ... using my string lib... and it looks like:

jgc_userinput.h from new DarkGDK OOP Lib not released yet...




jgc_userinput.cpp from new DarkGDK OOP Lib not released yet...


Good Luck Man!

programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 15th May 2008 02:10
thanks!

~~Its not about what you know, its about how you figure it out.~~
TheeLord
16
Years of Service
User Offline
Joined: 23rd Jan 2008
Location: Chicago
Posted: 16th May 2008 18:30
I have a very good implementation of RakNet in my game that is passing variables from any number of clients to a server.. However, this took me a couple months to figure out and I'm completely strapped for money right now. If you want to pay I will create a very simple and concise tutorial on how to use it for you.

Email me at Stankiem@hotmail.com
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 16th May 2008 21:05
@programing maniac - off topic - if you get a chance - try the latest build of the Jegas Game Classes and let me know how it works out for you. This would be appreciated.. curious to how easy it is to get going, any issues you might have running demos, and what you think over all... thanx: http://code.google.com/p/darkgdkoop/

programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 17th May 2008 03:52
Quote: "try the latest build of the Jegas Game Classes"

Quote: "and what you think over all"


That was really cool! Nice work. There is actually an error with mine though, (probably my fault) when I debug the file, it says ( the image is attached to the post)

Am I doing something wrong?

~~Its not about what you know, its about how you figure it out.~~

Attachments

Login to view attachments
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 17th May 2008 03:58
The desktop and all the files ( circled in red) are in that picture attached to the post. Is it all correct? Do I need to move stuff?

~~Its not about what you know, its about how you figure it out.~~

Attachments

Login to view attachments
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 17th May 2008 04:00
Quote: "There is actually an error with mine though, (probably my fault) when I debug the file, it says "


Although when I use the .exe file everything works fine.....

~~Its not about what you know, its about how you figure it out.~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th May 2008 05:03
Well..

First... those two files you have on your desktop were just to patch the previous release... you can can those. The current version has those all patched

Second... USUALLY those kinds of exceptions are from the program not finding the media and your comment about runing the EXE makes me wonder what your JegasLLC directory ended up looking like.

Third.. Each Demo has its own Loag file... however the directory your ran the EXE from would be where a log file would be generated if not run from within vs2008... so where the EXE is, see if there is a !logfile.txt file. It tells you of any media files it was unable to load

It might almost be easier just delete all that, and unzip the CURRENT RELEASE archive again... (download latest if necessary) and just go in JegasLLC dir, open the solution, in the tree view, single click a demo, and try the "RUN" (green) button again.

Thank You for Reporting back

programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 17th May 2008 18:30
Quote: "Thank You for Reporting back"


No problem! Glad to be of help, considering all the help you've given me....

~~Its not about what you know, its about how you figure it out.~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th May 2008 19:25
Have you tried the new Version 1.0 Yet? Can you mix it with RakNet? Are you still trying to get RakNet going? Or another means?

programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 20th May 2008 02:52
Uh, yeah, I am still figureing out (trying to) how to use Rak-Net

p.s.- I am not really sure if there is another problebly easier way to use your cade for the oop thing. I have just been looking at a code I want and getting ideas. Is there another way to use it? I mean, I don't want it to be like an amazing thing that can help me like crazy, but I don't know how to use it!

(I really hope the way I am using it is the right way, cause if not I will feel like a complete idiot )

Quote: "Can you mix it with RakNet?"


Once I figure out how to even basicly use rak-net, I don't think that is happening soon... I can't even figure out which way is up or down with Rak-Net ( meaning I HAVE NO IDEA WHAT I AM DOING!)

Lol, well, hopefully you can help me with the things, if not it isn't a problem, I am still looking around!

~~Its not about what you know, its about how you figure it out.~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th May 2008 04:38
Quote: "I really hope the way I am using it is the right way, cause if not I will feel like a complete idiot"
Don't you dare feel like an idiot! That's some complicated stuff man! took me half a year to get that in my spare time!

Go look in the program annoucements area - 1: There is a post to Neils Henderickson that explains the simplest "starting point" I've published yet.

also... take apart a SMALL class first.. like JGC_CLOCK or JGC_TIMER .. couple that with [href]www.cplusplus.com[/href] and it will start to click.

You'll do fine! Learn and understand type casting! I do it quite a bit - but I do it in a consistant manner if you mess with it a bit - and follow some things.. you might start to see how its done... give it a whirl... move these posts to that program announcement though so others can benefit from your questions.

Hang in there!

programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 20th May 2008 22:11
I am going to hang in there! I have only been using c++ for 3 weeks at the most now, so I know I don't know everything.

Also, I saw your header files (.h) and I was wondering how you made them. I want to learn how to make header files, so I can do stuff like what you did.

I never went to www.cplusplus.com, is it good? well, if you suggested it, it probably is.

Thanks for the support!

~~Its not about what you know, its about how you figure it out.~~
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 20th May 2008 23:40
never mind, I figured out how to make header files, just make a new text file and save it as a .h file!

~~Its not about what you know, its about how you figure it out.~~

Login to post a reply

Server time is: 2024-11-20 11:38:06
Your offset time is: 2024-11-20 11:38:06