Author Topic: Online Tek File Viewer  (Read 37015 times)

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« on: April 15, 2012, 08:21:39 PM »
I didn't know where to put it on here so here it is.

I was asking around on the chat about an idea for a simple little tool to make and TH300 came up with a tech tree viewer.  I decided to attempt to make it except put it online written in PHP.  I currently don't work on it very much, but I try to work on it.

Online OP2 Tek Viewer

EDIT: I know a tek file viewer already exists as a download, but I wanna try to make this better and easier to read the file.
« Last Edit: May 28, 2012, 06:52:46 AM by subbed74 »

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Online Tek File Viewer
« Reply #1 on: April 16, 2012, 02:43:04 AM »
If you want a viewer only, excel will do the job perfectly anyway.
"Nothing from nowhere, I'm no one at all"

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Online Tek File Viewer
« Reply #2 on: April 16, 2012, 05:06:19 AM »
My idea was that the viewer creates a nice chart as in e.g. Civ4, where the tree (really graph) structure is actually visible. A bit like this, but with better structure and detail info when a tech is selected.

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #3 on: April 16, 2012, 06:27:55 AM »
Oh.  I was thinking tables the whole time which would eventually say what that research requires and all that.  I guess I could try that.

EDIT: Unless you just want me to create new images of the tech tree.

EDIT 2:  Either way, I plan of at least trying to finish this since I posted it on here.
« Last Edit: April 16, 2012, 08:09:41 AM by subbed74 »

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Online Tek File Viewer
« Reply #4 on: April 16, 2012, 08:44:34 AM »
Now, as I think about it, new images would also be nice.

But images are always limited, because they can only display one particular tech tree, they usually don't have enough space for all the info that I want and they can't provide useful functions (such as generating a research list which leads to a specific research).

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #5 on: April 16, 2012, 03:41:47 PM »
What I could do as well is create different pages for each tek file which when you click it'll show you the info about the tech, what it requires, what it unlocks, and all that if you want me to.

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Online Tek File Viewer
« Reply #6 on: April 16, 2012, 05:30:53 PM »
What I want is something that is easy to use. I'm not entirely sure how that can be achieved. I described my idea. If you have a better one or want to add to it, go for it. Just ask yourself the questions:

- will the tech viewer help me in every particular situation?
- will it be comfortable enough, so that no one gets annoyed when using it for longer?
- will everyone understand how to use it?

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Online Tek File Viewer
« Reply #7 on: April 16, 2012, 11:18:38 PM »
This is kind of interesting. I wouldn't mind something interactive. It would be easier to explore the large tech trees with something interactive, and still have room to display detailed information on each tech. Trying to lump everything into one view generally doesn't fit all on one screen, and requires omitting a lot of information.

Summary information might also be useful, such as the total research points for a tech and all prerequisites. It might also be nice to know what the critical path is for a given tech. Multiple lines of research may be needed to unlock a tech, where each line can be researched in parallel at different labs. The longest such line would be the critical path, that determines the minimum time required to obtain the tech (assuming ample resources, such as labs and scientists).
 

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #8 on: April 17, 2012, 08:29:29 AM »
I guess I'll try to make a page for each tek file to show the tree.  But it most likely won't look very good because I'm not very good at layouts.

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #9 on: April 25, 2012, 09:19:02 PM »
The projects will be going temporarily inactive because I have an orchestra concert coming up on Sunday and I need to practice for it.

EDIT: I'll still be coming on here to check the forums and reply to something if the topic interests me or something.
« Last Edit: April 25, 2012, 09:19:38 PM by subbed74 »

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #10 on: May 23, 2012, 09:16:48 PM »
I should be able to start to try working on this after tomorrow.  My last 2 finals are tomorrow.

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #11 on: May 28, 2012, 06:52:14 AM »
YAY I'm a sophomore.

Anyway,  it now shows the tech id's associated with the research.

Link Updated.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Online Tek File Viewer
« Reply #12 on: May 29, 2012, 03:34:07 AM »
How are you producing the tables?
 

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #13 on: May 29, 2012, 08:02:36 AM »
Code: [Select]
HTML:
<table border="1">
<tr><th>Tech Names:</th><th>Tech IDs:</th><th>Category:</th></tr>
<?php
echo $data;
?>
</table>
Code: [Select]
PHP:
<?php
$yay = explode("\n", file_get_contents("flsurvtek.txt"));

$data = "";

