Truthfully, I would be more interested in a program that let people play your games online. If I am anywhere I am ready and willing to work on my game, everything I need is on my computer, and I would already have my computer with me, being able to edit online seems a tad pointless.
Being able to host the game online to play would be AMAZING though! Post that up on some facebook, and watch the like's roll in! heh...I wish...
We are Narkotix Team! We call ourselves such, because we aim to make games that are addicting as drugs!
(and no, we don't condone, or do drugs.)
Being able to host the game online to play would be AMAZING though! Post that up on some facebook, and watch the like's roll in! heh...I wish...
We are Narkotix Team! We call ourselves such, because we aim to make games that are addicting as drugs!
(and no, we don't condone, or do drugs.)
Narkotix Team wrote:
Truthfully, I would be more interested in a program that let people play your games online. If I am anywhere I am ready and willing to work on my game, everything I need is on my computer, and I would already have my computer with me, being able to edit online seems a tad pointless.
Being able to host the game online to play would be AMAZING though! Post that up on some facebook, and watch the like's roll in! heh...I wish...
Being able to host the game online to play would be AMAZING though! Post that up on some facebook, and watch the like's roll in! heh...I wish...
You're confusing Java with Javascript. This is a standalone program.
If there is anyone out there who knows Java, I'm kinda stuck on a particular problem...
http://stackoverflow.com/questions/9845940/how-do-i-handle-a-multi-type-tree-system-in-java
Also, here's a prototype GUI:
http://stackoverflow.com/questions/9845940/how-do-i-handle-a-multi-type-tree-system-in-java
Also, here's a prototype GUI:
I'm no Java expert, but I think Thomas has it here. You don't need generics; you could do something like this:
This might not be exactly the way to go about it, but I've seen this design pattern elsewhere. In that particular example, it is a lot more forgiving about type conversion, but again, I'm no Java expert.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Code:
private int intData;
private double floatData;
private String stringData;
int getInt() {
if (type == INTTYPE) return intData;
throw WrongTypeException;
}
double getFloat() ...
String getString() ...
ReloadNodeType getType() ...
private double floatData;
private String stringData;
int getInt() {
if (type == INTTYPE) return intData;
throw WrongTypeException;
}
double getFloat() ...
String getString() ...
ReloadNodeType getType() ...
This might not be exactly the way to go about it, but I've seen this design pattern elsewhere. In that particular example, it is a lot more forgiving about type conversion, but again, I'm no Java expert.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Yeah, I don't really know java either, but you only need to be able to read and write the tree structure to/from a file. There is no need to exactly re-create reload's tree-structure with java, since you can just use some existing java tree structure. (We don't have that luxury in FreeBasic, but I would love it if we did)
The different integer RELOAD on-disk node types should all be loaded to a single in-memory integer RELOAD node value type. There are different on-disk integer types just so that the most efficient one can be used when serialising the tree. The OHR's RELOAD implementation distinguishes between in-memory and on-disk node types. You're not the first to make this mistake; the documentation should be improved. (Edit: did so, but there's not much to see)
Also, technically a string node with value "3" and an integer node with value 3 are equivalent ways of encoding the same value, but we don't currently depend on that flexibility. Unless you create a RELOAD document using xml2reload (resulting in the string "3" being optimised to the integer 3), which your implementation wouldn't handle.
Also, technically a string node with value "3" and an integer node with value 3 are equivalent ways of encoding the same value, but we don't currently depend on that flexibility. Unless you create a RELOAD document using xml2reload (resulting in the string "3" being optimised to the integer 3), which your implementation wouldn't handle.
Here is the improved RELOADNode class:
Also, the limits are there so that an inappropriate value for the type won't be written to disk during serialization.
Code:
package hamsterwrench.data.reload;
/**
* @author Matt
*
*/
public class RELOADNode {
//declarations
private ReloadNodeType type;
private short byteData;
private short shortData;
private int intData;
private long longData;
private double floatData;
private String stringData;
//constructors
public RELOADNode() {
type = ReloadNodeType.NULL;
}
public RELOADNode(short data, boolean isByte) throws ReloadOutOfBoundsException {
if(isByte){
if(data >= 0 && data < 256){
type = ReloadNodeType.BYTE;
byteData = data;
} else throw new ReloadOutOfBoundsException();
}
else{
type = ReloadNodeType.SHORT;
shortData = data;
}
}
public RELOADNode(int data){
type = ReloadNodeType.INT;
intData = data;
}
public RELOADNode(long data){
type = ReloadNodeType.LONG;
longData = data;
}
public RELOADNode(double data){
type = ReloadNodeType.FLOAT;
floatData = data;
}
public RELOADNode(String data){
type = ReloadNodeType.STRING;
stringData = data;
}
public short getByteData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.BYTE) return byteData;
else throw new ReloadWrongTypeException();
}
public void setByteData(short byteData) throws ReloadWrongTypeException, ReloadOutOfBoundsException {
if(type == ReloadNodeType.BYTE){
if(byteData >= 0 && byteData < 256) this.byteData = byteData;
else throw new ReloadOutOfBoundsException();
}else throw new ReloadWrongTypeException();
}
public short getShortData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.SHORT) return shortData;
else throw new ReloadWrongTypeException();
}
public void setShortData(short shortData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.SHORT) this.shortData = shortData;
else throw new ReloadWrongTypeException();
}
public int getIntData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.INT) return intData;
else throw new ReloadWrongTypeException();
}
public void setIntData(int intData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.INT) this.intData = intData;
else throw new ReloadWrongTypeException();
}
public long getLongData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.LONG) return longData;
else throw new ReloadWrongTypeException();
}
public void setLongData(long longData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.LONG) this.longData = longData;
else throw new ReloadWrongTypeException();
}
public double getFloatData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.FLOAT) return floatData;
else throw new ReloadWrongTypeException();
}
public void setFloatData(double floatData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.FLOAT) this.floatData = floatData;
else throw new ReloadWrongTypeException();
}
public String getStringData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.STRING) return stringData;
else throw new ReloadWrongTypeException();
}
public void setStringData(String stringData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.STRING) this.stringData = stringData;
else throw new ReloadWrongTypeException();
}
}
/**
* @author Matt
*
*/
public class RELOADNode {
//declarations
private ReloadNodeType type;
private short byteData;
private short shortData;
private int intData;
private long longData;
private double floatData;
private String stringData;
//constructors
public RELOADNode() {
type = ReloadNodeType.NULL;
}
public RELOADNode(short data, boolean isByte) throws ReloadOutOfBoundsException {
if(isByte){
if(data >= 0 && data < 256){
type = ReloadNodeType.BYTE;
byteData = data;
} else throw new ReloadOutOfBoundsException();
}
else{
type = ReloadNodeType.SHORT;
shortData = data;
}
}
public RELOADNode(int data){
type = ReloadNodeType.INT;
intData = data;
}
public RELOADNode(long data){
type = ReloadNodeType.LONG;
longData = data;
}
public RELOADNode(double data){
type = ReloadNodeType.FLOAT;
floatData = data;
}
public RELOADNode(String data){
type = ReloadNodeType.STRING;
stringData = data;
}
public short getByteData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.BYTE) return byteData;
else throw new ReloadWrongTypeException();
}
public void setByteData(short byteData) throws ReloadWrongTypeException, ReloadOutOfBoundsException {
if(type == ReloadNodeType.BYTE){
if(byteData >= 0 && byteData < 256) this.byteData = byteData;
else throw new ReloadOutOfBoundsException();
}else throw new ReloadWrongTypeException();
}
public short getShortData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.SHORT) return shortData;
else throw new ReloadWrongTypeException();
}
public void setShortData(short shortData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.SHORT) this.shortData = shortData;
else throw new ReloadWrongTypeException();
}
public int getIntData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.INT) return intData;
else throw new ReloadWrongTypeException();
}
public void setIntData(int intData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.INT) this.intData = intData;
else throw new ReloadWrongTypeException();
}
public long getLongData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.LONG) return longData;
else throw new ReloadWrongTypeException();
}
public void setLongData(long longData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.LONG) this.longData = longData;
else throw new ReloadWrongTypeException();
}
public double getFloatData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.FLOAT) return floatData;
else throw new ReloadWrongTypeException();
}
public void setFloatData(double floatData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.FLOAT) this.floatData = floatData;
else throw new ReloadWrongTypeException();
}
public String getStringData() throws ReloadWrongTypeException {
if(type == ReloadNodeType.STRING) return stringData;
else throw new ReloadWrongTypeException();
}
public void setStringData(String stringData) throws ReloadWrongTypeException {
if(type == ReloadNodeType.STRING) this.stringData = stringData;
else throw new ReloadWrongTypeException();
}
}
Also, the limits are there so that an inappropriate value for the type won't be written to disk during serialization.
Ichiro wrote:
Here is the improved RELOADNode class:
I feel like I was helpful. Was I helpful?
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks



