My project - Action FPG FPS

Hi everyone,



As the name suggests, I’m developing an action RPG FPS with the jMonkeyEngine. Right now, its in its extremely early stages. All I have to show is a screenshot of the output of the random maze generator, thus far. Yes, it needs work.



I started with a modified depth first search algorithm, which is what I’m still mostly using, but it needs work. I have code to prevent it from bunch corridors too closely together, which is what is happening here, but it doesnt seem to work correctly. I’m thinking of instead inserting points into the level grid and then linking those points together. I suppose then I would need to make sure that the points were properly randomly distributed.



Anyway, the way it works thus far is that a LevelPatternFactory produces a LevelPattern, which a LevelBuilder then uses, at the moment, to return a spatial. It constructs the actual level by going through the LevelPattern and drawing the walls and floors in the manner specified by the LevelPattern. Works fairly well actually.



http://i.imgur.com/H99Gc.jpg



There is quite a bit of work left to do on the random level generation, as you can see. First I need to get it producing decent levels, then there are a lot of features I want to add for it, such as support for prefabricated sections, a third dimension, the ability to have outdoor as well as indoor sections in one level (read: procedural terrain generation), and support for entity marker placement. By entity marker placement I mean markers for monsters, powerups, etc etc. Those markers will be converted to the real thing in the LevelBuilder. Quick question, what happens if I attached a monster spatial to the level Node? Should entities only ever be attached to the rootnode?



I might get the random level generator to a stable state and then work on other things for a while. Next on my list is probably a basic GUI, attacking/taking damage, monsters and character classes. Did I say I have a lot of work to do? After I’ve added monsters and character classes I’ll need to do saving and loading. I also need to serialize the level patterns in case someone uses a town portal or something (which my game will more than likely have).



Artwork? No artwork, not yet. When the game gets far enough that a release looks likely (lets face it, not many hobby games are ever finished), then I’ll purchase stock artwork or look into a contractor. Sigh. Yes, I know it will be expensive, this is a very ambitious project.

1 Like

Thanks pspeed. I’ll update to the latest nightly tonight.

In terms of networking, specifically the valve type architecture, it is something I have been working on with my FPS code. It is available on google code; http://code.google.com/p/networked-fps/



I am not saying it is perfect, or that there is not a better way of doing things, but it works and at the very least will give some ideas. It uses TCP for now and the old spidermonkey stuff - I will port it to the newer stuff and switch to UDP at some point!



If you can think of better ways of doing things then please let me know and if any questions just ask.



Matt

Thanks Matt, I did check out your code and have been looking at it. It has been most useful. Only problem is that it does not use the new API! My new API based project is nearly working, so if I can get it to work then I might upload the code for others to look at.

Yeah I must get round to swapping it over! Would be good to get a look at your code; Like I said if you think of better ways of doing things then please let me know!

When I’ve got at least part of it working, I’ll send it over.

Sounds cool, good luck with the project :slight_smile:

Awesome man, keep us updated, GL

ancalagon said:
There is quite a bit of work left to do on the random level generation, as you can see. First I need to get it producing decent levels, then there are a lot of features I want to add for it, such as support for prefabricated sections, a third dimension, the ability to have outdoor as well as indoor sections in one level (read: procedural terrain generation), and support for entity marker placement. By entity marker placement I mean markers for monsters, powerups, etc etc. Those markers will be converted to the real thing in the LevelBuilder. Quick question, what happens if I attached a monster spatial to the level Node? Should entities only ever be attached to the rootnode?

Artwork? No artwork, not yet. When the game gets far enough that a release looks likely (lets face it, not many hobby games are ever finished), then I'll purchase stock artwork or look into a contractor. Sigh. Yes, I know it will be expensive, this is a very ambitious project.


1 ) Nah, I'd say it's pretty normal to have multiple nodes running around. I don't think there's really a right or a wrong way to setup your nodes, just whatever you feel like you need to do to keep things organized. Like for instance I have a node lurking about that is a container for objects that the user can mouse hover and interact with. I did this so that I don't have to search every object on the screen for an intersection, just the ones I'm interested in :p

2 ) No worries. Borrowing elements/assets from other games is normal in the startup phase. That's what I'm doing because at the moment the art assets would be the largest time sink I can even think of, and I don't even have the implementation nailed down yet, so I'd likely end up with tons of extra art that I wasted on that I can't use because I decided on doing something a certain way. Just make sure you clean all of the 'borrowed' elements out before you're done! :p

EDIT: Oh oh, and don't forget there's a lot of resources on the internet for free textures and such. There's no need to contract anything out that you can get for freeeeeeeeeeeee.

Good luck! You have a few games to pull inspiration from as well, keep in mind Diablo/Diablo2/Torchlight/Titan's Quest all do something similar to what you're trying to achieve, so don't be afraid to take some of the cues they did and build on them. It's one of the best ways I know of to learn.

Cheers!
~FlaH

@tehflah



Thanks, so my scene graph would end up looking like rootNode → levelNode → (All other nodes)



I suppose everything moves relative to the level anyway.



I’m not far enough to borrow assets! But I suppose I’ll have to. I want to do it in such a way that will allow the content to easily be replaced. The only art related thing I’m not sure of, relating to that, is things like a character wearing different armor - how would I achieve that? Entirely new models? If its too complex then such changes just wont be visible.



I’ll be drawing a lot of inspiration from Heretic, Diablo, and those cheesy FPS RPGs of yester year.



Made some necessary improvements to the level generator which broke it, but it had to be done. It will be better when its fixed, much better.

ancalagon said:
Thanks, so my scene graph would end up looking like rootNode -> levelNode -> (All other nodes)


