Steps to create a basic data center?

32 views
Skip to first unread message

Christopher Lehn

unread,
Oct 18, 2015, 9:26:52 PM10/18/15
to Hax Simulator
I can't seem to figure out how it works. I've tried editing the text of the Sample data center's .groovy files, but the result fails to initialize. I managed to get eclipse set up but I couldn't figure out how it functions once it was installed.

So the title says it all. How do you go about creating a data center?

Hax Simulator

unread,
Oct 26, 2015, 12:11:45 PM10/26/15
to Hax Simulator
Hi, thanks for your interest.
To create a basic data center, you simply need to create the dc.groovy and dcgui.groovy files. Of course, the files need to be a syntactically correct groovy source files.
Your attempt of editing the sample data center is the correct approach. I believe the problem is something with the syntax, or an uninitialized variable. It is hard to tell without the error message.
The most basic data center would be a single switch with a workstation connected to it. Here is the content of the configuration files:

dc.groovy:
def workstation1 = machine {
    name
"workstation1"
    firmware
()
    terminal
()
    storage
{
        boot
"${HAX_HOME}/soft/haxos.jar"
        network
"192.168.2.10"
   
}
    network
()
}

def switch1 = machine {
    name
"switch1"
    firmware
()
    storage
{
        boot
"${HAX_HOME}/soft/haxswitch.jar"
        network
"192.168.2.0 255.255.255.0"
   
}
    network
()
    network
()
    network
()
}

wire switch1
, 1, workstation1

dcgui.groovy:
machines()
terminals
()

If you want to add more workstations, just define them by adding a
def workstationX = machine { ... }
defining a network address in the range 192.168.2.0/24 inside the storage {...} block.

then add a new network interface to the switch using the statement
network()
inside the switch's machine { ... } block.

Finally, connect the new workstation to the switch using
wire switch1, X, workstationX

If you still have problems or you want help with a specific network topology you want to create, feel free to ask. Please post any error messages you might encounter, or even the data center configuration files that do not work for you.
Cheers



Christopher Lehn

unread,
Oct 27, 2015, 6:02:16 PM10/27/15
to Hax Simulator
It may seem a lot to take on, but I'm hoping to jump-start your multiplayer aspect by creating a corporate network for a fictional game studio, which could be connected to the general internet of Hax networks.

After following your instructions, I now have a single workstation connected to a switch, and I used the shortcuts trick posted at https://groups.google.com/forum/#!category-topic/hax-simulator/general-discussion/H5zt6KIINeQ to be able to open it with a double-click. The basic template now functions, but how would I go about adding a "web page" like what you did in the Dark Signs re-creation?

Hax Simulator

unread,
Oct 29, 2015, 2:27:34 PM10/29/15
to Hax Simulator
You are basically trying to achieve what is done in tutorial05, so I recommend checking all the sources for it.
To implement a "web server", there are 2 possible approaches.

The simpler one, which also was used in Dark Signs, is writing all the "web pages" as tasks. Take a look at the tutorial data center. In the script/tutorial05 directory, there is a number of "web page" tasks implemented.
For example, the ISPHome and the ISPBoard tasks. See also the referring machine configuration in dc.groovy (the machine is called tutorial05_isp).
Also, the sample data center has some tasks, e.g. the level3 ones, well commented, which could be used as blueprints for what you want.
What you basically do here is implement an interactive task that reads input from and writes output to the terminal. Then, using the remote task daemon (rtaskd) you are able to publish the task on an arbitrary port (the command to do this is contained in the tutorial's dc.groovy file, so that the task is always published upon data center startup).

The more complex (and closer to real-life) approach would be to implement a generic "web server" task, that would serve "web pages" just like a real-life web server (e.g. apache). It would be an interactive task just like in the first approach, but the content to display and accepted user input would be externalized (content and configuration files on the machine's file system), instead of hard-coded inside the task. So, you'd have to basically implement an interactive task that would take user input, then, based on the user input (and possibly some external mapping configuration file), select a file on the file system of the machine containing the "web page" content, and display the contents of the file. The advantage of this approach would be obvious - you could use the same task on any machine acting like a web server, and just provide the necessary data for it on the machine's file system. And this is exactly what I intended the community to do - implement the equivalents of real-life technology.

If you have any further questions, don't hesitate to ask.

Christopher Lehn

unread,
Oct 29, 2015, 8:15:05 PM10/29/15
to Hax Simulator
The second option sounds better, because it would future-proof the site, but considering that there is no such generic web server task, I realize now I am in over my head. I can edit a text file and recognize the basic concepts programmers use, but I am no programmer and actually making something new is beyond my capabilities.

Sorry that I couldn't help make this game better. I hope someone else with more skill will try to do what I intended to do and create a flourishing community. Good luck! :)
Reply all
Reply to author
Forward
0 new messages