Jump to content

Simplest/Most Efficient Manner To Perform Something


Usarjjaco

Recommended Posts

Hello Guys,Scenario: I'm using user X, user X can travel in any direction on my grid (Which isn't in the database, all the events are randomly generated no matter where they are)Issue: The grid is topographically being based off of real world geographics, so I need to prevent people without water transportation from going on water "grid spaces" so to speakSolutions: The only way I can think to do it is to create a massive MySQL DB that contains all the grid points and then label it as a water grid or not... I am really hoping there's ab etter way because that would be thousands of entries.Let me know what you guys think! Thanks!

Link to comment
Share on other sites

That's the thing, right now it works like this:The player chooses a starting grid location: xxxx yyyyThe grid location moves as they moveEverything they run into is random generated, and items only get placed (like buildings) if they barricade them.But I think the flaw is that I can't find an easy way to implement "water" without mapping the WHOLE grid out...So in simple words the "Grid" isn't stored in the database right now.

Link to comment
Share on other sites

Like justsomeguy said, you've got to have some way of identifying what kind of area the user is over...water or land. That's why I asked how the location was derived, as there may be some way to determine that. Without knowing how the location is picked or selected or what the source of the data is, I couldn't even guess at how to begin. Wirehopper's suggestion of using layers might be a good way to go, but again, you have to have some way of knowing whether the user is over water or not first.

Link to comment
Share on other sites

End,Yeah I do realize what you guys are saying. I guess my question is since I don't have a identifier system yet... what would be the easiest way to go about that? Do I need to create a MySQL table and insert a row for every grid? I was hoping it wouldn't come to that but I don't see a way to streamline it.

Link to comment
Share on other sites

If the map is randomly generated, then wouldn't you also generate whatever characteristics apply to each tile? Either the map is stored, or it's random. If it's stored, information about each tile is stored with it. If it's random, then you generate that information yourself. Either way, it seems like you should always have access to all of the information about each tile.

Link to comment
Share on other sites

The grid is topographically being based off of real world geographics
This is your answer.I'd recommend studying the APIs for some of the major map systems - Google, Yahoo, and MapQuest (apologies if they've merged or renamed or multiplied).Use them.To store objects in the grid or game, I'd use lat/lon coordinates in a database, with some descriptive text and possibly an icon file, which contains an image that can be placed on the map.Even if you don't display the maps, the APIs will allow you access to the data.http://code.google.com/intl/en/apis/maps/I've worked with Google and Yahoo APIs - they're really fun. Wander through their documentation and see which one looks like it will support your project best.http://www.googlemapsforum.com/archive/index.php?t-182.htmlhttp://osdir.com/ml/google-maps-api-for-fl...7/msg00036.htmlYou might want to try things like requesting an address for a lat/lon over empty land, a city, and water to see what you get. That's what I'd start with. I suspect this is one of those projects where creativity is key.
Link to comment
Share on other sites

This is your answer.
Well, either the map is randomly generated or it's not. He definitely said it's randomly generated. I assume that also means whether or not a given tile is water or land. If it's based on a real map, then it's not randomly generated.
Link to comment
Share on other sites

Well, either the map is randomly generated or it's not. He definitely said it's randomly generated. I assume that also means whether or not a given tile is water or land. If it's based on a real map, then it's not randomly generated.
No, he didn't. He said "the events are randomly generated no matter where they are", but the that the "grid is topographically being based off of real world geographics".
Link to comment
Share on other sites

I found this, but don't know if it'll help or not:http://www.googlemapsforum.com/archive/index.php?t-182.html"There is a public domain database of world geographic data called VMAP0. There are many different kinds of data in there, but it is structured in a mostly sensible way. There is coastline data in a file called coastl.lft, but you'll have to investigate to determine if that's really what you need.VMAP0 can be downloaded here:http://www.mapability.com/index1.html?http...map0_index.htmlGetting something useful out of this data set may require a lot of work. You might have to write your own parser for the data and/or containment tests to see if a point is within coastline boundaries. You could probably make use of the Jordan curve theorem to perform this kind of test. There's an example at http://www.ecse.rpi.edu/Homepages/wrf/Rese...tes/pnpoly.html.As you can see, this is a very "from scratch" solution, but I don't yet know of a simpler way to do it. At least there is a freely available source for this data."

Link to comment
Share on other sites

I assumed that water was included in "everything they run into".
I think he meant items or objects. It wasn't/isn't totally clear to me either.Edit: After a little research, it seems that from what I can tell, the Google Maps API doesn't include a way to query for "over water" or "over land". At least not yet. I had thought that might be a quick and easy way to solve this, but apparently not.
Link to comment
Share on other sites

I think he meant items or objects. It wasn't/isn't totally clear to me either.Edit: After a little research, it seems that from what I can tell, the Google Maps API doesn't include a way to query for "over water" or "over land". At least not yet. I had thought that might be a quick and easy way to solve this, but apparently not.
What I meant was - The things they run into (Buildings, Etc) are pulled from a database at random. The building becomes a stationary object with a grid coordinate if it gets barricaded...Thanks for all the help guys. I appreciate it. I'll probably just end up plotting the whole grid out. On another topic ...Trying to set up all the Chron Jobs now.Using CPanel and trying to run a few .php files.... and I have one running once a day on another mySQL database ( A Joomla one) ... the database I'm trying to run it on now is a database I created from scratch... and it's a .php file that's accessible thru the site. I've looked everywhere and every solution I find to how to set it up has failed me so far...Tried:cd '/home/username/public_html/directory/'; php -q 'zombieupdate.php' /ramdisk/bin/php5 -f /home/username/public_html/directory/dayageupdate.phpAnd several others similar. I get one of these 3 e-mails, and sometimes no e-mail at all (Running every minute while I'm setting it up)Blank E-mailOr:Status: 404 Not FoundX-Powered-By: PHP/5.2.13Content-type: text/htmlNo input file specified.Or:No input file specified.Any ideas??? Thanks guys.
Link to comment
Share on other sites

<?php//Initialize Server SQL Connection Or Show Error$con = mysql_connect("localhost","theripti","EmmyBarla1025!!");if (!$con)  {  die('Could not connect: ' . mysql_error());  }//Connect To Databasemysql_select_db("theripti_zombies", $con);//ZOMBIES LIFE UPDATEmysql_query("UPDATE * FROM zombies SET alive='Y'");mysql_query("UPDATE * FROM zombies SET health=100");?>

That is the entire thing, I have other scripts that are just like this that I'm having the same problem with. It's just simple queries to update databases like refilling health, money, etc.I also tried putting #!/usr/local/bin/php -qOn the top of that .php file with no luck.

Link to comment
Share on other sites

Got This With Your Suggestion, seems to just read out the PHP info.X-Powered-By: PHP/5.2.13Content-type: text/html======================It's worth noting that I was able to get one script running from a different directory for a different DB.I got that to work by luck using:/ramdisk/bin/php5 -f /home/username/public_html/virtuarancher/dayageupdate.phpBut I can't get this file to work with that php access: /home/username/public_html/directory/update.php

Link to comment
Share on other sites

You might want to grant execute privileges to the script owner and others.chmod 755 update.php
Changed the permissions to 755 for said file. Still not having any luck. It sends me blank e-mails now like it is running without an error, but the database isn't updating.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...