So, I started going back to java for a few reasons
1) Java Games are becoming mainstream again (i.e Minecraft)
2) I can mod games
3) For android applications
However, as my first projects I took up a bunch of simple games
http://www.cokeandcode.com/
Provides a lot of nice tutorials, likewise so did
http://www.javacooperation.gmxhome.de/Applets/Games/JrioGame/JrioEng.html
A common thing I noticed between these two tutorials was that I had to hand code the games myself.
This wasn't that big of a deal to me though since thats something I inspire to create: ground up frameworks
So, I started out trying to do Proof of concept for a few things
1) since java would send entire objects into functions, I made sure that each of my rendering engines only took an array of semantic data
for example: Graphic Handler took a int[][][]
first array was for layers
second was for images in that layer
third was semantic data
1: image reference
2: image animation reference (I would breakup a single image into parts)
3: x position
4: y position
2) Seperate my rendering method from my game
This means that I would seperate the game as much as possible from "frames" or "Applet" code allowing my game to specifically focus on what its suppose to do rather than have to rewrite my rendering engine just so that i can export it
Now this was successful, and I was able to prove it worked by adding a simple game (hardcoded) into the game loop and play with it
Now, that was all fine and dandy
But I desipise single player games generally
-not because they aren't fun, but because I'm competitive at heart
Likewise I don't like using keyboard and mouse so....
Jinput - http://java.net/projects/jinput/
What Jinput allows me to do is see all of the connected hardware and buttons on my computer and allow me to set them as my game buttons.
Now... thats cool in my opinon...
But before I do that, I wanted to set it up so I can make it multiplayer....
Thats where things started going downhill
I added two new classes
LogicHandler Class
PlayerHandler Class
The point of Logic Handler was to be the game
-Graphics were just graphics
-Sound would be thread seperated
-Player inputs are also thread seperated
-Logic is the game.
GameLoopRun(){
LogicHandler.doLogic(PlayerHandler.getInputs);
//this would send a hasmap of the players current inputs (which would be an array)
//and make the logic handler do appropiate playe rmovements, then hitdetection, then etc
GraphicHandler.prepareGraphics(LogicHandler.getGraphicData());
AudioHandler.prepareAudio(LogicHandler.getAudioData());
//Prepares all the audio and graphic data based on arrays sent from logichandler
Sleep(previoustime+timetowait - currenttime);
GraphicHandler.fire();
AudioHandler.fire();
//this would do the actions
}
However....
I've hardcoded my proof of concept so much that when I took one thing out another broke
And so many errors I would have to sort through
On top of that (because again... everything is so hardcoded) I realized if I wanted to make the games built of a series XML files and associated pictures and sounds (which was the plan) I would have to redo my rendering engine as well to make sure that Strings and Containers would be dealt with appropiately
I don't want to use Swing... I don't... honestly...
but the fact of the matter is, my small little plan was turning into a grand scheme that I don't think I would be able to handle
This was my Plan
Platform - Variable Class that I would be able to switch in and switch out as my desire.
-Important ones were; JFrame, fullscreen (very important since there will be less operating system intereference), Applet, and jnlp (which i think is just jframe with a semantic xml file from the research i did)
GameLoop
-The thread that would have the highest priority. I needed to make sure the gameloop would run, everyother thread will have to sit on the wayside and hope they get their turn
Player Handler
-lagRespect function-would respect the lag of the webplayers and force your button inputs to be delayed as well. also would need to get a once in a while position update. would also send controller inputs to web servers
-Player
--ID to be sorted and looked for
--List of inputs and their current state
---set inputs function
-WebHandler
--The amount of lag
--List of IP to ID
--get playerlist from server x (would return a list of players, their IP addresses and server port)
--Personal Server
---Open/Close for new players from the web
---poll function that is basically a thread that accepts each client socket inputs and set them to the appropiate player
-Controller Handler
--List of Controller to ID
--poll function that would poll only the important controllers and set the player to the appropiate state
Graphic Handler
-Needs to preload all images before hand
-Data it would accept
--String, Color, xpos, ypos
--width, height, Color (as hex), xpos, ypos
--Picture, Animation(single picture is cutup into peices), xpos, ypos
-buffers it
-displays it
Audio Handler
-Data it would accept was something I was still confused about since I wanted it to be pretty advanced yet intuitive was left with
--Sound number, start or stop
-Honestly, Audio simple was enough of a hassle to start, though I wouldn't be satisfied until I could do modulation and such
Logic Hander
-Player inputs to Logic Changing
-Velocity try
--foreach(blockwidth/height change)Hit Detect
-Change State
Regardless
I got disorganized in my code
And everything started falling apart
I eventually tried to go back and make things work one by one
Then I realized I didn't save old copies
There were so many changes...
I need to take a break from this project I believe
No comments:
Post a Comment