foreach ($yay as $tek) {
 //Get the data from the first line
 if (preg_match("|BEGIN_TECH|i", $tek)) {
  if (preg_match('/"([^"]+)"/', $tek, $n)) {
   $data .= "<tr><td>".$n[1]."</td>";
  }

  $tek = str_replace(" ", ":::", $tek);
  $tekarray = explode(":::", $tek);

  if (strstr($tekarray[2],"0") || strstr($tekarray[2], "1")) {
   $data .= "<td>".$tekarray[2]."</td>";
  }
  if (strstr($tekarray[3],"0") || strstr($tekarray[3], "1")) {
   $data .= "<td>".$tekarray[3]."</td>";
  }
  if (strstr($tekarray[4],"0") || strstr($tekarray[4], "1")) {
   $data .= "<td>".$tekarray[4]."</td>";
  }
  if (strstr($tekarray[5],"0") || strstr($tekarray[5], "1")) {
   $data .= "<td>".$tekarray[5]."</td>";
  }
 }

 //Get the data from the second line
 if (strstr($tek,"CATEGORY")) {
  $tek = str_replace(" ", ":::", $tek);
  $tekarray = explode(":::", $tek);
  $data .= "<td>".$tekarray[12]."</td></tr>";
 
 }
}
?>

I don't really know why I went from preg_match() to strstr().  Anyway, this works fine, if I was to switch the tek file I believe it would still work.  I have 2 files uploaded on their, flsurvtek and multitek to test if it works with a custom tek and a regular tek.
« Last Edit: May 29, 2012, 08:04:37 AM by subbed74 »

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #14 on: May 30, 2012, 11:03:21 PM »
I'm currently working on getting a little system to work with the REQUIRES so that way instead of showing the tech id of the research, it'll show the actual name.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Online Tek File Viewer
« Reply #15 on: May 31, 2012, 01:18:42 AM »
Interesting. Have you considered perhaps converting the tech file to JSON format, and having the client generate tables from that using JavaScript? I wonder if there may be some benefits to that approach.

You can probably manage interactivity easier using a JavaScript approach. Perhaps have a detailed view of a tech popup when clicking a row in a summary table. With JavaScript it could be done without having to reload the page. Mind you, I say this without really knowing exactly how the code would look, only with the vague knowledge that it can be done.


Oh, and that would be nice to see the name of the requires rather than just a numeric ID. Come to think of it, that was one thing I wasted a lot of time on when reading the tech files. I was constantly scrolling around to lookup tech IDs to see what things were linking to.
 
« Last Edit: May 31, 2012, 01:19:43 AM by Hooman »

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #16 on: May 31, 2012, 08:42:37 AM »
I could try that with jQuery.
« Last Edit: May 31, 2012, 09:48:50 AM by subbed74 »

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #17 on: June 07, 2012, 12:26:52 AM »
I'm going to be kind of rewriting it so it can be in some what of a final version.  You'll be able to click the tek you want to view and the information will show in a box.

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #18 on: September 03, 2012, 06:55:03 PM »
I've lost the files.  Completely.  There was a server move and it failed.  Every file was lost except for local backup files which I had none for this project.  If you need proof let me know because I've not finished a project on here before but still.

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Online Tek File Viewer
« Reply #19 on: September 04, 2012, 06:34:29 AM »
Bad things happen. I believe you, why would I not?

But weren't you going to rewrite it anyway?

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Online Tek File Viewer
« Reply #20 on: September 06, 2012, 01:38:59 AM »
Use the SVN repository. :P


I'd actually kind of forgotten about this project. Guess that means I can't be too heart broken. I does kind of get me thinking about some of the few things I've learned about web programming though. Maybe you should post more thoughts on this project, even if you have no code to look it. It might start some interesting discussion.
 

Offline Venera

  • Full Member
  • ***
  • Posts: 120
Online Tek File Viewer
« Reply #21 on: September 06, 2012, 09:10:31 AM »
I was going to rewrite but I still would've like to kept the code.

Hooman I've never used the SVN and if I did, would it be able to run PHP code?
« Last Edit: September 06, 2012, 03:12:46 PM by subbed74 »

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Online Tek File Viewer
« Reply #22 on: September 07, 2012, 01:37:37 AM »
SVN just stores and distributes code. It doesn't run the code. It's main benefits are you have a history of all changes, it helps to synchronize those changes with other people you might be working with, and by default you have a remote copy stored on some other computer so you don't lose everything if your harddrive crashes.

