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

Published August 01, 2012
Advertisement
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! smile.png
1 likes 11 comments

Comments

Programming020195BRook
Nice job so far!!! What made you think of making a game like this? :)
August 05, 2012 10:17 PM
Severin
[quote name='Black-Rook' timestamp='1344205030']
Nice job so far!!! What made you think of making a game like this?
[/quote]
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.
August 06, 2012 01:55 PM
Programming020195BRook
:) 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.
August 08, 2012 12:03 AM
Severin
[quote name='Black-Rook' timestamp='1344384230']
I hope to see more future projects from you![/quote]

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)

[quote name='Black-Rook' timestamp='1344384230']
I too had a Bible game in the works, something I will complete after a few other projects.[/quote]

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:

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

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.
August 08, 2012 07:30 AM
Programming020195BRook
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!
August 10, 2012 03:52 AM
Severin
And what genre will be your Bible related game?

[quote name='Black-Rook' timestamp='1344570726']
Sadly the A.I. took awhile to program and never got fully completed. I'm looking at reviving the game soon!
[/quote]

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.
August 10, 2012 06:35 AM
Programming020195BRook
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.
August 11, 2012 12:38 AM
Severin
[quote name='Black-Rook' timestamp='1344645519']
I just played NightGate, very nice work! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Will you be making more additions to the game, or releasing another version?[/quote]

Thanks [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] I do not think I will ever continue NightGate. If you would see the source code you would understand why. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] 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?

[quote name='Black-Rook' timestamp='1344645519']
My game will still be an RTS.
[/quote]

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?
August 13, 2012 08:20 AM
Programming020195BRook
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!
August 14, 2012 12:14 AM
Severin
[quote name='Black-Rook' timestamp='1344903297']
I'm finishing up the Classic RPG project, then off to the RTS! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img][/quote]
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.

[quote name='Black-Rook' timestamp='1344903297']
No I didn't reach level 2, got my butt whooped![/quote]
Sorry for that :)
August 14, 2012 08:05 AM
Programming020195BRook
I was playing on a higher diff. setting. :)
August 16, 2012 11:39 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement