where you can code in an auto host? and if not would anyone like to host my game?
1
2
ID:161230
May 31 2008, 5:53 pm
|
|
May 31 2008, 7:22 pm
|
|
Yep, there sure is. You want the OpenPort() proc of world. It, if you couldn't guess, opens a port so people can connect. Now understand, this only attempts to host, it won't guarantee that the game will be available for people to join. The host will still have to make sure their firewalls and routers are set up so people can join, like any other game on BYOND. This only makes it so you can start hosting without clicking a verb or using the commands in the menu.
|
In response to Xooxer
|
|
could you tell me what the code is im not sure i get this sorry but im new at coding..
|
In response to Yepin
|
|
If you ever need help with a certain proc, before you post in Developer How-To, use the DM Reference. You can get there using F1 in Dream Maker.
You can use it by searching the name of anything built-in to BYOND. |
In response to Kaiochao
|
|
what would it be looked up as?
|
In response to Yepin
|
|
You misunderstand how programming works. It's not a system where you just copy and paste preexisting materials in the hopes of producing, by some manner, a completely working, flawless, and somehow complicated system. A programmer is someone who programs, and programming is the act of writing code. You're supposed to write this code, not just take it from where you can find it.
In this particular case, you would call the OpenPort() proc, which happens to be built-in. |
In response to Yepin
|
|
....OpenPort()....
|
In response to Kaiochao
|
|
it says this
world/OpenPort(port) // only allow subscribers to host if(host_is_subscribed) return ..() does that mean only people who pay can host? |
In response to Yepin
|
|
...That's an example code. Read the actual information.
|
In response to Kaiochao
|
|
i know im being pretty stupid and lazy but could let me off the hook and tell me what the code is if you would be so kind.
|
In response to Yepin
|
|
Sure.
var/hosting // to tell if we're hosting or not This will automatically try and open any available port. If you need it on a certain port number for all host, just pass the number in the world.OpenPort(port_number) proc. You might also want to give the host a way to set the port. That's a bit more code, however. ~X |
In response to Popisfizzy
|
|
i dont get how it work though so its up with out anyone hosting it?
im just not good at this =[ can somone please help me out alot im a noob at coding and i have LD =/ |
In response to Yepin
|
|
That's what you wanted, wasn't it?
|
In response to Yepin
|
|
That code works. If you're running the game with it in it, and you login, it'll start hosting. Hrm. Oh. I see what you mean. Did you plan on running this in Dream Daemon without actually having to join the game yourself (or the host needing to)? Then this is probably what you want. Actually, this is probably better all around.
var/hosting // to tell if we're hosting or not What it does is it tries to open a port, to host the game. If it succeeds, it sets the hosting var to TRUE, otherwise, it sends an error to the world.log (which the host can see in his Options and Messages, or it's displayed in the DreamDaemon), telling you it couldn't host on the port. Remember, this is a very simple code snippet. It doesn't handle choosing the port number or the publicity. It won't try another port, or check to see if you're even online. Something like that could make for a nice library, though. |
In response to Kaiochao
|
|
so your saying if i copy that code my game goes online?
|
In response to Yepin
|
|
Provided there's someone to host it.
|
In response to Popisfizzy
|
|
but i need a host though thats the only thing i need thats why i though if i coded it in me or anyone else would not have to host it... can anyone help me with that?
|
In response to Yepin
|
|
If you run the game with that code pasted in, yes, it will go online. But like I said before, whether or not people can actually connect to it is not guaranteed. If it returns the error I wrote in your Options & Messages box, then it couldn't open the port. This probably won't happen. Most likely, it'll open the port, but players won't be able to join it. That means your computer is either blocking information on that port number (the world.port variable can tell you what port it is. Just send it to world.log like I did for the error if you need to know it), or you need to forward the port through your router. Both topics have been covered in great detail in many forum posts. The search box up there is your friend. Those are problems for the host and his computer, though. Nothing you can code can make it host for everyone all the time.
|
In response to Yepin
|
|
It's impossible for a game to be hosted without a host. That doesn't even make sense.
|
1
2