Post news RSS Indev 1.1

Biggest updates: Menu, Entity Loader, Jobcreator, Workers.

Posted by on

In this Version I've made some inprovements in the Production System and some new Features.

Menu:
I've made an easy system for the menu, wich works fine but will become a few upgrades in the future.

The pause menu with 3 buttons

Production System:
The production system have a lot of improvments and also can now sell finished products.

Workers:
The machines, assemblylines, shipping docks and logisticsystem now needs workers to do their jobs.
There is also a basic mood system, wich influences their productivity.

All four worker models

Entity Loader:
Entities will now be loaded through a file and now I just need to search for the name with the "Entity Selector". The entities will be stored in static Lists, so I can edit them everywhere with just one line of code.
The data Looks like this:
VM3 VM3 0 1 VM3_tex 0 0 0 1 50 50 50 2 -1 0 -4 0 0 -3 6.6 -2.1 -1.1

Here is the code that loads the machines:

public static List<Machine> loadMachine(String filename){
		List<Machine> tmp = new ArrayList<Machine>(); System.out.println(filename);
		try {
			Scanner s = new Scanner(new File("res/FileData/" + filename + ".txt"));
			while(s.hasNext()){
				String name = s.next();
				String obj = s.next();
				float reflect = (float) Float.valueOf(s.next()); //norm: 0
				float damp = (float) Float.valueOf(s.next()); //norm: 1
				String tex = s.next();
				float rotX = (float) Float.valueOf(s.next());
				float rotY  = (float) Float.valueOf(s.next());
				float rotZ = (float) Float.valueOf(s.next());
				float scale = (float) Float.valueOf(s.next());
				Vector3f machdata = new Vector3f((float) Float.valueOf(s.next()),(float) Float.valueOf(s.next()),(float) Float.valueOf(s.next()));
				int machuse = s.nextInt();
				Vector3f offwp = new Vector3f((float) Float.valueOf(s.next()),(float) Float.valueOf(s.next()),(float) Float.valueOf(s.next()));
				Vector3f offwork = new Vector3f((float) Float.valueOf(s.next()),(float) Float.valueOf(s.next()),(float) Float.valueOf(s.next()));
				Vector3f offchips = new Vector3f((float) Float.valueOf(s.next()),(float) Float.valueOf(s.next()),(float) Float.valueOf(s.next()));
				tmp.add(new Machine(createTexMod(obj, tex, reflect, damp), rotX, rotY, rotZ, scale, machdata, machuse, offwp, offwork, offchips, name));
			}
			s.close();
		} catch (FileNotFoundException e) { System.err.println(filename + " not existing!");} 
		return tmp;
	}

P.S: I know that I should use the BufferedReader class instead.

Jobcreator:
Machining jobs are now created with a simple algorythm. The algorythm goes through the blueprint-list with the needed workpieces for that product, and looks if it has a subworkpiece or if it is raw, and creates two lists. One for all workpieces that will ever be created during production, and another wich stores all workpieces that are needed to build the final product.

The complete code for creating the two lists (blps and prods)

private List<Workpiece> createwpnew(List<Workpiece> blp, int jobid, int piecenum, List<Workpiece> prods){
		List<Workpiece> blps = new ArrayList<Workpiece>();
		for(Workpiece p : blp){
			List<Workpiece> pieces = new ArrayList<Workpiece>();
			for(int i = 0; i < p.getPieces().size(); i++){
				Workpiece subpiece = new Workpiece(Entityselector.loadWorkpiece(p.getPieces().get(i).getName()), new Vector3f(-191, 0.1f, -110), jobid, piecenum, 0, i);
				pieces.add(subpiece);
				blps.add(subpiece);
			}
			Workpiece endpiece = new Workpiece(Entityselector.loadWorkpiece(p.getName()), new Vector3f(-191, 0.1f, -110), pieces, jobid, piecenum);
			prods.add(endpiece);
			blps.add(endpiece);
		}
		System.out.println(blps.size() + " " + prods.size());
		return blps;
	}

New Models:

VM3 mill

Shipping dock

Indev 1.2 Topics:

- variable playspeed
- Animation
- Object placer
- Sphere picker
- Position grid
- Basic GUI

Comments
blingblinggtav
blingblinggtav

Looking good guys

Reply Good karma Bad karma0 votes
Thunderwork_Studio Author
Thunderwork_Studio

Thank's bro.

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.