how to?

Talk about anything in here.
Post Reply
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

how to?

Post by bowersbros »

Right, as you know (most of you)

Im building a game, and i ran into a little problem.

basically, ive started the game over 3 times, first it was to be done in PHP and Html.

didnt like it,

then it was flash and java (with Smartfoxserver)

That was too expensive. (£3500 per server just for smartfoxserver software! :/)

Now its most likely just java.

But, i need to know. how do i convert a php array into java?

I wrote a MASSIVE array, and it took me over 15 hours to code it (it was f**king tedious i tell you)

And i just hope to god there is an easy online conversion or anything and was hoping one of you guys can help me out?

Thanks so much :D

Note, ill upload the array soon for if anybodys interested? :P
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

note: Thank god for backup drives.

I lost the original, and its over 4,000 lines long and not quite complete yet :P
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: how to?

Post by jacek »

What does an array in java look like ? You could include the file with php and then use implode and write the result to a file.
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

well the arrays (annoyingly) have to be a certain datatype (eg. int or char) not a mixture like my php one is.

Also, you need a known length (i cant physically count how many data types i have)
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: how to?

Post by jacek »

bowersbros wrote:well the arrays (annoyingly) have to be a certain datatype (eg. int or char) not a mixture like my php one is.
php can work that out, is_int() is_bool() etc
bowersbros wrote:Also, you need a known length (i cant physically count how many data types i have)
php can also work that out.

and you still haven't said what they look like ;)
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

int[] cost = new int[15];
That creates an integer array named variable cost which is 15 fields long (goes up to cost[14])

same for any other type, eg.. double, char etc.
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: how to?

Post by jacek »

Oh you cant have mixed type arrays ?

I guess you need to work out a way to split it up then.
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

Oh joys.

I might either try to find a way to use php arrays with java, or just retype it all up again :(
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: how to?

Post by jacek »

bowersbros wrote:use php arrays with java
no.
bowersbros wrote:just retype it all up again :(
not the best way.

When I said split it up, I mean is there some logical way the data types can be separated ? A php script can do that actual separating.
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

but then I would have several different arrays, im not looking for that.

Ill post my current one so you can see what it is like:

/edit.

Change of plan.

Apparently my message went 48,171 characters over phpbb limit :(

Ill find a way to paste it, one minute

/edit: http://pastebin.com/1jN78pua
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
Tino
Posts: 360
Joined: Thu May 05, 2011 8:55 pm
Location: The Netherlands

Re: how to?

Post by Tino »

Use pastebin or something?
Please check out my CodeCanyon items.
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

Tino wrote:Use pastebin or something?
have done :)
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
Tino
Posts: 360
Joined: Thu May 05, 2011 8:55 pm
Location: The Netherlands

Re: how to?

Post by Tino »

Java is an OO language, right? Isn't there some way to convert a PHP array to a Java object?
Please check out my CodeCanyon items.
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

thats what I was thinking, but i couldnt find anything on google.
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: how to?

Post by jacek »

bowersbros wrote:thats what I was thinking, but i couldnt find anything on google.
What does an object look like ?

You need to create the syntax with php and write it to a file.
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

What is the best way for a huge settings file? It will be called on almost every single page (if not all)

should i just make a huge database table so i only fetch what i ened insead of the entire file?

It will also allow multi datatypes
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: how to?

Post by jacek »

If the settings change a lot that would be a good way to make them easy to update.
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: how to?

Post by bowersbros »

jacek wrote:If the settings change a lot that would be a good way to make them easy to update.
Well.. they wont change alot. but they will change gradually ;)

Any idea what fields i should have to set that up? or should i have 1 table for each type (buildings, troops, resource, capacity, etc.)
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: how to?

Post by jacek »

bowersbros wrote:Any idea what fields i should have to set that up? or should i have 1 table for each type (buildings, troops, resource, capacity, etc.)
It depends how the data will be used, you could do it like that, or have it all in one massive table.
Image
Post Reply