The history tracking and remote backup benefits are more than enough to convince me to store all my projects in some kind of version control system, such as SVN. The network distribution of code really shines though if you're working with other people, or even if you just have multiple development machines. If you need to switch to a different computer, or get a code update that someone else pushed, it takes a whole two clicks to update a working copy. You can be up and running on a new machine in no time, and you don't even need any pre-planning, such as zipping up your code to transfer to a new computer.

Version control systems make passing around of zip files incredibly antiquated. If you've ever tried working in parallel with someone else on the same project, you'll find that passing zip files back and forth doesn't scale well. Having two people work on two separate features at the same time for the same project is really easy with a good version control system though. Basically: You make and test changes for the feature you're working on, and commit those changes to the repository. Then you email, instant message, or shout over the cubicle wall telling the other person to update. Then continue working on your next feature. When they've committed changes and tell you to update, you just run an update and their changes are merged into what you're working on.

Some more detail: With TortoiseSVN, you commit by right-clicking on the project folder in Windows Explorer (not Internet Explorer), and choosing commit. You type a quick commit log message that summarizes the changes your making, and then those changes are sent to the server. It actually only sends a diff of what you've changed since your last update, so if you change one byte in a 1GB file, the commit will only describe that 1 byte that changed, so you don't need to send a full 1GB to the server. Similarly, when you update, you only get a diff of what changed since your last update. So if someone made a 1 byte change to a 1GB file,  you don't need to download the whole thing again, you just get a description of that 1 byte change.

And of course if you don't like any particular change, having complete history and built in revert capability means you can undo changes quite easily. Ever gotten an hour or two into a big long change that breaks your code base before you realize there's a better way, or that your whole plan was flawed and isn't going to work? That moment right there sure makes you appreciate the concept of history.
 

Offline Lukc

  • Newbie
  • *
  • Posts: 46
    • http://lukc.upyum.com
Online Tek File Viewer
« Reply #23 on: September 08, 2012, 12:15:14 AM »
Well, I disagree with Hooman on using SVN. git or Mercurial are much faster, particularly when the repositories are becoming big, and they exist to solve the exact same problems.

Also, those VCS are decentralized, which means if you server goes down, you’ll still be able to use your repository, or to prepare a new server with your local repository.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Online Tek File Viewer
« Reply #24 on: September 08, 2012, 04:28:01 AM »
I was trying to be non-SVN specific for much of that for a reason. I would agree the distributed repository model that Git follows has some very nice technical advantages.

However, I've found the existing tooling to be somewhat less satisfying than what's currently available for SVN.  If you want to use TortoiseSVN on Windows, it's one package to download and install, and it's easy to get running and understand. If you want to use TortoiseGit, it's two separate packages from two separate websites that you have to download and install, and then it seems to do weird things out of the box that you likely won't understand at first. For instance, files showed up as modified after a fresh checkout. Apparently it was mapping Unix newline characters to Windows newline characters for text files, and then doing a binary compare of the files to see if they were modified.

Sure, I will admit Git has technically superior features, but it's also noticeably less user friendly. If you're a professional programmer, having to figure out and deal with Git may very well be worth your time, but if you're just dabbling and don't care that much, you'll probably find SVN more pleasant to use. SVN is still easier to understand, generally has slightly better integration of software, and much more help and documentation available, should you actually need it, and that documentation is often more accessible to people new to the topic of version control. Git has been making significant progress in those areas, and seems to be closing the usability gap fairly fast, but I don't believe it's quite as far along as SVN is in that respect. I would guess it might still be a few more years before Git becomes about as easy to install and use as SVN. In the meantime, I believe there is still plenty of room for both Git and SVN use.

Using CVS however seem pretty antiquated at this point. There's a company in the building where I work that still uses CVS. I'm not really sure why. I suppose they just happened to use it back in the day when CVS was the only well know version control system around, and they never bothered to switch. I can't think of any reason to use CVS over using SVN. SVN is basically designed to be a better CVS, with similar usage and workflows, but generally better performance and a few very useful feature additions. (Perhaps what some people consider Git to be over SVN, although I don't think it's quite there yet). I was introduced to CVS and RCS once back in the day. The concept was kind of neat, but we quickly reverted to passing around zip files at the time. SVN was *much* more compelling. Git is perhaps even a little more compelling, but still has a few added nuisances.