Topic:   [Processing] New Level Editor   (Read 9139 times)


0 Members and 1 Guest are viewing this topic.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
[Processing] New Level Editor
« on: November 20, 2012, 03:19:07 PM »
I've decided to make my own program to make levels for my SC game. Chances are if I do it right it could be reprogrammed to work for Space Marines or other games.

The following code lets you select a text file and imports that data:

Code: [Select]
  
void setup() {
  selectInput("Select a file to process:", "fileSelected");
}

void fileSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    println("User selected " + selection.getAbsolutePath());
  }
  String lines[] = loadStrings(selection);
  println("there are " + lines.length + " lines");
  for (int i =0 ; i < lines.length; i++) {
  println(lines[i]);
}
}

I think Processing will be perfect since it has a lot of convenient functions for file I/O. And real 2D arrays.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: [Processing] New Level Editor
« Reply #1 on: November 20, 2012, 04:34:46 PM »
Cool stuff.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Level Editor Progress!
« Reply #2 on: November 21, 2012, 12:51:21 PM »

The editor, with space on the right for an interface. Processing is fantastic for making simple programs with graphics.
So far I can draw with the mouse, but the controls are all the keyboard.
Eventually I want it to be user friendly with buttons rather than a read-me listing all the key shortcuts.

Next step: Program functions to save and load via .txt files (ugh) :)
« Last Edit: November 21, 2012, 12:59:41 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: [Processing] New Level Editor
« Reply #3 on: November 21, 2012, 03:14:25 PM »
Ooooh.
Does processing have networking support?

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: [Processing] New Level Editor
« Reply #4 on: November 21, 2012, 04:00:12 PM »
I don't know the specifics but you could check http://processing.org/. I do know that it has separate modes for Java, Javascript or Android and you can import libraries. So you could probably use the same libraries you have before.
« Last Edit: November 21, 2012, 04:07:15 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: [Processing] New Level Editor
« Reply #5 on: November 21, 2012, 06:19:30 PM »
This processing is looking fantastic! Apparently it can run in the browser as well as an application. And it can handle 2D and 3D.

Connors, Imma read more on this but if you could make a video on how you made the level editor, I'd be very interested.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: [Processing] New Level Editor
« Reply #6 on: November 21, 2012, 06:36:59 PM »
It's not an extremely complex program, I just referred to the command reference on the site. I can post the project file soon. Maybe I will make a video about setting up the grid and stuff.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: [Processing] New Level Editor
« Reply #7 on: November 21, 2012, 08:08:19 PM »
I must learn more!

I have ideas. Good ideas. Ideas of greatness. Using processing I can make a Java server. Also in processing I can probably make a Javascript client. Therefore making an online game using processing alone!
Of course the game could also be made as Java. Oh man this is exciting.

Learn, I must.

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: [Processing] New Level Editor
« Reply #8 on: November 22, 2012, 09:28:35 PM »
This is interesting.  I'll be keeping an eye on this.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: [Processing] New Level Editor
« Reply #9 on: November 22, 2012, 10:52:39 PM »
Well, it now has functions to save and load .txt files that can be pasted right into the code of my game so I can finally get to work on making more content. I've attached my source code below.

Use number keys 0-4 to select objects:

0 - empty
1 - solid
2 - deadly
3 - player start
4 - goal

Pressing down arrow will create and save to a file called output.txt in the same directory as the app (I'll change this so it brings up a dialogue later).

Pressing up arrow will allow you to select a file to open.

I plan on changing the controls and adding some more to the game so you can try to make levels but they may not work the same in the final game.
« Last Edit: November 22, 2012, 10:56:58 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: [Processing] New Level Editor
« Reply #10 on: December 15, 2012, 06:57:41 PM »
I'm very proud of this latest development. I'm making a mockup of a game concept that will hopefully be complete enough in a couple days for me to submit as a Ludum Dare/Jam entry. What I've done today is I began to port my "grid-nav" engine to Processing, beginning with a way to store levels. I just got a function working which reads files from the sketch data folder line by line. The input is of course the filename to load. Most of the following is borrowed directly from the reference page on createReader().

Code: [Select]
void loadLevel(String lvl) {
  String line;
  boolean loop = true;
  BufferedReader reader = createReader(lvl);
  while (loop) {
    try {
      line = reader.readLine();
    } catch (IOException e) {
      e.printStackTrace();
      line = null;
    }//catch
    if (line == null) {
      loop = false;
    } else {
      println(line);
    }//if
  }//while loop
}
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: [Processing] New Level Editor
« Reply #11 on: December 15, 2012, 07:30:46 PM »
Lookin good.