Re: Question about class construction, variables, and handles in BGT

2015-12-10 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

Alright. So I have my create account code working. Now I've just got to figure out how to save these accounts and load them later. I know I have to serialize everything, but I'm having a difficult time understanding the process describe in the help files. Maybe I'll have better luck if someone explained it to me.

URL: http://forum.audiogames.net/viewtopic.php?pid=242098#p242098





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-10 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

NVM, I've figured it out.

URL: http://forum.audiogames.net/viewtopic.php?pid=242127#p242127





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-09 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

Think you could walk me step by step in that keyIsFull?I'm not able to really follow that without some explination.

URL: http://forum.audiogames.net/viewtopic.php?pid=241915#p241915





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-09 Thread AudioGames . net Forum — Developers room : keyIsFull via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

class account {void create(string username, string password) { //this method from the server creates the account with the username and pw.//create account here}}account@[] allAccounts; //an array of account object handles. This array stores any newly created accounts as well as any accounts you would load if someone had logged in.void main () {//check if the received packet has create account in it, and if it does, then}accounts.insert_last(account); //creates a new account object in the accounts array. accounts[accounts.length()-1].create(username,password); //initializes the account in the last array slot with the user name and password that you parsed from the network request.}note: you can't make variables out of the strings you parsed from the network request, because that's just not how it works. A variable name is just arbitrary. That's why you have to create an array of account objects. plus, 
 once you have like 400 accounts, managing each one by its name would suck anyway. You could create a function that returns an account object so that you could more easily deal with them though, something likeaccount@ get_account(string username) {for(uint x=0; x<accounts.length(); x++) {if(accounts[x].username==username) return accounts[x];}}return null;}

URL: http://forum.audiogames.net/viewtopic.php?pid=241918#p241918





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-09 Thread AudioGames . net Forum — Developers room : keyIsFull via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

you would have to do something likeclass account {void create(string username, string password) {//create account here}}account@[] allAccounts;void main () {//check if the received packet has create account in it, and if it does, then}accounts.insert_last(account);accounts[accounts.length()-1].create(username,password);

URL: http://forum.audiogames.net/viewtopic.php?pid=241913#p241913





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-09 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

So I've gone through and worked it all out in my head and I believe this solves my problems just fine. The only thing I'm having a hard time deciding is if I want to put my movement code, weapon code, and collision code  in the account class, or if I want to have the functions run forloops with the accounts. From my understanding this problem pretty much equates to deciding if you should write 2+3=5 or 3+2=5. Is there a factor that I'm just not thinking of that would determine which direction I should go with this?

URL: http://forum.audiogames.net/viewtopic.php?pid=241939#p241939





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-09 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

Alright, I think I understand now. I'll have to experiment with it and see if I run in to any other issues. Thanks for the help.

URL: http://forum.audiogames.net/viewtopic.php?pid=241924#p241924





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-09 Thread AudioGames . net Forum — Developers room : keyIsFull via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

I would probably put movement and firing code in the account class. I'm not even sure why you would do it the other way.

URL: http://forum.audiogames.net/viewtopic.php?pid=241989#p241989





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-08 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

It might be helpful down the road, but not what I'm trying to figure out right now. I need the client to be able to send a packet of information to the server, the server will parse that information out into account name and password, then use that account name and password to create an instance of the account class. I can pass the password off as an argument in the constructor, but I don't know how to make the actual handle vary with each new packet.This is what I want to happen.//client codevoid ClientCreateAccount(){//send a username and password to the server with the word createaccount in front of them.}//server codevoid main(){do{if(network.type=="receive& contains "createaccount"){//parse out the packet for the username and password into variables called username and password respectively.account username(password);}while(!ke
 y_pressed(KEY_ESCAPE);}This is just suto code, I know I'm missing some stuff in the above code, but should be enough to give you a better idea of what I'm trying to do.

URL: http://forum.audiogames.net/viewtopic.php?pid=241911#p241911





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Question about class construction, variables, and handles in BGT

2015-12-08 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Question about class construction, variables, and handles in BGT

Alright, so currently I'm working on getting account code set up for my game.However I'm having an issue coming up with a way for my server to call my account class and assign that account with a unique name. The following piece of code might explain my predicament better.string accountname="john";class account{//account code goes here.}void maine(){account accountname;}For the idea I have to work, accountname needs to be seen as a variable, rather than an actual name. The result I want from the above code is to end up with an account class called john if that isn't clear. I haven't tried implementing this idea into my code yet because I'm almost certain it will fail. I think I might be able to use it as a handle like so though.string accountname;class account{//account code goes here.}void maine(){account @accountname;}
 However, I'm not too familiar with using handles, so again I'm almost certain this won't work.If anybody has any suggestions on how to make this work, I'd appreciate it.Thanks.

URL: http://forum.audiogames.net/viewtopic.php?pid=241886#p241886





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: Question about class construction, variables, and handles in BGT

2015-12-08 Thread AudioGames . net Forum — Developers room : Victorious via Audiogames-reflector


  


Re: Question about class construction, variables, and handles in BGT

Do you want instances of the account class to be assigned, or mapped to strings? For example, john is mapped to an account object, victorious to another?The solution that comes to mind is to use the dictionary object, which is a hash table that allows you to associate objects of arbitrary type to string keys. For example,dictionary accounts;Account johnsAccount;accounts.set("john", johnsAccount);Then you can check for whether such an account exists with accounts.exists("john") and retrieve John's account if it exists.Note that keys may only be associated with 1 item per dictionary.

URL: http://forum.audiogames.net/viewtopic.php?pid=241894#p241894





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector