Jump to content

  • Log In with Google      Sign In   
  • Create Account





Ruins: level building/load/save and a new single player level

Posted by Severin, 01 August 2012 · 920 views

save load level editor new level ruins plaformer coop puzzle
Ruins: level building/load/save and a new single player level Level building
Now it is possible to build levels using the mouse. This option is intended to be used only by me for now to build new levels but maybe later with a nicer user interface I could make a real level editor. But the feature is not disabled so anyone can try it in the demo. Right click selects a tile. Left click places a tile of the same type that was selected. Middle button can cycle through tile types and then you can paste those tiles with left clicks. The current selection is written to the Java console. Right clicking an empty area or cycling to OPEN type switches to erase mode.
For push plates it is possible to select them with right click and then see the door connections by pushing ’x’ key and switching on graphical debug display info. You can even toggle connections by left clicking doors.

Level saving
Pressing the CTRL key saves the current level as it is. But this works only on my pc in Eclipse because of applet security measures. All visible game objects have a common type (like PLAYER, SNAKE, WALL, etc…) that is an enum and this is saved for all tile positions. For empty tiles an OPEN value is saved. That saves all map objects. Then I have the push plates that are connected to the doors. These connections are saved as well. The program checks all push plates and for those that have doors (I use Observer design pattern for this) it places a ’p’ char in the file. For those that have no doors connected, an ’n’ char is placed. Then an int value is written that holds the number of doors connected. And then for all doors the x y tile coordinates are written.

Level loading
This was a bit difficult because this has to work in browser mode and normally the above mentioned applet security rules do not allow the applet to read a file. But fortunately it is possible to use getClass().getResourceAsStream(”filename.txt”).
ObjectInputStream ois = null;
ois = new ObjectInputStream(getClass().getResourceAsStream(filename));

New level
Using the new build feature I made a new level for single player mode. Now it is possible to use the ’1’ and ’2’ keys to change game mode when the game starts.

You can try the demo here:
belanet.ujmappa.hu/ruins/play.html

If you find bugs or have some ideas (like what new tile type to make) then comments are welcome! Posted Image




Nice job so far!!! What made you think of making a game like this? :)

Nice job so far!!! What made you think of making a game like this?

I started this game for these reasons:
•I wanted to do something that is good for developing my programming skills.
•I wanted to make a coop game that I can play with my wife's sister's 8 years old son. (What is the name for this kind of relationship?
•I wanted to choose a game style where graphics are not that important because I always had problems with finding help for that and my drawing skills are poor :)
•I have seen Fire boy and water girl (a flash game) and I was thinking "this game is very cool and I could probably make something even better with more traps, switches and monsters"
•And there is one more thing that might sound a bit strange to some: I wanted to make a game that has something to do with religion and has a chance to draw attention to the Bible. It is important to me because in the recent years I changed my world view I wanted to put some religious reference into my next game. My plan is that when the player gets the old scroll (the object he has to reach in the game) there will be a random quote displayed from the Bible.
:) I hope to see more future projects from you! I too had a Bible game in the works, something I will complete after a few other projects. Nice to see another person interested in creating such a rare game.

I hope to see more future projects from you!


Thanks! I do not have any project plans for the future yet, but maybe you could check out my older games:
http://www.belanet.ujmappa.hu/
(this one is an unfinished real-time fantasy defense/stategy game)

http://belanet.ujmap.../main_login.php
(a tower defense game, a remake of a Warcraft III map called Gem Tower Defense)

I too had a Bible game in the works, something I will complete after a few other projects.


And what game genre will that be?

I am going to include the Bible in my game because I believe it is more than just a book. For example one time after mass my mother asked me if I am in a hurry? (to go back home) I said yes because I really was. After this she gave me a random Bible quote on a small piece of paper she took from a box filled with such papers in the temple. And it said:

Psalm 119:6 "I hurry and do not delay to keep your commandments."

This was very funny because in reality I did not hurry to keep God's commandments, I had other things to do
I just mentioned this story so that you might understand better why I have this idea of including Bible quotes in the game.
Umm NightGate look fimlair for some reason! haha :) I'll try it this weekend.

It's an RTS game. I did a smaller version a few years back with C and Allegro 4. Sadly the A.I. took awhile to program and never got fully completed. I'm looking at reviving the game soon!
And what genre will be your Bible related game?

Sadly the A.I. took awhile to program and never got fully completed. I'm looking at reviving the game soon!


I think the AI is the most hard to program for an rts (at least for me it was). Pathfinding is not easy and it is very hard to decide what to do in different paths when many objects are in the way.
But it was fun to write nightgate and I had some nice side projects there during development. I remember one time I made a worker cut trees, bring them to position and build a house from it (you only had to select the position of the house). I also remember having units that had a hunger value and going to eat apples that were generated on apple trees. :)
But after a while my main funcion became very long and I had to spend most of my development time fixing bugs :(
This was in C++ so when I switched to Java I was surprised how fast I can proceed with building a game.
I just played NightGate, very nice work! :) Will you be making more additions to the game, or releasing another version?

My game will still be an RTS.

I just played NightGate, very nice work! Posted Image Will you be making more additions to the game, or releasing another version?


Thanks Posted Image I do not think I will ever continue NightGate. If you would see the source code you would understand why. Posted Image I was very lazy programming it and did not care much about design. After some time my main() function became hundreds of lines long. When I changed something in the code, I had to spend hours fixing bugs that were caused by dependencies I could not see first. So if I would have to start again NightGate, I would not use C++. I do not think that C++ is bad but I am sure that for me Java is much more convenient.
Did you reach level 2 when playing?

My game will still be an RTS.


Sorry I misunderstood you thinking you mean that for another game.
And what kind of units will the player control in that game? What will be the story?
I wont get into the story or game play yet, but I will be starting a new journal for this game next! I'm finishing up the Classic RPG project, then off to the RTS! :)

No I didn't reach level 2, got my butt whooped!

I'm finishing up the Classic RPG project, then off to the RTS! Posted Image

I checked the Classic RPG video, it looks very good. :) Did you draw the graphics yourself? I could imagine a similar game that could be played online in multiplayer with syncronized clocks that would make a turn pass every 5 sec or so.

No I didn't reach level 2, got my butt whooped!

Sorry for that :)
I was playing on a higher diff. setting. :)

October 2014 »

S M T W T F S
   1234
567891011
12131415161718
192021222324 25
262728293031 

Recent Comments

PARTNERS