It doesn't necessarily have to be like that, check out scenegraph for dummies. You can sort your nodes spatially or logically.

You can have rootNode -> audio nodes
|
V static nodes
physics nodes

etc. And in those nodes they can be split up as well e.g. static nodes into levels and vegetation or whatever.

Regarding the armour wearing thing, I'm not too sure. If you find out let us know :), someone around here is bound to have done it.

Edit: seems it cant show ascii art :P well its supposed to be root node split into audio nodes, static nodes and physics nodes
ancalagon said:
The only art related thing I'm not sure of, relating to that, is things like a character wearing different armor - how would I achieve that? Entirely new models? If its too complex then such changes just wont be visible.


Don't know if it has made it into the core, but this thread should help you with that:
http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/animcontrol-addmesh/
Using that method, i've been able to attach spatials sharing the same skeleton, with the mentioned caveats.

Success! Its generating mazes that look somewhat playable! Time to check in.



1 Like

Quick question about procedural terrain generation, for the experts out there. How would I mix a rectangular object, such as an outbuilding, with generated terrain?



What I thought of doing is dividing the outdoor terrain into a grid much as it is for the indoor levels. Then, either generating terrainquads using the individual grid squares, or finding the largest squares not occupied by a generated outbuilding. And somehow stitching it together, so the outbuildings are effectively not sitting on terrain at all.



Or can I just sink the outbuilding into the terrain somehow without it producing clipping problems?

So, the project is still ongoing. Since the last screenshot, I have implemented height for the mazes, as well as stairs. Stairs are not working 100% yet, but I decided to start working on the structure of the project as a whole. So, I implemented physics and player input, using a player control for the updating. Works great!



Next I decided to work on networking since it would have a large effect on the structure of the game. Going well so far, nearly at the testing stage. After reading the post on Valve’s network architecture, I think I’ll implement some of their techniques. Specifically, that the state of the game is updated at a fixed rate independent of the framerate, for more consitent netplay. To do that I think I’ll implement PhysicsTickListener in all of my controls, and use it as a source of timing. My other option is to instead add the controls to a control collection and iterate through them.

Mods - would you prefer me to start a development blog rather than post updates in this thread? Please let me know.



Success! Phase 1 of integrating multiplayer works! The project compiled and actually ran! This was somewhat surprising to me since I have spent the last few days working on the multiplayer architecture, so I was sure I had broken something fundamental.

What I decided to do was make the client essentially (mostly) unaware whether it was connecting to a multiplayer server or not. As far as it is concerned, it connects to a game server, requests a level, and then loads the level. That level may be local, it may not be. I also separated out the level server from the game server. The client in fact can be a level server. I made the decision to “trust” clients in this fashion - the advantage is that if a client is the only one running around a particular level, he experiences no lag as he is the server for the level. If he changes levels, the game server checks to see whether a level server exists already for that level, and connects him to it if it does. I felt such an arrangement would help in an action RPG FPS, where the players in a game could be spread out over multiple levels - one in town, one running a boss, the other completing a quest.

Anyway, I have not tested multiplayer itself. I just started up single player, and that worked first time. Check out these celebratory screenshots. The maze generation code has not been worked out in a while, so there re not miraculous.



http://i.imgur.com/gXRzd.jpg



http://i.imgur.com/AACML.jpg

ancalagon said:
Next I decided to work on networking since it would have a large effect on the structure of the game. Going well so far, nearly at the testing stage. After reading the post on Valve's network architecture, I think I'll implement some of their techniques. Specifically, that the state of the game is updated at a fixed rate independent of the framerate, for more consitent netplay. To do that I think I'll implement PhysicsTickListener in all of my controls, and use it as a source of timing. My other option is to instead add the controls to a control collection and iterate through them.


For the game I am making that is what I was doing, making a new thread which handled/send updates to client and server vice-versa. My question for the Mods or devs would be something along these lines.
JME looks like it runs on a timer, is that timer configurable? does it depend on your frames per second?
In my mind it would be beneficial to separate the two, but it could just be that you can piggy back JME update loop and not have problems

I see in the log produced by the game that a timer is started at 1000 ticks per second. That might be what you are looking for.



Does anyone know why I would get this exception?



[java]

SEVERE: Uncaught exception thrown in Thread[com.jme3.network.kernel.tcp.SelectorKernel@5d6d2633,5,main]

java.lang.RuntimeException: Error deserializing object

at com.jme3.network.base.MessageProtocol.createMessage(MessageProtocol.java:161)

at com.jme3.network.base.MessageProtocol.addBuffer(MessageProtocol.java:137)

at com.jme3.network.base.KernelAdapter.createAndDispatch(KernelAdapter.java:158)

at com.jme3.network.base.KernelAdapter.run(KernelAdapter.java:208)

Caused by: java.io.IOException: java.lang.InstantiationException: Networking.LevelRequestMessage

at com.jme3.network.serializing.serializers.FieldSerializer.readObject(FieldSerializer.java:102)

at com.jme3.network.serializing.Serializer.readClassAndObject(Serializer.java:284)

at com.jme3.network.base.MessageProtocol.createMessage(MessageProtocol.java:157)

… 3 more[/java]



I get it on the server side when receiving a message. I have registered my message classes with the serializer and the message classes are marked as @Serializable(). They all extend AbstractMessage. Any ideas? Seems to connect okay.

This is another place I can improve the sub-standard error reporting in Serializer.



My guess from that stack trace is that maybe LevelRequestMessage doesn’t have a no-arg constructor.



I will improve the exception in that particular area and it will go into the next nightly… so if that wasn’t the issue then we’ll see the more specific cause at least.

I dont think any of my messages do, thanks pspeed. Is there a tutorial or example I can use for the new SpiderMonkey?